/* ============================================
   DentClinic TV - Premium Dark Theme
   ============================================ */

/* CSS Variables */
:root {
    --bg-primary: #0a0f0d;
    --bg-secondary: #0f1a14;
    --bg-card: rgba(20, 40, 30, 0.6);
    --bg-glass: rgba(30, 60, 45, 0.3);
    --accent-primary: #2E7D32;
    --accent-secondary: #4CAF50;
    --accent-glow: rgba(46, 125, 50, 0.4);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --border-glass: rgba(255, 255, 255, 0.1);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: linear-gradient(-45deg,
            #0a0f0d,
            #0d1a14,
            #0f2418,
            #0a1510,
            #0d1f15,
            #081210);
    background-size: 400% 400%;
    animation: gradientShift 20s ease infinite;
    color: var(--text-primary);
    direction: rtl;
    min-height: 100vh;
    overflow: hidden;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Animated background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 80%, var(--accent-glow) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(46, 125, 50, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(76, 175, 80, 0.1) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

#app-container {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* ============================================
   Login Screen - Premium QR Display
   ============================================ */
.login-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 40px;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-brand {
    margin-bottom: 30px;
    text-align: center;
}

.login-brand-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 10px 40px var(--accent-glow);
}

.login-brand-icon .material-icons {
    font-size: 40px;
    color: white;
}

.login-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.qr-container {
    position: relative;
    padding: 30px;
    background: var(--bg-glass);
    border-radius: 24px;
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow:
        0 0 60px var(--accent-glow),
        var(--shadow-lg),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: pulseGlow 3s ease-in-out infinite;
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 40px var(--accent-glow), var(--shadow-lg);
    }

    50% {
        box-shadow: 0 0 80px var(--accent-glow), var(--shadow-lg);
    }
}

.qr-code {
    width: 280px;
    height: 280px;
    border-radius: 16px;
    background: white;
    padding: 15px;
    display: block;
}

.qr-instructions {
    margin-top: 30px;
    text-align: center;
}

.qr-instructions p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.qr-instructions .material-icons {
    color: var(--accent-secondary);
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.loading-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background: var(--accent-secondary);
    border-radius: 50%;
    animation: dotPulse 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0;
}

@keyframes dotPulse {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================
   Main App Layout
   ============================================ */
.main-app {
    display: flex;
    height: 100vh;
    gap: 20px;
    padding: 20px;
}

.content-area {
    flex: 7;
    background: var(--bg-glass);
    border-radius: 24px;
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.sidebar {
    flex: 3;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: var(--transition-smooth);
}

/* ============================================
   Time Display - Premium Clock
   ============================================ */
.time-display {
    background: var(--bg-glass);
    border-radius: 20px;
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.time-display .time-value {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.time-display .time-label {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* ============================================
   Appointment List
   ============================================ */
.appointment-list {
    flex: 1;
    overflow-y: auto;
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Custom scrollbar */
.appointment-list::-webkit-scrollbar {
    width: 6px;
}

.appointment-list::-webkit-scrollbar-track {
    background: transparent;
}

.appointment-list::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 3px;
}

/* ============================================
   Appointment Tile - Glass Card Design
   ============================================ */
.appointment-tile {
    background: var(--bg-glass);
    border-radius: 16px;
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    overflow: hidden;
    transition: var(--transition-smooth);
    animation: slideIn 0.5s ease-out backwards;
}

.appointment-tile:hover {
    transform: translateX(-5px);
    border-color: var(--accent-primary);
    box-shadow: 0 0 30px var(--accent-glow);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Status Bar */
.appointment-status {
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.appointment-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.appointment-status.waiting {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
}

.appointment-status.in-progress {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
}

.appointment-status.completed {
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
    color: white;
}

.appointment-status.absent {
    background: linear-gradient(135deg, #F44336, #D32F2F);
    color: white;
}

/* Appointment Content */
.appointment-content {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.patient-avatar {
    width: 55px;
    height: 55px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.patient-info {
    flex: 1;
    min-width: 0;
}

.patient-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.appointment-time {
    font-size: 0.95rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.appointment-time .material-icons {
    font-size: 18px;
    color: var(--accent-secondary);
}

.appointment-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.doctor-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 12px;
    border-radius: 20px;
}

.timer-display {
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-secondary);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.waiting {
    background: #FF9800;
}

.status-dot.in-progress {
    background: #2196F3;
}

.status-dot.completed {
    background: var(--accent-secondary);
}

.status-dot.absent {
    background: #F44336;
}

/* ============================================
   Carousel & Video
   ============================================ */
.carousel {
    width: 100%;
    height: 100%;
    position: relative;
    background: var(--bg-primary);
}

.carousel-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.carousel-image.active {
    opacity: 1;
}

.video-container {
    width: 100%;
    height: 100%;
}

.fallback-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--bg-primary);
    color: var(--text-primary);
    text-align: center;
    padding: 40px;
}

.fallback-content h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 15px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.fallback-content p {
    font-size: 1.3rem;
    color: var(--text-secondary);
}

/* ============================================
   Audio Controls
   ============================================ */
.audio-controls {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 1000;
}

.audio-toggle {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--accent-secondary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.audio-toggle:hover {
    background: var(--accent-primary);
    color: white;
    transform: scale(1.1);
}

.audio-toggle.muted {
    color: #F44336;
}

/* ============================================
   Error/Permission States
   ============================================ */
.error-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 40px;
    text-align: center;
}

.error-icon {
    width: 100px;
    height: 100px;
    background: rgba(244, 67, 54, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
}

.error-icon .material-icons {
    font-size: 50px;
    color: #F44336;
}

.error-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.error-message {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 500px;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 1200px) {
    .main-app {
        flex-direction: column;
    }

    .sidebar {
        flex-direction: row;
        flex: none;
        height: auto;
        max-height: 200px;
    }

    .time-display {
        flex: none;
        width: 200px;
    }

    .appointment-list {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .appointment-tile {
        min-width: 300px;
        flex-shrink: 0;
    }
}

/* ============================================
   Animation Classes
   ============================================ */
.status-change {
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}