/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0a0e1a;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(16, 22, 44, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 28px;
}
.logo-text {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-badge {
    font-size: 11px;
    background: rgba(124, 58, 237, 0.2);
    color: #a78bfa;
    padding: 2px 10px;
    border-radius: 20px;
    border: 1px solid rgba(124, 58, 237, 0.3);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: #a78bfa;
    border: 1px solid rgba(124, 58, 237, 0.3);
}

.btn-outline:hover {
    background: rgba(124, 58, 237, 0.1);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    font-size: 18px;
}

/* Status Badge */
.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #a0aec0;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background: #22c55e;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 32px;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: white;
}

.stat-label {
    font-size: 13px;
    color: #a0aec0;
    margin-top: 2px;
}

/* Sessions */
.sessions-section {
    margin: 24px 0 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.sessions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

/* Session Card */
.session-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.session-card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
    border-color: rgba(124, 58, 237, 0.3);
}

.session-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.session-phone {
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.session-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.session-status.active {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.session-status.inactive {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.session-status .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.session-status.active .dot {
    background: #22c55e;
}

.session-status.inactive .dot {
    background: #ef4444;
}

.session-details {
    font-size: 13px;
    color: #a0aec0;
}

.session-details p {
    margin: 4px 0;
}

.session-details .label {
    color: #718096;
}

.session-id {
    font-size: 11px;
    color: #718096;
    word-break: break-all;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 8px;
    font-family: monospace;
}

.session-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 2px dashed rgba(255, 255, 255, 0.06);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    color: white;
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state p {
    color: #a0aec0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #141b2d;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-sm {
    max-width: 400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.modal-body {
    padding: 24px;
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #e0e0e0;
    margin-bottom: 6px;
}

.form-group small {
    display: block;
    font-size: 12px;
    color: #718096;
    margin-top: 4px;
}

.phone-input-group {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s;
}

.phone-input-group:focus-within {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.phone-prefix {
    padding: 12px 12px 12px 16px;
    color: #a0aec0;
    font-size: 16px;
    font-weight: 600;
}

.phone-input {
    background: transparent;
    border: none;
    padding: 12px 16px 12px 0;
    color: white;
    font-size: 16px;
    font-family: inherit;
    flex: 1;
    outline: none;
}

.phone-input::placeholder {
    color: #4a5568;
}

/* Method Selector */
.method-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.method-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: #a0aec0;
    transition: all 0.3s;
}

.method-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.method-btn.active {
    border-color: #7c3aed;
    background: rgba(124, 58, 237, 0.1);
    color: white;
}

.method-icon {
    font-size: 20px;
}

/* QR Display */
.qr-container {
    text-align: center;
    padding: 20px 0;
}

.qr-container img {
    background: white;
    padding: 16px;
    border-radius: 12px;
    max-width: 250px;
    width: 100%;
    image-rendering: pixelated;
}

.qr-hint {
    color: #e0e0e0;
    font-weight: 500;
    margin-top: 12px;
}

.qr-hint-small {
    color: #718096;
    font-size: 13px;
    margin-top: 4px;
}

/* Pairing Code */
.code-container {
    text-align: center;
    padding: 20px 0;
}

.pairing-code {
    font-size: 48px;
    font-weight: 800;
    letter-spacing: 8px;
    color: white;
    background: rgba(0, 0, 0, 0.3);
    padding: 20px 30px;
    border-radius: 12px;
    font-family: monospace;
    margin-bottom: 12px;
}

.code-hint {
    color: #e0e0e0;
    font-weight: 500;
}

.code-hint-small {
    color: #718096;
    font-size: 13px;
    margin-top: 4px;
}

/* Pairing Status */
.pairing-status {
    text-align: center;
    padding: 20px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.pairing-status p {
    color: #e0e0e0;
    font-weight: 500;
}

.pairing-status small {
    color: #718096;
}

/* Success */
.success-container {
    text-align: center;
    padding: 10px 0;
}

.success-icon {
    font-size: 64px;
    margin-bottom: 12px;
}

.success-container h3 {
    color: white;
    font-size: 20px;
    margin-bottom: 4px;
}

.success-container p {
    color: #a0aec0;
    margin-bottom: 16px;
}

.session-id-box {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
}

.session-id-box label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #a78bfa;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.session-id-display {
    font-family: monospace;
    font-size: 12px;
    color: #a0aec0;
    word-break: break-all;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 12px;
    border-radius: 6px;
    margin: 8px 0;
}

.warning-text {
    display: block;
    color: #f59e0b;
    font-size: 12px;
    margin-top: 8px;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Footer */
.footer {
    margin-top: auto;
    padding: 20px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    color: #4a5568;
    font-size: 13px;
}

.footer-version {
    color: #2d3748;
    font-size: 12px;
    margin-top: 2px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(124, 58, 237, 0.5);
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .header-actions .btn {
        flex: 1;
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .sessions-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 10px;
        max-height: 95vh;
    }
    
    .pairing-code {
        font-size: 32px;
        letter-spacing: 4px;
        padding: 16px 20px;
    }
    
    .method-selector {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 14px;
    }
    
    .stat-value {
        font-size: 22px;
    }
}