/* ============================================
   E-Call Dashboard - Main CSS File
   Consolidated styles from all views
   ============================================ */

/* ============================================
   Dashboard Layout Styles
   (Used in: superAdminDashboard, companyAdminDashboard)
   ============================================ */

.dashboard-container {
    min-height: 100vh;
    display: flex;
}

/* ============================================
   Sidebar Styles
   ============================================ */

.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 50;
    transition: all 0.3s ease;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar-header {
    padding: 1rem 4.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 93px;
}

.sidebar-header button {
    display: none;
}

.sidebar-menu {
    padding: 1rem 0;
}

.menu-item {
    padding: 0.875rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.menu-item:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.menu-item.active {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: white;
    font-weight: 600;
}

.menu-item i {
    font-size: 1.25rem;
    width: 1.5rem;
    text-align: center;
}

/* ============================================
   Mobile Menu Toggle
   ============================================ */

.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 60;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* ============================================
   Main Content Area
   ============================================ */

.main-content {
    margin-left: 280px;
    flex: 1;
    position: relative;
    z-index: 10;
    transition: margin-left 0.3s ease;
}

.main-content.expanded {
    margin-left: 80px;
}

/* ============================================
   Top Navigation Bar
   ============================================ */

.top-navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
    min-height: 73px;
}

/* ============================================
   Search Box
   ============================================ */

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.hide-search .search-box {
    display: none;
}

/* ============================================
   User Menu & Avatar
   ============================================ */

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.user-menu:hover {
    background: var(--bg-primary);
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

/* ============================================
   Cards & Containers
   ============================================ */

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.channel-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.channel-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: var(--gradient-start);
}

.welcome-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 3rem;
    max-width: 600px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Data Tables
   ============================================ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    overflow: hidden;
}

.data-table thead {
    background: var(--bg-primary);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.data-table tr:hover {
    background: var(--bg-primary);
}

/* ============================================
   Badges
   ============================================ */

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    transform: translateY(-2px);
}

/* ============================================
   Progress Bars
   ============================================ */

.progress-bar {
    width: 100%;
    height: 0.5rem;
    background: var(--bg-primary);
    border-radius: 9999px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    transition: width 0.3s ease;
}

/* ============================================
   Form Elements & Inputs
   (Used in: userLogin, userResetPassword)
   ============================================ */

.input-group {
    position: relative;
}

.input-group input {
    transition: all 0.3s ease;
}

.input-group input:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.checkbox-custom {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.checkbox-custom:checked {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    border-color: var(--gradient-start);
}

.checkbox-custom:checked::after {
    content: '✓';
    display: block;
    color: white;
    text-align: center;
    line-height: 16px;
    font-size: 14px;
}

.code-input {
    width: 50px;
    height: 60px;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.code-input:focus {
    border-color: var(--gradient-start);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

/* ============================================
   Password Strength Indicator
   ============================================ */

.password-strength {
    height: 4px;
    border-radius: 2px;
    margin-top: 8px;
    transition: all 0.3s ease;
}

.password-requirements {
    font-size: 12px;
    margin-top: 8px;
}

.requirement {
    display: flex;
    align-items: center;
    margin: 4px 0;
}

.requirement.valid {
    color: #10b981;
}

.requirement.invalid {
    color: var(--text-secondary);
}

/* ============================================
   Icons & Special Elements
   ============================================ */

.icon-circle {
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2.5rem;
    color: white;
}

/* ============================================
   Utility Classes
   ============================================ */

.operator-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    z-index: 10;
}

.info-text {
    color: var(--text-secondary);
    margin: 1.5rem 0;
    line-height: 1.6;
}

.content-section {
    /* Sections are shown/hidden dynamically */
    padding: 2rem;
}

/* ============================================
   Alerts & Messages
   ============================================ */

.alert {
    animation: slideIn 0.3s ease;
}

/* ============================================
   Animations
   ============================================ */

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

.loading-spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid var(--gradient-start);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

/* ============================================
   Responsive Design - Mobile Styles
   ============================================ */

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .top-navbar {
        padding-left: 4.5rem;
    }
}

/* ============================================
   RTL Support Overrides
   Applied when the <html> element has dir="rtl"
   ============================================ */

[dir="rtl"] .sidebar {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

[dir="rtl"] .sidebar-header {
    padding: 1rem 4.5rem; 
}

[dir="rtl"] .menu-item i {
    text-align: center;
}

/* Main content margin should be on the right in RTL */
[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: 280px;
}

[dir="rtl"] .main-content.expanded {
    margin-right: 80px;
}

/* Top navbar mobile hamburger should reserve space on the right in RTL */
[dir="rtl"] .top-navbar {
    padding-left: 2rem;
    padding-right: 2rem;
}

/* Search icon appears on the right inside the input in RTL */
[dir="rtl"] .search-box i {
    left: auto;
    right: 1rem;
}

/* Adjust input padding for RTL to avoid overlap with right-side icon */
[dir="rtl"] .search-box input {
    padding-left: 1rem;
    padding-right: 3rem;
}

/* User info alignment to the right for RTL while keeping flex column */
[dir="rtl"] .user-info {
    align-items: flex-end;
    text-align: right;
}

/* Place theme and language toggles on left in RTL and reverse their visual order */
[dir="rtl"] .theme-toggle {
    left: 20px;
    right: auto;
    flex-direction: row-reverse;
}

/* Ensure mobile hamburger appears on right side in RTL */
[dir="rtl"] .mobile-menu-toggle {
    left: auto;
    right: 1rem;
}

/* Mobile adjustments in RTL */
@media (max-width: 768px) {
    [dir="rtl"] .sidebar {
        transform: translateX(100%);
    }

    [dir="rtl"] .sidebar.show {
        transform: translateX(0);
    }

    [dir="rtl"] .main-content {
        margin-right: 0;
    }

    /* Reserve space for mobile hamburger on the right in RTL */
    [dir="rtl"] .top-navbar {
        padding-right: 4.5rem;
        padding-left: 2rem;
    }
}
