* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1e293b;
    --secondary-color: #64748b;
    --accent-color: #0ea5e9;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --border-color: #e2e8f0;
    --bg-light: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Login Screen */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: white;
    padding: 48px 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 440px;
    animation: fadeIn 0.4s ease-out;
}

.brand-header {
    text-align: center;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
}

.brand-icon {
    font-size: 64px;
    margin-bottom: 10px;
}

.brand-header h1 {
    color: var(--primary-color);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 14px;
    letter-spacing: 0.2px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s ease;
    background-color: white;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.help-text {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.error-message {
    color: var(--danger-color);
    font-size: 14px;
    margin-top: 16px;
    padding: 12px 16px;
    background-color: #fef2f2;
    border-left: 3px solid var(--danger-color);
    border-radius: 6px;
    display: none;
}

.error-message.show {
    display: block;
    animation: slideIn 0.3s ease-out;
}

/* Header */
.header {
    background: white;
    box-shadow: var(--shadow-sm);
    padding: 20px 0;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-section h1 {
    color: var(--primary-color);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.divider {
    color: var(--border-color);
    font-weight: 300;
}

.header-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

/* Buttons */
button {
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.2px;
}

.btn-primary {
    width: 100%;
    background-color: var(--accent-color);
    color: white;
    padding: 13px 24px;
    border-radius: 8px;
}

.btn-primary:hover {
    background-color: #0284c7;
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.btn-secondary:hover {
    background-color: var(--bg-light);
    color: var(--text-primary);
}

.btn-logout {
    background-color: transparent;
    color: var(--danger-color);
    padding: 10px 20px;
    border: 1px solid var(--danger-color);
    border-radius: 8px;
    font-size: 14px;
}

.btn-logout:hover {
    background-color: var(--danger-color);
    color: white;
}

.btn-refresh {
    background-color: transparent;
    color: var(--text-secondary);
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 36px;
    height: 36px;
}

.btn-refresh:hover {
    background-color: var(--bg-light);
    color: var(--text-primary);
    transform: rotate(180deg);
}

/* Container & Cards */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 40px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 24px;
}

.card {
    background: white;
    padding: 32px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.card-title h2 {
    color: var(--primary-color);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.card-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

/* Session List */
.session-list {
    max-height: 500px;
    overflow-y: auto;
}

.session {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 12px;
    background-color: white;
    transition: all 0.2s ease;
}

.session:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow-sm);
}

.session-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.session-id {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    letter-spacing: 0.2px;
}

.status {
    font-weight: 600;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-block;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.status.Connected {
    color: #065f46;
    background-color: #d1fae5;
}

.status.Waiting {
    color: #92400e;
    background-color: #fef3c7;
}

.session-actions {
    display: flex;
    gap: 8px;
}

.session-actions button {
    padding: 8px 16px;
    font-size: 13px;
}

.loading {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 40px;
    border-radius: 16px;
    width: 90%;
    max-width: 540px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: slideDown 0.3s ease;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 6px;
    width: 40px;
    height: 40px;
}

.close-btn:hover {
    background-color: var(--bg-light);
    color: var(--text-primary);
}

.modal-content h2 {
    color: var(--primary-color);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.modal-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 32px;
}

#qrcode {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    margin: 24px 0;
    padding: 24px;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

#qrcode img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.qr-instructions {
    text-align: left;
    background-color: var(--bg-light);
    padding: 24px;
    border-radius: 12px;
    margin-top: 24px;
    border: 1px solid var(--border-color);
}

.instructions-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 14px;
}

.qr-instructions ol {
    margin-left: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.8;
}

.qr-instructions li {
    margin-bottom: 8px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-10px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
    20%, 40%, 60%, 80% { transform: translateX(8px); }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .brand-section {
        flex-wrap: wrap;
    }
    
    .session {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .session-actions {
        width: 100%;
    }
    
    .session-actions button {
        flex: 1;
    }
    
    .login-card {
        padding: 32px 24px;
    }
    
    .modal-content {
        padding: 32px 24px;
    }
}

/* Scrollbar Styling */
.session-list::-webkit-scrollbar {
    width: 8px;
}

.session-list::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 4px;
}

.session-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.session-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}