/* ==========================================================================
   Saud - MOFA Customer AI Assistant Dashboard Core Styling
   Premium Design System with Light/Dark Themes & Smooth Micro-Animations
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Cairo:wght@400;600;700&display=swap');

:root {
    /* Font Families */
    --font-primary: 'Outfit', sans-serif;
    --font-secondary: 'Cairo', sans-serif;

    /* Transition Speeds */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    /* Sidebar Dimensions */
    --sidebar-width: 80px;
    --sidebar-width-expanded: 240px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-round: 50%;

    /* Premium Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.05);
    --shadow-glow-blue: 0 0 15px rgba(59, 130, 246, 0.2);
    --shadow-glow-green: 0 0 15px rgba(34, 197, 94, 0.2);

    /* Light Theme Color Palette (HSL Tailored) */
    --bg-main: 220 20% 97%;          /* #f1f3f7 */
    --bg-card: 0 0% 100%;            /* #ffffff */
    --bg-sidebar: 0 0% 100%;         /* #ffffff */
    --bg-header: 0 0% 100%;          /* #ffffff */
    --border-color: 220 13% 91%;     /* #e2e8f0 */
    --border-focus: 220 90% 60%;
    
    /* Text Colors */
    --text-primary: 222 47% 11%;     /* #0f172a */
    --text-secondary: 215 16% 47%;   /* #64748b */
    --text-muted: 215 15% 65%;       /* #94a3b8 */
    --text-white: 0 0% 100%;

    /* Status Colors (HSL) */
    --color-primary: 221 83% 53%;    /* Blue */
    --color-success: 142 70% 45%;    /* Green */
    --color-warning: 35 92% 51%;     /* Orange */
    --color-danger: 0 84% 60%;       /* Red */
    --color-purple: 262 83% 58%;     /* Purple/Indigo */
    --color-teal: 174 72% 41%;       /* Teal */
    --color-pink: 330 81% 60%;       /* Pink */

    /* Glassmorphism Accents */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-blur: 15px;
}

[data-theme="dark"] {
    /* Dark Theme Color Palette */
    --bg-main: 222 47% 6%;           /* #050b14 Dark Space */
    --bg-card: 222 47% 10%;          /* #0b1324 Sleek Dark Slate */
    --bg-sidebar: 222 47% 8%;        /* #080f1d */
    --bg-header: 222 47% 8%;         /* #080f1d */
    --border-color: 222 47% 16%;     /* Subtle Dark Border */
    --border-focus: 221 83% 53%;

    /* Text Colors */
    --text-primary: 210 40% 98%;     /* #f8fafc */
    --text-secondary: 215 20% 80%;   /* #cbd5e1 */
    --text-muted: 215 16% 55%;       /* #64748b */

    /* Glassmorphism Accents */
    --glass-bg: rgba(11, 19, 36, 0.75);
    --glass-border: rgba(255, 255, 255, 0.05);

    /* Premium Shadows */
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   Base & Reset Styles
   ========================================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-primary);
    background-color: hsl(var(--bg-main));
    color: hsl(var(--text-primary));
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

body[dir="rtl"] {
    font-family: var(--font-secondary), var(--font-primary);
}

input, button, select, textarea {
    font-family: inherit;
    color: inherit;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: hsl(var(--text-muted) / 0.3);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--text-muted) / 0.5);
}

/* ==========================================================================
   Login Page Styling (index.php)
   ========================================================================== */

.login-wrapper {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, hsl(var(--bg-main)) 0%, hsl(var(--bg-main) / 0.9) 100%);
    position: relative;
    overflow: hidden;
}

/* Glow Background Circles */
.login-glow-1 {
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: var(--radius-round);
    background: radial-gradient(circle, hsl(var(--color-primary) / 0.15) 0%, transparent 70%);
    top: -10%;
    left: -10%;
    z-index: 1;
    filter: blur(40px);
}
.login-glow-2 {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: var(--radius-round);
    background: radial-gradient(circle, hsl(var(--color-success) / 0.1) 0%, transparent 70%);
    bottom: -15%;
    right: -10%;
    z-index: 1;
    filter: blur(50px);
}

