* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 1000px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    margin-top: 20px;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.header p {
    opacity: 0.9;
    font-size: 1.1rem;
}

.main-content {
    padding: 40px;
}

.section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: #667eea;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

select, input, textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    background: white;
}

select:focus, input:focus, textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.proxy-templates {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.template-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.template-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.template-card.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea11 0%, #764ba211 100%);
}

.template-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.template-desc {
    font-size: 0.9rem;
    color: #666;
}

.credentials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 25px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    border: 2px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(239, 68, 68, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(107, 114, 128, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(245, 158, 11, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.proxy-controls {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.proxy-display {
    background: #f1f5f9;
    border-radius: 10px;
    padding: 15px;
    margin-top: 20px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    word-break: break-all;
    border: 2px solid #e0e0e0;
}

.proxy-display-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: #667eea;
}

.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.status-message {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: none;
    animation: fadeIn 0.3s ease;
}

.status-success {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #a7f3d0;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #fecaca;
}

.status-info {
    background: #dbeafe;
    color: #1e40af;
    border: 2px solid #bfdbfe;
}

.status-warning {
    background: #fef3c7;
    color: #92400e;
    border: 2px solid #fde68a;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

input:checked + .toggle-slider:before {
    transform: translateX(30px);
}

.websocket-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    margin-left: 15px;
}

.ws-connected {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #a7f3d0;
}

.ws-disconnected {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #fecaca;
}

.ws-connecting {
    background: #fef3c7;
    color: #92400e;
    border: 2px solid #fde68a;
}

.timer-control {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto; /* Push to right */
}

.timer-control input {
    width: 100px; 
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-family: monospace; /* Better for numbers */
}

.timer-control #timerMinute {
    width: 65px;
}

.timer-control input::placeholder {
    font-family: 'Inter', sans-serif; /* Regular font for placeholder */
}

.timer-control input:focus {
    outline: none;
    border-color: #4CAF50;
}

.timer-input-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.timer-input-group input {
    width: 80px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.input-label {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.timer-city-select select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    min-width: 160px;
}

.timer-city-select select:focus {
    outline: none;
    border-color: #ff9800;
}

.timer-control #timerSeconds {
    width: 100px;
}

/* Style for the entire connection-controls */
.connection-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.parameter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.param-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s ease;
}

.param-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.param-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.param-name {
    font-weight: 600;
    color: #333;
    font-size: 1.1rem;
}

.param-value {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #666;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 5px;
    word-break: break-all;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #667eea11 0%, #764ba211 100%);
    border-radius: 10px;
    border: 2px solid #667eea33;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: #333;
}

.user-status {
    font-size: 0.9rem;
    color: #666;
}

/* Add these to your existing style.css */

/* Country flags in select - FIXED */
/* Custom select container */
.country-select-container {
    position: relative;
    width: 100%;
}

.country-select-container select {
    width: 100%;
    padding: 12px 15px;
    padding-left: 45px; /* Space for flag */
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    background: white;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.country-select-container::after {
    content: "▾";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #666;
}

/* Flag preview */
.flag-preview {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 15px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
}

.flag-dz {
    background-image: url('https://flagcdn.com/w20/dz.png');
}

.flag-ma {
    background-image: url('https://flagcdn.com/w20/ma.png');
}

.flag-pt {
    background-image: url('https://flagcdn.com/w20/pt.png');
}

/* Proxy template display */
.proxy-template-line {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    background: #1e293b;
    color: #e2e8f0;
    padding: 12px 15px;
    border-radius: 8px;
    margin: 10px 0;
    border-left: 4px solid #667eea;
    word-break: break-all;
}

.proxy-percent-input {
    width: 80px !important;
    text-align: center;
    font-weight: bold;
}

.proxy-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.proxy-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.proxy-content {
    flex: 1;
    min-width: 0;
}

.proxy-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.proxy-total-percent {
    font-weight: bold;
    font-size: 1.2rem;
    padding: 5px 15px;
    border-radius: 20px;
    background: #f1f5f9;
}

.proxy-total-valid {
    color: #10b981;
    background: #d1fae5;
}

.proxy-total-invalid {
    color: #ef4444;
    background: #fee2e2;
}

/* WebSocket control buttons */
.ws-action-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .ws-action-buttons {
        grid-template-columns: 1fr;
    }
}

.ws-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.ws-action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.ws-action-btn i {
    font-size: 2rem;
    margin-bottom: 10px;
}

.ws-action-btn span {
    font-weight: 600;
    font-size: 0.9rem;
}

.ws-connect {
    background: linear-gradient(135deg, #10b98122 0%, #05966922 100%);
    border-color: #10b981;
    color: #065f46;
}

.ws-index {
    background: linear-gradient(135deg, #3b82f622 0%, #1d4ed822 100%);
    border-color: #3b82f6;
    color: #1e40af;
}

.ws-refresh {
    background: linear-gradient(135deg, #f59e0b22 0%, #d9770622 100%);
    border-color: #f59e0b;
    color: #92400e;
}

.ws-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Parameter cards */
.param-card {
    display: flex;
    flex-direction: column;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s ease;
}

.param-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.param-name {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
    margin-bottom: 8px;
}

.param-value {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #666;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 6px;
    word-break: break-all;
}

/* Template selection */
.template-functions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.template-function {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.template-function:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.template-function.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea11 0%, #764ba211 100%);
}

.template-function-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.template-function-code {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #666;
    background: #f8fafc;
    padding: 8px;
    border-radius: 6px;
    margin-top: 8px;
    overflow-x: auto;
}

/* Credential inputs */
.credential-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.credential-input {
    position: relative;
}

.credential-input label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.credential-input label i {
    color: #667eea;
}

/* Add proxy button */
.add-proxy-btn {
    width: 100%;
    padding: 15px;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    color: #64748b;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.add-proxy-btn:hover {
    border-color: #667eea;
    background: #667eea11;
    color: #667eea;
}

/* Proxy list */
.proxy-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.proxy-list::-webkit-scrollbar {
    width: 8px;
}

.proxy-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.proxy-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.proxy-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.show-all-templates-btn {
    margin: 15px 0;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.show-all-templates-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.show-all-templates-btn i {
    transition: transform 0.3s ease;
}

.show-all-templates-btn.expanded i {
    transform: rotate(180deg);
}

.template-function.hidden {
    display: none;
}

.proxy-item {
    position: relative;
}

.proxy-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.proxy-template-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.proxy-template-input:focus {
    outline: none;
    border-color: #4CAF50;
    background: white;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.proxy-template-line {
    white-space: nowrap;        /* Prevent wrapping to new lines */
    overflow: hidden;           /* Hide overflow content */
    text-overflow: ellipsis;    /* Show ... when text overflows */
    max-width: 100%;            /* Ensure it doesn't exceed container */
    display: block;             /* Make it a block element */
}

.proxy-list-textarea {
    width: 100%;
    height: 120px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
    resize: vertical;
    margin-bottom: 10px;
}

.proxy-list-info {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.proxy-count {
    background: #e3f2fd;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.textarea-container {
    margin-bottom: 15px;
}

.proxy-edit-btn {
    padding: 8px 12px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.proxy-edit-btn:hover {
    background: #1976D2;
}

.proxy-save-btn {
    padding: 8px 12px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.proxy-save-btn:hover {
    background: #45a049;
}

.param-value-container {
    margin: 10px 0;
}

.param-value-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.param-value-input:focus {
    outline: none;
    border-color: #4CAF50;
    background: white;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}