/* ===================================
   MODERN RESPONSIVE THEME CSS
   The Hive Dashboard Theme
   ================================= */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: all 0.3s ease;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===================================
   HEADER STYLES
   ================================= */

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
    padding: 0 1.5rem;
    max-width: 100%;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.sidebar-toggle:hover {
    background-color: var(--bg-tertiary);
    color: var(--primary-color);
}

.header-title {
    display: flex;
    flex-direction: column;
    margin-left: 1rem;
}

.header-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.2;
}

.title-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}


/* Action Buttons */
.action-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.action-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--primary-color);
}

.notification-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 18px;
    height: 18px;
    background-color: #ef4444;
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-primary);
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border: none;
    background: transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 0;
}

.user-btn:hover {
    background-color: var(--bg-tertiary);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-arrow {
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.user-btn.active .user-arrow {
    transform: rotate(180deg);
}

/* User Dropdown */
.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 280px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar-large {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.user-details h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.user-details p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.dropdown-body {
    padding: 0.5rem;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background-color: var(--bg-tertiary);
    color: var(--primary-color);
}

.dropdown-item i {
    width: 16px;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.dropdown-item:hover i {
    color: var(--primary-color);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.5rem 0;
}

/* Theme Toggle */
.theme-toggle,
.rtl-toggle {
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.theme-toggle .toggle-switch,
.rtl-toggle .toggle-switch {
    flex-shrink: 0;
}

.theme-toggle span,
.rtl-toggle span {
    flex: 1;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-input {
    display: none;
}

.toggle-label {
    position: absolute;
    top: 0;
    left: 0;
    width: 44px;
    height: 24px;
    background-color: var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-label::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-input:checked + .toggle-label {
    background-color: var(--primary-color);
}

.toggle-input:checked + .toggle-label::after {
    transform: translateX(20px);
}

.logout-item {
    color: #ef4444 !important;
}

.logout-item:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444 !important;
}

/* ===================================
   SIDEBAR STYLES
   ================================= */

.main-wrapper {
    /* display: flex; */
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
}

.app-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    transition: all 0.3s ease;
    z-index: 999;
    overflow: hidden;
}

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

.app-sidebar.mobile-hidden {
    transform: translateX(-100%);
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    min-height: 60px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.1rem;
}

.sidebar-logo i {
    font-size: 1.5rem;
}

.sidebar-title {
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.app-sidebar.collapsed .sidebar-title {
    opacity: 0;
    width: 0;
}

.sidebar-close {
    display: none;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-close:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0;
}

.nav-list {
    list-style: none;
    padding: 0 1rem;
    min-width: 0;
}

.nav-item {
    margin-bottom: 0.25rem;
    min-width: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 0.625rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
    position: relative;
    min-width: 0;
}

.nav-link:hover {
    background-color: var(--bg-tertiary);
    color: var(--primary-color);
}

.nav-link.active {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
    padding-left: calc(0.625rem - 3px);
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    color: var(--primary-color);
}

.nav-text {
    white-space: normal;
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: break-word;
    transition: opacity 0.3s ease;
    flex: 1;
    min-width: 0;
}

.nav-text--wrap {
    white-space: normal;
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

.app-sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
}

/* Collapsed rail: icons centered, active = symmetric rounded highlight
   (drop the expanded one-sided border + offset padding). */
.app-sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.625rem;
    gap: 0;
}

.app-sidebar.collapsed .nav-link.active,
[dir="rtl"] .app-sidebar.collapsed .nav-link.active {
    border: none;
    margin: 0;
    padding: 0.625rem;
    border-radius: 10px;
}

/* Submenu */
.submenu-arrow {
    font-size: 0.8rem;
    transition: transform 0.3s ease, opacity 0.3s ease;
    flex-shrink: 0;
}

.app-sidebar.collapsed .submenu-arrow {
    opacity: 0;
    width: 0;
}

.nav-item.has-submenu.open .submenu-arrow {
    transform: rotate(90deg);
}

.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-item.has-submenu.open .submenu {
    max-height: 560px;
}

.submenu-item {
    margin: 0;
    min-width: 0;
}

.submenu-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem 0.5rem 3rem;
    min-width: 0;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    margin: 0.125rem 0;
}

.submenu-link:hover {
    background-color: var(--bg-tertiary);
    color: var(--primary-color);
}

.submenu-link.active {
    background-color: rgba(59, 130, 246, 0.15);
    color: var(--primary-color);
    font-weight: 600;
    border-left: 2px solid var(--primary-color);
    margin-left: 0.5rem;
    padding-left: calc(2.5rem - 2px);
}

.submenu-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.submenu-link:hover .submenu-icon,
.submenu-link.active .submenu-icon {
    color: var(--primary-color);
}

.submenu-text {
    white-space: normal;
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: break-word;
    flex: 1;
    min-width: 0;
    transition: opacity 0.3s ease;
}

/* Collapsed sidebar: submenu becomes a hover flyout.
   position:fixed (coords set in theme.js) lets it escape the sidebar's
   overflow:hidden / scroll containers instead of being clipped. */
.app-sidebar.collapsed .submenu {
    display: block;
    position: fixed;
    top: 0;
    left: auto;
    right: auto;
    min-width: 210px;
    max-width: 280px;
    max-height: none;
    overflow: visible;
    padding: 0.5rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 1100;
}

.app-sidebar.collapsed .submenu.flyout-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Restore the link text inside the flyout (it is hidden in the collapsed rail). */
.app-sidebar.collapsed .submenu .submenu-link {
    padding: 0.5rem 0.75rem;
}

.app-sidebar.collapsed .submenu .submenu-link.active {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0.75rem;
    padding-right: calc(0.75rem - 2px);
}

.app-sidebar.collapsed .submenu .submenu-text,
[dir="rtl"] .app-sidebar.collapsed .submenu .submenu-text {
    opacity: 1;
    width: auto;
}

/* Parent label header inside a collapsed flyout (hidden when expanded). */
.submenu-flyout-title {
    display: none;
}

.app-sidebar.collapsed .submenu .submenu-flyout-title {
    display: block;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
    padding: 0.25rem 0.75rem 0.5rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color);
    white-space: normal;
    line-height: 1.35;
}

/* Hover label tooltip for plain icons in the collapsed rail. */
.nav-tooltip {
    position: fixed;
    z-index: 1200;
    transform: translateY(-50%);
    background-color: var(--text-primary);
    color: var(--bg-secondary);
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.12s ease;
}

.nav-tooltip.show {
    opacity: 1;
    visibility: visible;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-tertiary);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.user-info-small {
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: opacity 0.3s ease;
}

.app-sidebar.collapsed .user-info-small {
    opacity: 0;
    width: 0;
}

.user-name-small {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    /* Allow long names to wrap onto up to 2 lines, then ellipsis. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
    word-break: break-word;
}

.user-status {
    font-size: 0.75rem;
    color: var(--accent-color);
    white-space: nowrap;
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 998;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ===================================
   CONTENT AREA STYLES
   ================================= */

.content-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
}

.sidebar-collapsed .content-area {
    margin-left: var(--sidebar-collapsed-width);
}

.sidebar-collapsed .app-footer {
    margin-left: var(--sidebar-collapsed-width);
}

.content-container {
    padding: 2rem;
    max-width: 100%;
}

.page-content {
    background-color: var(--bg-primary);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}

.page-content h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.page-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}


.table-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    border: 1px solid var(--border-color) !important;
    background: var(--bg-secondary) !important;
    border-radius: 6px !important;
    color: var(--text-secondary) !important;
    text-decoration: none !important;
    font-size: 0.8rem !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
}

.table-btn:hover {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
    transform: translateY(-1px) !important;
    box-shadow: var(--shadow-sm) !important;
}

.table-btn.btn-edit:hover {
    background: #10b981 !important;
    border-color: #10b981 !important;
}

.table-btn.btn-delete:hover {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
}

.table-btn.btn-view:hover {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

/* Status Badges */
.status-badge {
    display: inline-flex !important;
    align-items: center !important;
    padding: 0.25rem 0.75rem !important;
    border-radius: 12px !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    line-height: 1 !important;
}

.status-badge.status-active {
    background: rgba(16, 185, 129, 0.1) !important;
    color: #059669 !important;
    border: 1px solid rgba(16, 185, 129, 0.2) !important;
}

.status-badge.status-inactive {
    background: rgba(107, 114, 128, 0.1) !important;
    color: #4b5563 !important;
    border: 1px solid rgba(107, 114, 128, 0.2) !important;
}

.status-badge.status-pending {
    background: rgba(245, 158, 11, 0.1) !important;
    color: #d97706 !important;
    border: 1px solid rgba(245, 158, 11, 0.2) !important;
}

.status-badge.status-rejected {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #dc2626 !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
}

.content-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.content-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.content-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.content-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
}

/* ===================================
   FOOTER STYLES
   ================================= */

.app-footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -1px 0 0 rgba(0, 0, 0, 0.04);
    padding: 1.125rem 2rem;
    margin-top: auto;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
}