.login-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    width: 440px;
    padding: 48px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    z-index: 10;
    display: flex;
    flex-direction: center;
    flex-direction: column;
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-logo-container {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo {
    width: 200px;
    height: auto;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.05));
    transition: filter var(--transition-normal);
}
[data-theme="dark"] .login-logo {
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.15)) invert(0.9) hue-rotate(180deg);
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    color: hsl(var(--text-primary));
    text-align: center;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.login-subtitle {
    font-size: 14px;
    color: hsl(var(--text-secondary));
    text-align: center;
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: hsl(var(--text-secondary));
    margin-bottom: 8px;
}

.input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    color: hsl(var(--text-muted));
    width: 18px;
    height: 18px;
    pointer-events: none;
    transition: color var(--transition-fast);
}

.input-field {
    width: 100%;
    padding: 14px 16px 14px 44px;
    border-radius: var(--radius-md);
    border: 1px solid hsl(var(--border-color));
    background-color: hsl(var(--bg-main) / 0.5);
    color: hsl(var(--text-primary));
    font-size: 14px;
    font-weight: 500;
    outline: none;
    transition: all var(--transition-normal);
}

.input-field:focus {
    border-color: hsl(var(--border-focus));
    background-color: hsl(var(--bg-card));
    box-shadow: 0 0 0 4px hsl(var(--color-primary) / 0.1);
}

.input-field:focus + .input-icon {
    color: hsl(var(--color-primary));
}

.login-error {
    background-color: hsl(var(--color-danger) / 0.1);
    border: 1px solid hsl(var(--color-danger) / 0.2);
    color: hsl(var(--color-danger));
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: shake 0.5s ease-in-out;
}

.role-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.role-option {
    border: 1px solid hsl(var(--border-color));
    background-color: hsl(var(--bg-main) / 0.3);
    padding: 12px;
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all var(--transition-normal);
}

.role-option.active {
    border-color: hsl(var(--color-primary));
    background-color: hsl(var(--color-primary) / 0.08);
    color: hsl(var(--color-primary));
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, hsl(var(--color-primary)) 0%, hsl(var(--color-primary) / 0.85) 100%);
    color: hsl(var(--text-white));
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-glow-blue);
    transition: all var(--transition-normal);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px hsl(var(--color-primary) / 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* ==========================================================================
   Layout Structures (dashboard.php)
   ========================================================================== */

.app-container {
    display: flex;
    width: 100vw;
    min-height: 100vh;
}

/* Sidebar Styling */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: hsl(var(--bg-sidebar));
    border-right: 1px solid hsl(var(--border-color));
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    z-index: 100;
    position: fixed;
    height: 100vh;
    transition: width var(--transition-slow) cubic-bezier(0.16, 1, 0.3, 1), background-color var(--transition-normal);
}

.sidebar-logo-wrapper {
    margin-bottom: 40px;
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 0 16px;
}

.sidebar-logo {
    width: 40px;
    height: auto;
    transition: transform var(--transition-normal);
}

.app-sidebar:hover {
    width: var(--sidebar-width-expanded);
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    padding: 0 16px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-md);
    color: hsl(var(--text-secondary));
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    transition: all var(--transition-fast);
}

.sidebar-item:hover, .sidebar-item.active {
    background-color: hsl(var(--color-primary) / 0.08);
    color: hsl(var(--color-primary));
}

.sidebar-item-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.sidebar-item-text {
    margin-left: 16px;
    font-weight: 600;
    font-size: 14px;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.app-sidebar:hover .sidebar-item-text {
    opacity: 1;
    transform: translateX(0);
}

.sidebar-footer {
    margin-top: auto;
    width: 100%;
    padding: 0 16px;
}

/* Main Content Area */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
    min-width: 0; /* Prevents flex items from overflowing */
    transition: margin-left var(--transition-slow) cubic-bezier(0.16, 1, 0.3, 1);
}