[data-theme="dark"] .app-footer {
    box-shadow: 0 -1px 0 0 rgba(255, 255, 255, 0.04);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 100%;
    gap: 1rem;
}

.footer-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.footer-meta-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2;
    height: 2;
    flex-shrink: 0;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.12);
    color: var(--primary-color);
    font-size: 0.95rem;
}

@supports (background: color-mix(in srgb, white 50%, black)) {
    .footer-meta-icon {
        background: color-mix(in srgb, var(--primary-color) 14%, transparent);
    }

    [data-theme="dark"] .footer-meta-icon {
        background: color-mix(in srgb, var(--primary-color) 22%, transparent);
    }
}

.footer-meta-body {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    min-width: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.footer-page-title {
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: 0.01em;
}

.footer-meta-divider {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.65;
    flex-shrink: 0;
}

.footer-datetime {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
}

.footer-datetime i {
    font-size: 0.75rem;
    opacity: 0.85;
}

.footer-left p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.footer-left strong {
    color: var(--primary-color);
    font-weight: 600;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--primary-color);
}

.footer-separator {
    color: var(--border-color);
    font-size: 0.85rem;
}

.footer-version span {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
}

/* ===================================
   RESPONSIVE DESIGN
   ================================= */

/* Tablet Styles */
@media (max-width: 1024px) {
    
    .header-actions {
        gap: 0.5rem;
    }
    
    .user-info {
        display: none;
    }
    
    .user-arrow {
        display: none;
    }
    
    .content-container {
        padding: 1.5rem;
    }
    
    .footer-links {
        display: none;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 280px;
        --header-height: 60px;
    }
    
    .header-content {
        padding: 0 1rem;
    }
    
    .header-title h1 {
        font-size: 1.25rem;
    }
    
    .title-subtitle {
        display: none;
    }
    
    .app-sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .app-sidebar.mobile-show {
        transform: translateX(0);
    }
    
    .sidebar-close {
        display: flex;
    }
    
    .content-area {
        margin-left: 0;
    }
    
    .app-footer {
        margin-left: 0;
    }
    
    .content-container {
        padding: 1rem;
    }
    
    .page-content {
        padding: 1.5rem;
    }
    
    .page-content h1 {
        font-size: 1.75rem;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
    
    .footer-meta {
        justify-content: center;
    }
    
    .footer-meta-body {
        justify-content: center;
    }
    
    .footer-right {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .user-dropdown {
        width: 260px;
        right: -1rem;
    }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
    .header-content {
        padding: 0 0.75rem;
    }
    
    .content-container {
        padding: 0.75rem;
    }
    
    .page-content {
        padding: 1rem;
        border-radius: 8px;
    }
    
    .page-content h1 {
        font-size: 1.5rem;
    }
    
    .content-card {
        padding: 1rem;
    }
    
    .app-footer {
        padding: 0.75rem 1rem;
    }
}

/* ===================================
   ANIMATIONS AND TRANSITIONS
   ================================= */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.page-content {
    animation: fadeIn 0.5s ease;
}

.nav-item {
    animation: slideInLeft 0.3s ease;
}

.nav-item:nth-child(2) { animation-delay: 0.1s; }
.nav-item:nth-child(3) { animation-delay: 0.2s; }
.nav-item:nth-child(4) { animation-delay: 0.3s; }
.nav-item:nth-child(5) { animation-delay: 0.4s; }

/* ===================================
   UTILITY CLASSES
   ================================= */

.fade-in {
    animation: fadeIn 0.3s ease;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===================================
   DARK THEME SPECIFIC ADJUSTMENTS
   ================================= */

[data-theme="dark"] .toggle-label::after {
    background-color: var(--bg-primary);
}

[data-theme="dark"] .app-header {
    backdrop-filter: blur(10px);
    background-color: rgba(15, 23, 42, 0.95);
}

[data-theme="dark"] .content-card:hover {
    border-color: var(--primary-color);
}

/* ===================================
   SCROLLBAR STYLES
   ================================= */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-secondary);
}

/* ===================================
   RTL (RIGHT-TO-LEFT) SUPPORT
   ================================= */

[dir="rtl"] {
    text-align: right;
}

/* RTL Header - Individual Element Positioning Using CSS Order */

[dir="rtl"] .sidebar-toggle {
    /* Move to the right side */
    order: 3;
}

[dir="rtl"] .header-title {
    /* Keep in center but adjust margins and alignment */
    order: 2;
    margin-left: 1rem;
    margin-right: 1rem;
    text-align: right;
}

[dir="rtl"] .header-content {
    flex-direction: row-reverse;
}

[dir="rtl"] .header-actions {
    /* Move to the left side */
    margin-left: 0;
    margin-right: auto;
}


[dir="rtl"] .notification-badge {
    right: 8px;
    left: auto;
}

[dir="rtl"] .user-dropdown {
    left: 0;
    right: auto;
}

[dir="rtl"] .user-btn {
    flex-direction: row-reverse;
}

[dir="rtl"] .user-info {
    text-align: right;
}

[dir="rtl"] .user-arrow {
    margin-left: 0;
    margin-right: 0.5rem;
}

/* RTL Sidebar */
[dir="rtl"] .app-sidebar {
    left: auto;
    right: 0;
    border-left: 1px solid var(--border-color);
    border-right: none;
}

[dir="rtl"] .app-sidebar.mobile-hidden {
    transform: translateX(100%);
}

[dir="rtl"] .app-sidebar.mobile-show {
    transform: translateX(0);
}

[dir="rtl"] .sidebar-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .sidebar-logo {
    flex-direction: row-reverse;
}

/* RTL Navigation Links */
[dir="rtl"] .nav-link {
    flex-direction: row;
    text-align: right;
    padding: 0.875rem 0.625rem;
}

[dir="rtl"] .nav-link.active {
    border-left: none;
    border-right: 3px solid var(--primary-color);
    margin-left: 0;
    padding-left: 0.625rem;
    padding-right: calc(0.625rem - 3px);
}

[dir="rtl"] .nav-icon {
    margin-left: 0.5rem;
    margin-right: 0;
    order: 0;
}

[dir="rtl"] .nav-text {
    text-align: right;
    order: 1;
}

[dir="rtl"] .nav-text--wrap {
    text-align: right;
}

[dir="rtl"] .submenu-arrow {
    transform: rotate(180deg);
    margin-left: 0.75rem;
    margin-right: 0;
    order: 2;
}

[dir="rtl"] .nav-item.has-submenu.open .submenu-arrow {
    transform: rotate(270deg);
}

/* RTL Submenu Styling */
[dir="rtl"] .submenu-link {
    padding: 0.5rem 3rem 0.5rem 1rem;
    flex-direction: row;
}

[dir="rtl"] .submenu-link.active {
    border-left: none;
    border-right: 2px solid var(--primary-color);
    margin-left: 0;
    margin-right: 0.5rem;
    padding-left: 1rem;
    padding-right: calc(2.5rem - 2px);
}

/* RTL Collapsed Sidebar Styles */
[dir="rtl"] .app-sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
}

[dir="rtl"] .app-sidebar.collapsed .submenu-arrow {
    opacity: 0;
    width: 0;
}

[dir="rtl"] .app-sidebar.collapsed .submenu-text {
    opacity: 0;
    width: 0;
}

/* RTL Tooltip positioning for collapsed sidebar */
[dir="rtl"] .app-sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.625rem;
    gap: 0;
}

[dir="rtl"] .app-sidebar.collapsed .nav-icon {
    margin: 0;
    order: unset;
}

/* RTL Sidebar Footer */
[dir="rtl"] .sidebar-footer {
    text-align: right;
}

[dir="rtl"] .sidebar-user {
    flex-direction: row; /* Keep normal direction */
    justify-content: flex-start; /* Push content to the right */
}

[dir="rtl"] .user-info-small {
    text-align: right;
    align-items: flex-start;
    order: 2; /* User info comes first (appears on right) */
    margin-left: 0.75rem; /* Space between info and avatar */
    margin-right: 0;
}

[dir="rtl"] .user-avatar-small {
    order: 1; /* Avatar comes second (appears on left) */
}

[dir="rtl"] .user-name-small,
[dir="rtl"] .user-status {
    text-align: left;
}

/* RTL Content Area */
[dir="rtl"] .content-area {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

[dir="rtl"] .sidebar-collapsed .content-area {
    margin-left: 0;
    margin-right: var(--sidebar-collapsed-width);
}

/* RTL Footer */
[dir="rtl"] .app-footer {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

[dir="rtl"] .sidebar-collapsed .app-footer {
    margin-left: 0;
    margin-right: var(--sidebar-collapsed-width);
}

[dir="rtl"] .footer-content {
    flex-direction: row-reverse;
}

[dir="rtl"] .footer-links {
    flex-direction: row-reverse;
}

/* RTL Mobile Responsive */
@media (max-width: 768px) {
    [dir="rtl"] .app-sidebar {
        transform: translateX(100%);
    }
    
    [dir="rtl"] .app-sidebar.mobile-show {
        transform: translateX(0);
    }
    
    [dir="rtl"] .content-area {
        margin-right: 0;
    }
    
    [dir="rtl"] .app-footer {
        margin-right: 0;
    }
    
    [dir="rtl"] .user-dropdown {
        left: -1rem;
        right: auto;
    }
}

/* RTL Animations */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

[dir="rtl"] .nav-item {
    animation: slideInRight 0.3s ease;
}

/* RTL Toggle Switches - Proper Layout */
[dir="rtl"] .theme-toggle,
[dir="rtl"] .rtl-toggle {
    flex-direction: row-reverse;
    text-align: right;
}

[dir="rtl"] .theme-toggle span,
[dir="rtl"] .rtl-toggle span {
    text-align: right;
}

[dir="rtl"] .theme-icon,
[dir="rtl"] .rtl-icon {
    text-align: right;
}

/* RTL Toggle Switch - Fix positioning and animation */
[dir="rtl"] .toggle-label {
    direction: ltr; /* Keep toggle switch LTR for proper positioning */
}

[dir="rtl"] .toggle-label::after {
    /* In RTL, start from the right side when unchecked */
    left: auto;
    right: 2px;
}

[dir="rtl"] .toggle-input:checked + .toggle-label::after {
    /* When checked in RTL, move to the left side */
    transform: translateX(-20px);
    right: 2px;
}

/* RTL Dropdown positioning */
[dir="rtl"] .dropdown-header {
    text-align: right;
}

/* RTL Dropdown - Only non-toggle items get reversed */
[dir="rtl"] .dropdown-item:not(.theme-toggle):not(.rtl-toggle) {
    flex-direction: row-reverse;
    text-align: right;
}

[dir="rtl"] .dropdown-item:not(.theme-toggle):not(.rtl-toggle) i {
    margin-left: 0.75rem;
    margin-right: 0;
}

[dir="rtl"] .dropdown-item span {
    text-align: right;
}

/* RTL Content Cards */
[dir="rtl"] .content-card h3,
[dir="rtl"] .page-content h1,
[dir="rtl"] .page-content h2,
[dir="rtl"] .page-content p {
    text-align: right;
}

/* ===================================
   LOGIN PAGE STYLES
   ================================= */

/* Login Page Body */
.login-page {
    min-height: 100vh;
    overflow: hidden;
}

.login-container {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Background Elements */
.login-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    z-index: -1;
    overflow: hidden;
}

.background-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    opacity: 0.1;
    animation: float 20s ease-in-out infinite;
}

.shape-1 {
    width: 300px;
    height: 300px;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.shape-2 {
    width: 200px;
    height: 200px;
    top: 60%;
    right: 15%;
    animation-delay: -7s;
}

.shape-3 {
    width: 150px;
    height: 150px;
    bottom: 20%;
    left: 60%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    33% {
        transform: translateY(-30px) rotate(120deg);
    }
    66% {
        transform: translateY(20px) rotate(240deg);
    }
}

/* Login Controls */
.login-controls {
    position: fixed;
    top: 2rem;
    right: 2rem;
    display: flex;
    gap: 1rem;
    z-index: 1000;
}

.control-btn {
    width: 50px;
    height: 50px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
}

.control-btn:hover {
    background: var(--bg-tertiary);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.control-btn i {
    font-size: 1.1rem;
}

/* Login Card */
.login-card {
    width: 100%;
    max-width: 450px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 3rem 2.5rem;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    animation: slideUp 0.6s ease;
    position: relative;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Login Header */
.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.login-logo i {
    font-size: 2.5rem;
    color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0;
}

/* Form Styles */
.login-form-container {
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

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

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    z-index: 2;
    transition: color 0.3s ease;
}

.form-input {
    width: 100%;
    height: 50px;
    padding: 0 1rem 0 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: var(--bg-primary);
}

.form-input:focus + .input-icon,
.form-group:focus-within .input-icon {
    color: var(--primary-color);
}

.password-toggle {
    position: absolute;
    right: 1rem;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.password-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--primary-color);
}

/* Field Error Styles */
.field-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: #dc2626;
    font-size: 0.85rem;
    animation: fadeInError 0.3s ease;
}

.field-error i {
    font-size: 0.8rem;
    flex-shrink: 0;
}

.form-group.error .form-input {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-group.error .input-icon {
    color: #dc2626;
}

@keyframes fadeInError {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Login Error (Main Error Message) */
.login-error {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    margin-bottom: 1.5rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #dc2626;
    font-size: 0.9rem;
    animation: slideInError 0.4s ease;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.login-error.show {
    opacity: 1;
    transform: translateY(0);
}

.error-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.error-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.error-close {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #dc2626;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.error-close:hover {
    background: rgba(239, 68, 68, 0.2);
}

@keyframes slideInError {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form Options */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 1rem;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-input {
    display: none;
}

.checkbox-mark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.checkbox-mark::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.75rem;
    color: white;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

.checkbox-input:checked + .checkbox-mark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-input:checked + .checkbox-mark::after {
    opacity: 1;
    transform: scale(1);
}

.checkbox-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.forgot-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.forgot-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Login Button */
.login-btn {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

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

.login-btn.loading {
    cursor: not-allowed;
    transform: none;
}

.login-btn .btn-text {
    transition: opacity 0.3s ease;
}

.login-btn.loading .btn-text {
    opacity: 0;
}

.btn-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.login-btn.loading .btn-loading {
    opacity: 1;
}

/* Login Footer */
.login-footer {
    text-align: center;
}

.signup-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.signup-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.signup-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--primary-color);
}

.separator {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Demo Controls */
.demo-controls {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
}

.demo-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    white-space: nowrap;
}

.demo-btn:hover {
    background: var(--bg-tertiary);
    color: var(--primary-color);
}

/* ===================================
   LOGIN PAGE RTL SUPPORT
   ================================= */

[dir="rtl"] .login-controls {
    left: 2rem;
    right: auto;
}

[dir="rtl"] .input-icon {
    left: auto;
    right: 1rem;
}

[dir="rtl"] .form-input {
    padding: 0 2.5rem 0 1rem;
    text-align: right;
}

[dir="rtl"] .password-toggle {
    left: 1rem;
    right: auto;
}

[dir="rtl"] .checkbox-wrapper {
    flex-direction: row-reverse;
}

[dir="rtl"] .form-options {
    flex-direction: row-reverse;
}

[dir="rtl"] .error-content {
    flex-direction: row-reverse;
}

[dir="rtl"] .btn-loading {
    flex-direction: row-reverse;
}

[dir="rtl"] .footer-links {
    flex-direction: row-reverse;
}

[dir="rtl"] .demo-controls {
    left: auto;
    right: 2rem;
}

[dir="rtl"] .login-logo {
    flex-direction: row-reverse;
}

/* ===================================
   LOGIN PAGE DARK THEME ADJUSTMENTS
   ================================= */

[data-theme="dark"] .login-background {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

[data-theme="dark"] .shape {
    opacity: 0.05;
}

[data-theme="dark"] .login-card {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(20px);
    border-color: var(--border-color);
}

[data-theme="dark"] .control-btn {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(20px);
}

[data-theme="dark"] .demo-btn {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(20px);
}

[data-theme="dark"] .form-input {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .form-input:focus {
    background: var(--bg-secondary);
}

[data-theme="dark"] .checkbox-mark {
    background: var(--bg-tertiary);
}

/* ===================================
   LOGIN PAGE RESPONSIVE DESIGN
   ================================= */

@media (max-width: 768px) {
    .login-container {
        padding: 1rem;
    }
    
    .login-card {
        padding: 2rem 1.5rem;
        border-radius: 12px;
    }
    
    .login-controls {
        top: 1rem;
        right: 1rem;
        gap: 0.5rem;
    }
    
    .control-btn {
        width: 44px;
        height: 44px;
    }
    
    .login-title {
        font-size: 1.75rem;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .demo-controls {
        bottom: 1rem;
        left: 1rem;
    }
    
    .shape-1 {
        width: 200px;
        height: 200px;
    }
    
    .shape-2 {
        width: 150px;
        height: 150px;
    }
    
    .shape-3 {
        width: 100px;
        height: 100px;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 1.5rem 1rem;
        border-radius: 8px;
    }
    
    .login-controls {
        gap: 0.25rem;
    }
    
    .control-btn {
        width: 40px;
        height: 40px;
    }
    
    .control-btn i {
        font-size: 1rem;
    }
    
    .login-title {
        font-size: 1.5rem;
    }
    
    .login-subtitle {
        font-size: 0.9rem;
    }
    
    .demo-controls {
        display: none; /* Hide demo controls on very small screens */
    }
}

@media (max-height: 700px) {
    .login-container {
        padding: 1rem;
        align-items: flex-start;
        padding-top: 2rem;
    }
    
    .login-card {
        margin-bottom: 2rem;
    }
}

/* ===================================
   PRINT STYLES
   ================================= */

@media print {
    .app-sidebar,
    .app-header,
    .app-footer,
    .sidebar-overlay {
        display: none !important;
    }
    
    .content-area {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .content-container {
        padding: 0 !important;
    }
    
    .page-content {
        box-shadow: none !important;
        border: none !important;
    }
    
    /* Hide login page elements when printing */
    .login-background,
    .login-controls,
    .demo-controls {
        display: none !important;
    }
    
    .login-card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
}

/* ===================================
   UTILITY CLASSES  (No Bootstrap)
   ================================= */

/* ── Display ── */
.d-flex        { display: flex !important; }
.d-block       { display: block !important; }
.d-inline      { display: inline !important; }
.d-inline-flex { display: inline-flex !important; }
.d-none        { display: none !important; }

/* ── Flex helpers ── */
.flex-wrap            { flex-wrap: wrap !important; }
.flex-nowrap          { flex-wrap: nowrap !important; }
.align-items-center   { align-items: center !important; }
.align-items-start    { align-items: flex-start !important; }
.align-items-end      { align-items: flex-end !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center  { justify-content: center !important; }
.justify-content-end     { justify-content: flex-end !important; }
.justify-content-start   { justify-content: flex-start !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }

/* ── Width / Height ── */
.w-100 { width: 100% !important; }
.w-50  { width: 50% !important; }
.h-100 { height: 100% !important; }

/* ── Spacing — margin ── */
.m-0  { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.ms-1 { margin-inline-start: 0.25rem !important; }
.ms-2 { margin-inline-start: 0.5rem !important; }
.ms-3 { margin-inline-start: 1rem !important; }
.me-1 { margin-inline-end: 0.25rem !important; }
.me-2 { margin-inline-end: 0.5rem !important; }
.me-3 { margin-inline-end: 1rem !important; }

/* ── Spacing — padding ── */
.p-0  { padding: 0 !important; }
.pt-0 { padding-top: 0 !important; }
.pt-2 { padding-top: 0.5rem !important; }
.pt-3 { padding-top: 1rem !important; }
.pb-2 { padding-bottom: 0.5rem !important; }
.pb-3 { padding-bottom: 1rem !important; }
.ps-2 { padding-inline-start: 0.5rem !important; }
.pe-2 { padding-inline-end: 0.5rem !important; }

/* ── Text utilities ── */
.text-danger    { color: #ef4444 !important; }
.text-muted     { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-primary   { color: var(--primary-color) !important; }
.text-success   { color: #10b981 !important; }
.text-warning   { color: #f59e0b !important; }
.text-center    { text-align: center !important; }
.text-start     { text-align: start !important; }
.text-end       { text-align: end !important; }
.fw-bold        { font-weight: 700 !important; }
.fw-semibold    { font-weight: 600 !important; }
.small          { font-size: 0.85rem !important; }

/* ── Shadow ── */
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

/* ── Grid: row / col ── */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-inline-start: -0.5rem;
    margin-inline-end: -0.5rem;
}
.row > * {
    padding-inline-start: 0.5rem;
    padding-inline-end: 0.5rem;
    box-sizing: border-box;
}
.col-12  { width: 100%; }
.col-6   { width: 50%; }
.col-4   { width: 33.333%; }
.col-3   { width: 25%; }
@media (min-width: 768px) {
    .col-md-12 { width: 100%; }
    .col-md-6  { width: 50%; }
    .col-md-4  { width: 33.333%; }
    .col-md-3  { width: 25%; }
    .col-md-8  { width: 66.667%; }
    .col-md-9  { width: 75%; }
}
@media (max-width: 767px) {
    .col-md-4,
    .col-md-3,
    .col-md-6,
    .col-md-8,
    .col-md-9 { width: 100%; }
}

/* ── Card ── */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}
.card-body {
    padding: 1.25rem;
}
.card-header {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    font-weight: 600;
}

/* Card headers built as `.card-header.d-flex ... justify-content-between`
   (heading on one side, an action-button group on the other) overflow when
   space is tight because .d-flex has no wrap. This depends on the AVAILABLE
   width, not the viewport — with the sidebar open on a mid-size screen the
   content area is narrow while the viewport is still wide, so a viewport
   media query would miss it. Wrapping is therefore unconditional: it only
   kicks in when the heading + button group don't fit on one line, dropping
   the buttons below the heading (and wrapping the button group itself) so
   the heading can never be crushed character-by-character. */
.card-header.d-flex {
    flex-wrap: wrap;
    gap: 0.75rem;
}
.card-header.d-flex > .d-flex {
    flex-wrap: wrap;
}

/* ── Alert ── */
.alert {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    position: relative;
}
.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}
.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #10b981;
}
.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}
.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}
.alert-dismissible {
    padding-inline-end: 2.5rem;
}
.alert-dismissible .close-btn {
    position: absolute;
    inset-inline-end: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    color: inherit;
    opacity: 0.7;
}
.alert-dismissible .close-btn:hover { opacity: 1; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 1.1rem;
    border-radius: 7px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
    white-space: nowrap;
    line-height: 1.4;
}
.btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
}
.btn-secondary {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background: var(--border-color);
    border-color: var(--border-hover);
}
.btn-warning {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #fff;
}
.btn-warning:hover {
    background: #d97706;
    border-color: #d97706;
    color: #fff;
}
.btn-danger {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}
.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}
.btn-success {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}
.btn-success:hover {
    background: #059669;
    border-color: #059669;
    color: #fff;
}
.btn-sm {
    padding: 0.3rem 0.75rem;
    font-size: 0.82rem;
    border-radius: 5px;
}
.btn-lg {
    padding: 0.7rem 1.5rem;
    font-size: 1rem;
    border-radius: 8px;
}
.btn:disabled,
.btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Form controls ── */
.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.85rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control        { cursor: pointer; }
textarea.form-control      { resize: vertical; min-height: 80px; }
.form-control:disabled     { opacity: 0.6; cursor: not-allowed; background: var(--bg-tertiary); }
.form-group {
    margin-bottom: 1rem;
}
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

/* ── Table responsive wrapper ── */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Page heading ── */
.page-heading {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* ── Form section title ── */
.form-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
    margin-bottom: 14px;
}

/* ── Password field with toggle ── */
.input-password-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.input-password-wrap input {
    padding-inline-start: 2.4rem;
    flex: 1;
}
.toggle-password {
    position: absolute;
    inset-inline-start: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}
.toggle-password:hover { color: var(--primary-color); }

/* ── Inline field validation ── */
.invalid-feedback {
    display: block;
    font-size: 0.8rem;
    color: #ef4444;
    margin-top: 3px;
    min-height: 1rem;
}
input.is-invalid,
select.is-invalid,
textarea.is-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15);
}

/* ── Badge colour variants (used with .status-badge) ── */
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }

/* ── Detail view grid (label/value pairs) ── */
.view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px 24px;
    margin-bottom: 8px;
}
.view-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.view-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}
.view-value {
    font-size: 0.92rem;
    color: var(--text-primary);
}

/* Disabled table row */
.row-disabled td { opacity: 0.45; text-decoration: line-through; }
.row-disabled .table-actions a, .row-disabled .table-actions .btn-success { opacity: 1; text-decoration: none; }

/* ── Channel Conditions form ── */
.cc-condition {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0;
}
.cc-num {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    margin-top: 2px;
}
.cc-body {
    flex: 1;
    min-width: 0;
}
.cc-desc {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
}
.form-label .cc-label-val {
    font-weight: 700;
    color: var(--primary-color);
}
.cc-divider {
    border-top: 1px solid var(--border-color);
    margin: 0;
}
/* Exemption card accent */
.cc-exemption-card { border-color: #f59e0b33; }
.cc-exemption-header {
    background: #fef3c7;
    color: #92400e;
    border-bottom-color: #f59e0b33;
    font-weight: 600;
}
[data-theme="dark"] .cc-exemption-header {
    background: #451a0330;
    color: #fbbf24;
}
/* Checkbox cards */
.cc-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.cc-check-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
    min-width: 220px;
}
.cc-check-item input[type="checkbox"] { display: none; }
.cc-check-icon {
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 4px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.65rem;
    color: transparent;
    transition: all 0.15s;
}
.cc-check-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.cc-check-num {
    font-size: 0.7rem;
    background: var(--bg-tertiary);
    border-radius: 3px;
    padding: 1px 5px;
    font-weight: 700;
    color: var(--text-muted);
}
.cc-check-item--on {
    border-color: var(--primary-color);
    background: rgba(59,130,246,0.05);
}
.cc-check-item--on .cc-check-icon {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}
.cc-check-item--on .cc-check-label { color: var(--text-primary); font-weight: 500; }
.cc-check-item:hover { border-color: var(--primary-color); }

/* ── Student Portal ── */
.student-portal-page {
    background: var(--bg-secondary);
    min-height: 100vh;
}
.sp-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}
.sp-header-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sp-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.95rem;
}
.sp-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
}
.sp-username { color: var(--text-secondary); }
.sp-logout {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}
.sp-logout:hover { color: #ef4444; }
.sp-main { padding: 2rem 1rem; }
.sp-container { max-width: 800px; margin: 0 auto; }
.sp-page-title { margin-bottom: 1.5rem; }
.sp-page-title h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Cards */
.sp-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}
.sp-card-header {
    padding: 0.75rem 1.25rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.sp-card-body { padding: 1.25rem; }

/* Approval status */
.sp-status-body { padding: 1.25rem; }
.sp-status-badge { font-size: 0.95rem !important; padding: 6px 14px !important; }

/* Overall badge in header */
.sp-overall-badge {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}
.sp-badge-pass { background: #d1fae5; color: #065f46; }
.sp-badge-fail { background: #fee2e2; color: #991b1b; }

/* Condition rows */
.sp-cond-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}
.sp-cond-row:last-of-type { border-bottom: none; }
.sp-cond-row.sp-cond-pass    { background: #f0fdf450; }
.sp-cond-row.sp-cond-fail    { background: #fef2f250; }
.sp-cond-row.sp-cond-exempt  { background: #fffbeb50; }
.sp-cond-icon { flex-shrink: 0; font-size: 1.2rem; width: 1.5rem; text-align: center; margin-top: 2px; }
.sp-cond-body { flex: 1; }
.sp-cond-title { font-weight: 600; font-size: 0.9rem; color: var(--text-primary); margin-bottom: 2px; display: flex; align-items: center; gap: 0.4rem; }
.sp-cond-num { font-size: 0.72rem; background: var(--bg-tertiary); color: var(--text-muted); border-radius: 3px; padding: 1px 5px; font-weight: 700; }
.sp-cond-desc { font-size: 0.82rem; color: var(--text-muted); }
.sp-cond-value { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; font-weight: 500; }
.sp-cond-badge-wrap { flex-shrink: 0; }
.sp-cond-badge { font-size: 0.78rem; font-weight: 600; padding: 3px 10px; border-radius: 20px; display: inline-block; }
.sp-badge-pass    { background: #d1fae5; color: #065f46; }
.sp-badge-fail    { background: #fee2e2; color: #991b1b; }
.sp-badge-exempt  { background: #fef3c7; color: #92400e; }
.sp-badge-missing { background: #f3f4f6; color: #6b7280; }

/* Martyr note */
.sp-martyr-note {
    padding: 0.75rem 1rem;
    background: #fffbeb;
    border-top: 1px solid #f59e0b33;
    font-size: 0.82rem;
    color: #92400e;
}
[data-theme="dark"] .sp-martyr-note { background: #451a0320; color: #fbbf24; }

/* التقديم card */
.sp-taqdeem-header { background: #eff6ff; color: #1d4ed8; border-bottom-color: #bfdbfe; }
[data-theme="dark"] .sp-taqdeem-header { background: #1e3a5f30; color: #93c5fd; }
.sp-taqdeem-body { padding: 2.5rem 1.25rem; }
.sp-soon { text-align: center; color: var(--text-secondary); }
.sp-soon-icon { font-size: 2.5rem; color: var(--primary-color); margin-bottom: 0.75rem; }
.sp-soon h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.4rem; color: var(--text-primary); }
.sp-soon p { font-size: 0.875rem; color: var(--text-muted); }
.sp-info-card { border-color: var(--border-color); }

/* ── Channel Conditions result rows (students/view) ── */
.cc-check-results {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.cc-result-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
}
.cc-result-row.cc-result-pass    { border-color: #6ee7b722; background: #f0fdf4; }
.cc-result-row.cc-result-fail    { border-color: #fca5a522; background: #fef2f2; }
.cc-result-row.cc-result-exempt  { border-color: #f59e0b22; background: #fffbeb; }
.cc-result-row.cc-result-missing { border-color: var(--border-color); }
[data-theme="dark"] .cc-result-row.cc-result-pass    { background: #052e1620; border-color: #10b98130; }
[data-theme="dark"] .cc-result-row.cc-result-fail    { background: #450a0a20; border-color: #ef444430; }
[data-theme="dark"] .cc-result-row.cc-result-exempt  { background: #451a0320; border-color: #f59e0b30; }
.cc-result-icon { flex-shrink: 0; font-size: 1.1rem; width: 1.4rem; text-align: center; }
.cc-result-body {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.cc-result-num {
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-radius: 3px;
    padding: 1px 5px;
}
.cc-result-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}
.cc-result-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.cc-result-badge { flex-shrink: 0; }

/* ── Student Portal Apply Page (.sp-apply-*) ─────────────────── */

.sp-apply-info-card { border-color: #bfdbfe; background: #eff6ff; }
[data-theme="dark"] .sp-apply-info-card { background: #1e3a5f20; border-color: #3b82f640; }

.sp-apply-count-badge {
    margin-right: auto;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--primary-color);
    color: #fff;
}

/* Department row */
.sp-apply-dept-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}
.sp-apply-dept-row:last-child { border-bottom: none; }
.sp-apply-dept-row:hover { background: var(--bg-secondary); }
.sp-apply-dept-row--selected { background: #eff6ff; }
[data-theme="dark"] .sp-apply-dept-row--selected { background: #1e3a5f25; }

/* Custom checkbox */
.sp-apply-dept-check-label {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    cursor: pointer;
}
.sp-apply-dept-check-label input[type="checkbox"] { display: none; }
.sp-apply-check-box {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-hover);
    border-radius: 5px;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}
.sp-apply-dept-check-label input[type="checkbox"]:checked + .sp-apply-check-box {
    background: var(--primary-color);
    border-color: var(--primary-color);
}
.sp-apply-dept-check-label input[type="checkbox"]:checked + .sp-apply-check-box::after {
    content: '';
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-right: none;
    transform: rotate(-45deg) translateY(-1px);
    display: block;
}

/* Dept info */
.sp-apply-dept-info { flex: 1; min-width: 0; }
.sp-apply-dept-title {
    font-size: 0.925rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sp-apply-dept-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Priority wrap */
.sp-apply-priority-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* Submitted list */
.sp-apply-submitted-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.sp-apply-submitted-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
}
.sp-apply-priority {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sp-apply-dept-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}
.sp-apply-submitted-item .sp-apply-dept-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .sp-apply-dept-row { flex-wrap: wrap; }
    .sp-apply-priority-wrap { width: 100%; justify-content: flex-end; }
    .sp-apply-submitted-item { flex-wrap: wrap; }
    .sp-apply-submitted-item .sp-apply-dept-sub { width: 100%; }
}

/* ── Choices Panel (sortable) ──────────────────────────────────── */
.sp-choices-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sp-choice-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}
.sp-choice-item:last-child { border-bottom: none; }
.sp-choice-item:hover { background: var(--bg-secondary); }
.sp-choice-num {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Editable position input — looks like the circle badge but is a real input */
.sp-choice-pos-input {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    background: var(--primary-color);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    padding: 0;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    -moz-appearance: textfield;
}
.sp-choice-pos-input::-webkit-outer-spin-button,
.sp-choice-pos-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sp-choice-pos-input:focus {
    outline: none;
    background: #fff;
    color: var(--primary-color);
    border-color: var(--primary-color);
}
.sp-choice-info {
    flex: 1;
    min-width: 0;
}
.sp-choice-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sp-choice-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sp-choice-arrows {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sp-arrow-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}
.sp-arrow-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}
.sp-arrow-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Review list inside SweetAlert */
.sp-review-list {
    list-style: decimal;
    margin: 0;
    padding-right: 1.25rem;
}
.sp-review-item {
    padding: 0.4rem 0;
    border-bottom: 1px solid #f3f4f6;
    text-align: right;
}
.sp-review-item:last-child { border-bottom: none; }

/* ── Student Portal — Info Grid ──────────────────────────────── */
.sp-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}
.sp-info-item .sp-info-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.sp-info-item .sp-info-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* ===================================
   MODAL PRIMITIVES
   Theme-native modal built on existing CSS variables.
   Show/hide is controlled from JS by toggling `.show` on .modal + .modal-backdrop,
   plus `.modal-open` on <body> to lock background scroll.
   ================================= */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: none;
    overflow-y: auto;
    padding: 2rem 1rem;
}

.modal.show {
    display: block;
}

.modal-dialog {
    max-width: 560px;
    margin: 2rem auto;
}

.modal-dialog.modal-lg {
    max-width: 800px;
}

.modal-content {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-close {
    border: 0;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

.btn-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

body.modal-open {
    overflow: hidden;
}

/* ── Welcome / dashboard hero card (quick-260411-o9z) ── */
.welcome-card {
    max-width: 640px;
    margin: 2rem auto;
}
.welcome-card .card-body {
    padding: 3rem 2rem 2.25rem;
}
.welcome-logo {
    display: block;
    width: 100%;
    max-width: 260px;
    height: auto;
    margin: 0 auto 1.5rem;
    object-fit: contain;
}
.welcome-system-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
    letter-spacing: -0.01em;
    line-height: 1.25;
}
.welcome-greeting {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0 0 2rem;
}
.welcome-greeting strong {
    color: var(--primary-color);
    font-weight: 700;
}
.welcome-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}
.welcome-meta-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.85rem 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    min-width: 180px;
}
.welcome-meta-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.welcome-meta-value {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 700;
}
.welcome-meta-item--permissions {
    min-width: 320px;
    max-width: 480px;
    align-items: stretch;
    text-align: right;
}
.welcome-permissions-list {
    list-style: none;
    margin: 0;
    padding: 0.15rem 0.25rem 0.15rem 0;
    max-height: 120px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.welcome-permissions-item {
    font-size: 0.93rem;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.35;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.42rem 0.6rem;
}
@media (max-width: 576px) {
    .welcome-meta-item--permissions {
        min-width: 100%;
    }
    .welcome-permissions-list {
        max-height: 140px;
    }
}

/* Seats computed block -- highlighted section in plan edit form */
.seats-computed-block {
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
}
.seats-computed-block__title {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}