/* Top bar Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.header-title-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo-h {
    height: 48px;
    width: auto;
}
[data-theme="dark"] .header-logo-h {
    filter: invert(0.9) hue-rotate(180deg);
}

.header-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: hsl(var(--text-primary));
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.select-dropdown {
    background-color: hsl(var(--bg-card));
    border: 1px solid hsl(var(--border-color));
    border-radius: var(--radius-md);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.select-dropdown:hover {
    border-color: hsl(var(--text-muted));
}

.date-picker-container {
    display: flex;
    align-items: center;
    background-color: hsl(var(--bg-card));
    border: 1px solid hsl(var(--border-color));
    border-radius: var(--radius-md);
    padding: 6px 12px;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
}

.date-picker-container input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 12px;
    font-weight: 600;
    width: 90px;
    text-align: center;
}

.btn-pill {
    background-color: hsl(var(--bg-card));
    border: 1px solid hsl(var(--border-color));
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-pill:hover, .btn-pill.active {
    background-color: hsl(var(--color-primary) / 0.08);
    border-color: hsl(var(--color-primary));
    color: hsl(var(--color-primary));
}

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

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background-color: hsl(var(--bg-card));
    border: 1px solid hsl(var(--border-color));
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    background-color: hsl(var(--bg-main));
    transform: translateY(-1px);
}

.icon-btn svg {
    width: 20px;
    height: 20px;
    color: hsl(var(--text-secondary));
}

.icon-btn .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-round);
    background-color: hsl(var(--color-danger));
    color: hsl(var(--text-white));
    font-size: 10px;
    font-weight: 800;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid hsl(var(--bg-header));
}

.user-profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, hsl(var(--color-primary)) 0%, hsl(var(--color-purple)) 100%);
    color: hsl(var(--text-white));
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast);
}

.user-profile-avatar:hover {
    transform: scale(1.05);
}

/* ==========================================================================
   Metrics Row (11 Cards)
   ========================================================================== */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.metric-card {
    background-color: hsl(var(--bg-card));
    border: 1px solid hsl(var(--border-color));
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: hsl(var(--border-focus) / 0.5);
}

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

.metric-card-title {
    font-size: 12px;
    font-weight: 700;
    color: hsl(var(--text-secondary));
    text-transform: capitalize;
    letter-spacing: 0.2px;
}

.metric-icon-wrapper {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: center;
    align-items: center;
}

.metric-icon-wrapper svg {
    width: 16px;
    height: 16px;
}

/* Accent Classes for Icons */
.metric-blue {
    background-color: hsl(var(--color-primary) / 0.1);
    color: hsl(var(--color-primary));
}
.metric-green {
    background-color: hsl(var(--color-success) / 0.1);
    color: hsl(var(--color-success));
}
.metric-orange {
    background-color: hsl(var(--color-warning) / 0.1);
    color: hsl(var(--color-warning));
}
.metric-purple {
    background-color: hsl(var(--color-purple) / 0.1);
    color: hsl(var(--color-purple));
}
.metric-teal {
    background-color: hsl(var(--color-teal) / 0.1);
    color: hsl(var(--color-teal));
}

.metric-card-value {
    font-size: 22px;
    font-weight: 800;
    color: hsl(var(--text-primary));
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.metric-card-meta {
    font-size: 10px;
    color: hsl(var(--text-muted));
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* CSAT Stars badge */
.stars-display {
    display: inline-flex;
    color: hsl(var(--color-warning));
    gap: 1px;
}
.stars-display svg {
    width: 10px;
    height: 10px;
    fill: currentColor;
}

/* ==========================================================================
   Dashboard Central Panels (Charts & Breakdowns)
   ========================================================================== */

.panel-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 1200px) {
    .panel-row {
        grid-template-columns: 1fr;
    }
}

.dashboard-panel {
    background-color: hsl(var(--bg-card));
    border: 1px solid hsl(var(--border-color));
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

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

.panel-title-group {
    display: flex;
    flex-direction: column;
}

.panel-title {
    font-size: 15px;
    font-weight: 700;
    color: hsl(var(--text-primary));
}

.panel-subtitle {
    font-size: 12px;
    color: hsl(var(--text-secondary));
    margin-top: 2px;
}

.panel-tabs {
    display: flex;
    background-color: hsl(var(--bg-main));
    padding: 4px;
    border-radius: var(--radius-sm);
}

.panel-tab {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: transparent;
}

.panel-tab.active {
    background-color: hsl(var(--bg-card));
    color: hsl(var(--color-primary));
    box-shadow: var(--shadow-sm);
}

.chart-container {
    position: relative;
    flex: 1;
    min-height: 260px;
}

/* Breakdown Lists */
.breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    justify-content: center;
    height: 100%;
}

.breakdown-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.breakdown-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
}

.breakdown-name {
    display: flex;
    align-items: center;
    gap: 8px;
    color: hsl(var(--text-secondary));
}

.breakdown-bullet {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-round);
}

.breakdown-values {
    font-weight: 700;
    color: hsl(var(--text-primary));
}

.breakdown-pct {
    color: hsl(var(--text-muted));
    font-size: 11px;
    margin-left: 4px;
}

.progress-track {
    width: 100%;
    height: 8px;
    background-color: hsl(var(--bg-main));
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-sm);
    transition: width var(--transition-slow) cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Bottom Panel Grid (CSAT breakdown, sentiment, quality, operations)
   ========================================================================== */

.bottom-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

@media (max-width: 1024px) {
    .bottom-grid {
        grid-template-columns: 1fr 1fr;
    }
}
@media (max-width: 768px) {
    .bottom-grid {
        grid-template-columns: 1fr;
    }
}

/* Bottom Grid Widgets Custom Styles */
.csat-rating-large {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.csat-number {
    font-size: 32px;
    font-weight: 800;
    color: hsl(var(--text-primary));
}

.csat-stars-rating {
    color: hsl(var(--color-warning));
    display: flex;
    gap: 4px;
}
.csat-stars-rating svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.csat-session-text {
    font-size: 11px;
    color: hsl(var(--text-muted));
    margin-bottom: 20px;
    font-weight: 500;
}

.csat-bar-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.csat-bar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    font-weight: 600;
}

.csat-star-label {
    width: 40px;
    color: hsl(var(--text-secondary));
    display: flex;
    align-items: center;
    gap: 4px;
}
.csat-star-label svg {
    width: 12px;
    height: 12px;
    fill: hsl(var(--color-warning));
}

.csat-progress-container {
    flex: 1;
    height: 8px;
    background-color: hsl(var(--bg-main));
    border-radius: var(--radius-sm);
    position: relative;
}

.csat-progress-fill {
    height: 100%;
    background-color: hsl(var(--color-primary));
    border-radius: var(--radius-sm);
}

.csat-pct-value {
    width: 60px;
    text-align: right;
    color: hsl(var(--text-primary));
}

.csat-count-value {
    font-size: 10px;
    color: hsl(var(--text-muted));
    margin-right: 4px;
}

/* Sentiment Widget Styles */
.sentiment-segmented-bar {
    width: 100%;
    height: 14px;
    background-color: hsl(var(--bg-main));
    border-radius: var(--radius-sm);
    display: flex;
    overflow: hidden;
    margin-bottom: 24px;
}

.sentiment-segment {
    height: 100%;
    transition: width var(--transition-slow) cubic-bezier(0.16, 1, 0.3, 1);
}

.sentiment-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sentiment-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sentiment-type-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
}

.sentiment-circle-icon {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-round);
    display: flex;
    justify-content: center;
    align-items: center;
}
.sentiment-circle-icon svg {
    width: 14px;
    height: 14px;
}

.sentiment-stat-values {
    text-align: right;
}

.sentiment-stat-count {
    font-size: 12px;
    font-weight: 700;
    color: hsl(var(--text-primary));
}

.sentiment-stat-pct {
    font-size: 10px;
    color: hsl(var(--text-muted));
    font-weight: 500;
}

/* Quality Metrics Widget */
.quality-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.quality-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
}

.quality-title-text {
    color: hsl(var(--text-secondary));
}

.quality-score-stars {
    display: flex;
    align-items: center;
    gap: 6px;
}

.quality-score-value {
    font-weight: 700;
    color: hsl(var(--text-primary));
}

.quality-star-row {
    display: flex;
    color: hsl(var(--color-warning));
    gap: 1px;
}
.quality-star-row svg {
    width: 10px;
    height: 10px;
    fill: currentColor;
}

.quality-bar-track {
    height: 4px;
    background-color: hsl(var(--bg-main));
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.quality-bar-fill {
    height: 100%;
    background-color: hsl(var(--color-warning));
    border-radius: var(--radius-sm);
}

/* Operational Metrics Widget */
.ops-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.ops-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.ops-title {
    color: hsl(var(--text-secondary));
}

.ops-value {
    font-weight: 700;
    color: hsl(var(--text-primary));
}

.ops-progress-bar {
    height: 6px;
    background-color: hsl(var(--bg-main));
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.ops-progress-fill {
    height: 100%;
    background-color: hsl(var(--color-primary));
    border-radius: var(--radius-sm);
}

.ops-row-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

.ops-meta-box {
    background-color: hsl(var(--bg-main) / 0.5);
    border: 1px solid hsl(var(--border-color));
    border-radius: var(--radius-md);
    padding: 10px;
    text-align: center;
}

.ops-meta-title {
    font-size: 10px;
    font-weight: 700;
    color: hsl(var(--text-muted));
    margin-bottom: 4px;
    text-transform: uppercase;
}

.ops-meta-value {
    font-size: 14px;
    font-weight: 800;
    color: hsl(var(--text-primary));
}

/* ==========================================================================
   Interactive Controls & Animations
   ========================================================================== */

/* Keyframe Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Engine Toggle (Mock vs Live) */
.engine-toggle-panel {
    display: flex;
    align-items: center;
    background-color: hsl(var(--bg-card));
    border: 1px solid hsl(var(--border-color));
    border-radius: var(--radius-md);
    padding: 6px 12px;
    gap: 12px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.engine-toggle-label {
    color: hsl(var(--text-secondary));
}

.switch-control {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch-control input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: hsl(var(--text-muted) / 0.4);
    transition: .3s;
    border-radius: 34px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: var(--radius-round);
}

.switch-control input:checked + .switch-slider {
    background-color: hsl(var(--color-primary));
}

.switch-control input:checked + .switch-slider:before {
    transform: translateX(20px);
}

/* Arabic RTL support layout rules */
body[dir="rtl"] .app-sidebar {
    border-right: none;
    border-left: 1px solid hsl(var(--border-color));
    left: auto;
    right: 0;
}
body[dir="rtl"] .app-main {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}
body[dir="rtl"] .app-sidebar:hover + .app-main {
    margin-left: 0;
    margin-right: var(--sidebar-width-expanded);
}
body[dir="rtl"] .sidebar-item-text {
    margin-left: 0;
    margin-right: 16px;
    transform: translateX(10px);
}
body[dir="rtl"] .app-sidebar:hover .sidebar-item-text {
    transform: translateX(0);
}
body[dir="rtl"] .input-icon {
    left: auto;
    right: 16px;
}
body[dir="rtl"] .input-field {
    padding: 14px 44px 14px 16px;
}
body[dir="rtl"] .csat-pct-value {
    text-align: left;
}
body[dir="rtl"] .sentiment-stat-values {
    text-align: left;
}
