/* Admin Panel Styles */

:root {
    --admin-primary: var(--primary-color);
    --admin-secondary: var(--secondary-color);
    --admin-accent: var(--accent-color);
    --admin-success: #38a169;
    --admin-warning: #d69e2e;
    --admin-danger: #e53e3e;
    --admin-light: var(--light-bg, #f7fafc);
    --admin-white: #ffffff;
    --admin-text: #2d3748;
    --admin-border: #e2e8f0;
}

.admin-body {
    margin: 0;
    padding: 0;
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--admin-light);
}

[dir="rtl"] .admin-body {
    direction: rtl;
}

[dir="ltr"] .admin-body {
    direction: ltr;
}

.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    background: var(--admin-primary);
    color: var(--admin-on-primary, var(--text-on-primary, #ffffff));
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 20px 20px;
    border-bottom: 1px solid color-mix(in srgb, var(--admin-on-primary, #fff) 18%, transparent);
}

.sidebar-title {
    padding: 15px 20px 12px 20px;
    border-bottom: 1px solid color-mix(in srgb, var(--admin-on-primary, #fff) 18%, transparent);
    text-align: center;
}

.sidebar-title h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--admin-on-primary, var(--text-on-primary, #fff));
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.3;
}

.sidebar-header h2 {
    margin: 0 0 10px 0;
    font-size: 1.3rem;
    color: var(--admin-on-primary, var(--text-on-primary, #fff));
}

.sidebar-header p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.85;
    color: color-mix(in srgb, var(--admin-on-primary, #fff) 82%, transparent);
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: color-mix(in srgb, var(--admin-on-primary, #fff) 82%, transparent);
    text-decoration: none;
    transition: all 0.3s;
    border-right: 3px solid transparent;
    line-height: 1.3;
    font-size: 0.95rem;
}

.sidebar-nav a:hover {
    background: color-mix(in srgb, var(--admin-on-primary, #fff) 12%, transparent);
    color: var(--admin-on-primary, var(--text-on-primary, #fff));
}

.sidebar-nav a.active {
    background: color-mix(in srgb, var(--admin-on-primary, #fff) 18%, transparent);
    color: var(--admin-on-primary, var(--text-on-primary, #fff));
    border-right-color: var(--admin-on-primary, var(--text-on-primary, #fff));
}

.sidebar-divider {
    height: 1px;
    background: color-mix(in srgb, var(--admin-on-primary, #fff) 22%, transparent);
    margin: 8px 20px;
    list-style: none;
    padding: 0;
}

.sidebar-nav i {
    width: 20px;
    font-size: 0.9rem;
    flex-shrink: 0;
}

[dir="rtl"] .sidebar-nav i {
    margin-left: 10px;
}

[dir="ltr"] .sidebar-nav i {
    margin-right: 10px;
}

/* Main Content Area */
.admin-main {
    flex: 1;
    min-height: 100vh;
}

[dir="rtl"] .admin-main {
    margin-right: 260px;
}

[dir="ltr"] .admin-main {
    margin-left: 260px;
}

.admin-header {
    background: var(--admin-white);
    padding: 20px 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    margin: 0;
    color: var(--admin-heading, var(--text-heading, var(--admin-primary)));
    font-size: 1.8rem;
}

.admin-user-info {
    color: var(--admin-text);
    font-size: 0.9rem;
}

.admin-content {
    padding: 30px;
}

/* Dashboard */
.dashboard {
    max-width: 1400px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--admin-white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    gap: 20px;
    align-items: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    border: 1px solid var(--admin-border);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--admin-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px color-mix(in srgb, var(--admin-primary) 18%, transparent);
    border-color: var(--admin-primary);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-icon {
    width: 70px;
    height: 70px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--admin-heading, var(--primary-text-color, var(--text-heading, var(--admin-primary))));
    background: var(--icon-bg, color-mix(in srgb, var(--admin-primary) 14%, #ffffff 86%));
    border: 1px solid color-mix(in srgb, var(--admin-primary) 12%, var(--admin-border) 88%);
    flex-shrink: 0;
    transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--admin-primary) 10%, transparent);
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(5deg);
    background: var(--icon-bg-strong, color-mix(in srgb, var(--admin-primary) 22%, #ffffff 78%));
    border-color: color-mix(in srgb, var(--admin-primary) 24%, var(--admin-border) 76%);
}

.stat-info {
    flex: 1;
}

.stat-info h3 {
    margin: 0 0 10px 0;
    color: var(--admin-heading, var(--text-heading, var(--admin-primary)));
    font-size: 0.9rem;
    font-weight: 600;
}

.stat-card:hover .stat-info h3,
.stat-card:focus-visible .stat-info h3 {
    color: var(--admin-primary);
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--admin-heading, var(--text-heading, var(--admin-primary)));
    margin: 0;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--admin-text);
}

/* Clickable filter stat boxes (issues, projects, etc.) */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-box {
    background: var(--admin-white);
    padding: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
    cursor: pointer;
    border: 2px solid var(--admin-border);
    position: relative;
}

.stat-box:hover,
.stat-box:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px color-mix(in srgb, var(--admin-primary) 16%, transparent);
    border-color: color-mix(in srgb, var(--admin-primary) 35%, var(--admin-border) 65%);
    outline: none;
}

.stat-box.stat-active {
    border-color: var(--admin-primary);
    box-shadow: 0 4px 16px color-mix(in srgb, var(--admin-primary) 22%, transparent);
    background: color-mix(in srgb, var(--admin-primary) 6%, var(--admin-white) 94%);
}

.stat-box i {
    font-size: 2.5rem;
    color: var(--admin-heading, var(--primary-text-color, var(--text-heading, var(--admin-primary))));
    background: var(--icon-bg, color-mix(in srgb, var(--admin-primary) 14%, #ffffff 86%));
    border: 1px solid color-mix(in srgb, var(--admin-primary) 12%, var(--admin-border) 88%);
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.stat-box:hover i,
.stat-box:focus-visible i {
    transform: scale(1.05);
    background: var(--icon-bg-strong, color-mix(in srgb, var(--admin-primary) 22%, #ffffff 78%));
}

.stat-box .stat-content h3 {
    margin: 0;
    font-size: 2rem;
    font-weight: bold;
    color: var(--admin-heading, var(--text-heading, var(--admin-primary)));
}

.stat-box .stat-content p {
    margin: 5px 0 0;
    color: var(--admin-text);
    font-size: 0.9rem;
}

@keyframes flash-pending-stat {
    0% {
        box-shadow: 0 2px 8px rgba(0,0,0,0.1), 0 0 0 0 color-mix(in srgb, var(--admin-primary) 40%, transparent);
        border-color: var(--admin-border);
    }
    50% {
        box-shadow: 0 4px 16px color-mix(in srgb, var(--admin-primary) 24%, transparent), 0 0 0 8px transparent;
        border-color: color-mix(in srgb, var(--admin-primary) 45%, var(--admin-border) 55%);
    }
    100% {
        box-shadow: 0 2px 8px rgba(0,0,0,0.1), 0 0 0 0 transparent;
        border-color: var(--admin-border);
    }
}

.stat-box.stat-flashing {
    animation: flash-pending-stat 2s ease-in-out infinite;
    background: color-mix(in srgb, var(--admin-primary) 8%, var(--admin-white) 92%);
}

.stat-box.stat-flashing::before {
    pointer-events: none;
}


.dashboard-section {
    background: var(--admin-white);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 25px;
}

.dashboard-section h2,
.dashboard-section h4 {
    color: var(--admin-heading, var(--text-heading, var(--admin-primary)));
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--admin-border);
}

.dashboard-section h4 {
    margin-top: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.dashboard-section h2 {
    margin-bottom: 20px;
}

/* Admin Page */
.admin-page {
    max-width: 100%;
    width: 100%;
}

.page-actions {
    margin-bottom: 25px;
}

/* Split Layout for Admin Pages (like users, documents) */
.admin-split-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
    align-items: start;
    width: 100%;
}

.admin-list-panel {
    min-width: 0;
    width: 100%;
}

.admin-edit-panel {
    background: var(--admin-white);
    border-radius: 8px;
    position: sticky;
    top: 20px;
    height: calc(100vh - 40px);
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    min-width: 0;
}

.edit-panel-header {
    padding: 15px 20px;
    border-bottom: 2px solid var(--admin-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--admin-primary);
    color: var(--admin-on-primary, var(--text-on-primary, #fff));
}

.edit-panel-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.edit-panel-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.edit-panel-placeholder {
    padding: 60px 20px;
    text-align: center;
    color: color-mix(in srgb, var(--admin-text) 55%, #94a3b8 45%);
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.edit-panel-placeholder i {
    display: block;
    margin-bottom: 15px;
    color: var(--admin-heading, var(--text-heading, var(--admin-primary)));
    font-size: 2.5rem;
}

#editFrame {
    width: 100%;
    height: 100%;
    border: none;
    flex: 1;
    min-height: 0;
}

/* Responsive Split Layout (all *-split-layout admin pages) */
@media (max-width: 1400px) {
    [class*="-split-layout"] {
        grid-template-columns: 1fr;
    }

    [class*="-split-layout"] [class*="-edit-panel"],
    [class*="-split-layout"] .admin-edit-panel {
        position: relative;
        top: 0;
        max-height: none;
    }

    [class*="-split-layout"] [class*="-edit-panel"]:not(.active),
    [class*="-split-layout"] .admin-edit-panel:not(.active) {
        display: none;
    }

    [class*="-split-layout"].is-editing [class*="-list-panel"],
    [class*="-split-layout"].is-editing .admin-list-panel {
        display: none;
    }

    [class*="-split-layout"].is-editing [class*="-edit-panel"],
    [class*="-split-layout"].is-editing .admin-edit-panel {
        display: flex;
        flex-direction: column;
        min-height: calc(100vh - 140px);
        height: auto;
    }

    [class*="-split-layout"].is-editing [class*="-edit-panel"] .edit-panel-content,
    [class*="-split-layout"].is-editing .admin-edit-panel .edit-panel-content {
        flex: 1;
        min-height: 60vh;
    }
}

@media (min-width: 1401px) {
    [class*="-split-layout"] {
        grid-template-columns: 1.5fr 1fr;
    }
}

@media (max-width: 768px) {
    [class*="-split-layout"] {
        gap: 15px;
    }

    [class*="-split-layout"].is-editing [class*="-edit-panel"],
    [class*="-split-layout"].is-editing .admin-edit-panel {
        min-height: calc(100vh - 100px);
    }
}

/* Filters */
.filters-container {
    background: var(--admin-white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 25px;
}

.filters-form {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
    background-color: color-mix(in srgb, var(--admin-primary) 8%, #fff 92%) !important;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid color-mix(in srgb, var(--admin-primary) 35%, var(--admin-border) 65%);
}

.filter-group {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group label {
    display: inline-block;
    margin-bottom: 0;
    color: var(--admin-text);
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-group input,
.filter-group select {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--admin-border);
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--admin-accent);
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-actions .btn {
    white-space: nowrap;
}

.filter-actions .reset-btn {
    min-width: 38px;
    padding: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.filter-actions .reset-btn i {
    margin: 0;
}

/* Data Table */
.data-table-container {
    background: var(--admin-white);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--admin-primary);
    color: var(--admin-on-primary, var(--text-on-primary, #fff));
}

.data-table th {
    padding: 15px;
    font-weight: 600;
}

[dir="rtl"] .data-table th {
    text-align: right;
}

[dir="ltr"] .data-table th {
    text-align: left;
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid var(--admin-border);
}

.data-table tbody tr:hover {
    background: var(--admin-light);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.clickable-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.clickable-row:hover {
    background: var(--admin-light) !important;
}

.clickable-row.selected {
    background: color-mix(in srgb, var(--admin-primary) 10%, transparent 90%) !important;
    border-right: 3px solid var(--admin-primary);
}

[dir="rtl"] .clickable-row.selected {
    border-right: none;
    border-left: 3px solid var(--admin-primary);
}

/* Compact table rows */
.data-table.table-sm th {
    padding: 8px 12px;
}

.data-table.table-sm td {
    padding: 6px 12px;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--admin-text);
    font-size: 0.9rem;
}

/* Hide details row on wide screens (every even row in tbody is the details row) */
/* Disabled - this was hiding every other row in tables without detail rows */
/* .table tbody tr:nth-child(even) {
    display: none;
} */

.actions {
    white-space: nowrap;
}

[dir="rtl"] .actions .btn {
    margin-left: 5px;
}

[dir="ltr"] .actions .btn {
    margin-right: 5px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-success {
    background: #c6f6d5;
    color: #22543d;
}

.badge-warning {
    background: #fefcbf;
    color: #744210;
}

.badge-danger {
    background: #fed7d7;
    color: #742a2a;
}

.badge-info {
    background: #bee3f8;
    color: var(--admin-secondary);
}

.badge-primary {
    background: #cfe2ff;
    color: var(--admin-accent);
}

.badge-secondary {
    background: #e2e3e5;
    color: var(--admin-text);
}

.badge-dark {
    background: #212529;
    color: #ffffff;
}

/* Forms - Unified, Compact, and Clear Styling */
.admin-iframe-body {
    margin: 0;
    padding: 16px;
    background: var(--admin-light, #f7fafc);
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--admin-text);
}

.admin-iframe-body .admin-page,
.admin-iframe-body .form-container {
    max-width: 100%;
}

.admin-content .form-container,
.admin-page .form-container,
.admin-iframe-body .form-container {
    background: var(--admin-white);
    padding: 24px 28px;
    border-radius: 8px;
    border: 1px solid var(--admin-border);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.form-container h2 {
    color: var(--admin-heading, var(--text-heading, var(--admin-primary)));
    margin: 0 0 20px 0;
    font-size: 1.3rem;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--admin-border);
}

.admin-form {
    background-color: transparent;
}

.admin-form .form-group {
    margin-bottom: 16px;
}

.admin-form label,
.admin-content .form-label,
.admin-iframe-body .form-label {
    display: block;
    margin-bottom: 6px;
    margin-top: 0;
    color: var(--admin-heading, var(--text-heading, var(--admin-primary)));
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.35;
    text-transform: none;
    letter-spacing: 0;
}

.admin-form .form-group > label:first-child,
.admin-content .form-group > .form-label:first-child {
    margin-top: 0;
}

.admin-form label[for] {
    cursor: pointer;
}

.admin-form input[type="text"],
.admin-form input[type="email"],
.admin-form input[type="number"],
.admin-form input[type="date"],
.admin-form input[type="time"],
.admin-form input[type="datetime-local"],
.admin-form input[type="tel"],
.admin-form input[type="search"],
.admin-form input[type="url"],
.admin-form input[type="password"],
.admin-form textarea,
.admin-form select,
.admin-content .form-control,
.admin-iframe-body .form-control {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--admin-border, #d0d0d0);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--admin-white);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    color: var(--admin-text);
    box-sizing: border-box;
}

.admin-form input[type="text"]:hover,
.admin-form input[type="email"]:hover,
.admin-form input[type="number"]:hover,
.admin-form input[type="date"]:hover,
.admin-form input[type="time"]:hover,
.admin-form input[type="datetime-local"]:hover,
.admin-form input[type="tel"]:hover,
.admin-form input[type="search"]:hover,
.admin-form input[type="url"]:hover,
.admin-form input[type="password"]:hover,
.admin-form textarea:hover,
.admin-form select:hover,
.admin-content .form-control:hover,
.admin-iframe-body .form-control:hover {
    border-color: color-mix(in srgb, var(--admin-primary) 35%, #b0b0b0 65%);
}

.admin-form input[type="text"]:focus,
.admin-form input[type="email"]:focus,
.admin-form input[type="number"]:focus,
.admin-form input[type="date"]:focus,
.admin-form input[type="time"]:focus,
.admin-form input[type="datetime-local"]:focus,
.admin-form input[type="tel"]:focus,
.admin-form input[type="search"]:focus,
.admin-form input[type="url"]:focus,
.admin-form input[type="password"]:focus,
.admin-form textarea:focus,
.admin-form select:focus,
.admin-content .form-control:focus,
.admin-iframe-body .form-control:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--admin-primary) 18%, transparent);
    color: var(--admin-text);
    background: var(--admin-white);
}

.admin-form input[type="text"]::placeholder,
.admin-form input[type="email"]::placeholder,
.admin-form input[type="number"]::placeholder,
.admin-form input[type="url"]::placeholder,
.admin-form input[type="password"]::placeholder,
.admin-form textarea::placeholder,
.admin-content .form-control::placeholder,
.admin-iframe-body .form-control::placeholder {
    color: var(--placeholder-color, #94a3b8);
    opacity: 1;
}

.admin-form input:disabled,
.admin-form textarea:disabled,
.admin-form select:disabled {
    background: var(--surface-muted);
    color: color-mix(in srgb, var(--admin-text) 55%, #94a3b8 45%);
    cursor: not-allowed;
}

.admin-form input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 2px solid #d0d0d0;
    border-radius: 4px;
    background: var(--admin-white);
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.admin-form input[type="checkbox"]:hover {
    border-color: var(--admin-primary);
}

.admin-form input[type="checkbox"]:checked {
    background-color: var(--admin-primary);
    border-color: var(--admin-primary);
}

.admin-form input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
}

.admin-form input[type="checkbox"]:focus {
    outline: 2px solid rgba(30, 58, 95, 0.2);
    outline-offset: 2px;
}

.admin-form input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--surface-muted);
}

[dir="rtl"] .admin-form input[type="checkbox"] {
    margin-right: 0;
    margin-left: 8px;
}

.admin-form input[type="file"] {
    width: 100%;
    font-size: 0.85rem;
}

.admin-form textarea {
    resize: vertical;
    min-height: 80px;
}

.admin-form select,
.admin-content select.form-control,
.admin-iframe-body select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
    appearance: none;
}

[dir="rtl"] .admin-form select,
[dir="rtl"] .admin-content select.form-control,
[dir="rtl"] .admin-iframe-body select.form-control {
    background-position: left 10px center;
    padding-right: 10px;
    padding-left: 30px;
}

/* CKEditor (rich text) aligned with form fields */
.admin-form .ck.ck-editor,
.admin-content .ck.ck-editor,
.admin-iframe-body .ck.ck-editor {
    border: 1px solid var(--admin-border, #d0d0d0);
    border-radius: 4px;
    overflow: hidden;
}

.admin-form .ck.ck-editor__editable:not(.ck-editor__nested-editable),
.admin-content .ck.ck-editor__editable:not(.ck-editor__nested-editable),
.admin-iframe-body .ck.ck-editor__editable:not(.ck-editor__nested-editable) {
    min-height: 180px;
    color: var(--admin-text);
    background: var(--admin-white);
}

.admin-form .ck.ck-editor__editable:focus,
.admin-content .ck.ck-editor__editable:focus,
.admin-iframe-body .ck.ck-editor__editable:focus {
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--admin-primary) 18%, transparent);
}

.admin-content .text-muted,
.admin-form .text-muted,
.admin-iframe-body .text-muted {
    color: color-mix(in srgb, var(--admin-text) 65%, #94a3b8 35%);
}

.admin-form small {
    display: block;
    margin-top: 4px;
    color: var(--admin-text);
    font-size: 0.8rem;
    line-height: 1.3;
}

.admin-form .form-group[style*="grid-template-columns"] {
    display: grid;
    gap: 12px;
}

.admin-form .form-group[style*="grid-template-columns"] > div {
    display: flex;
    flex-direction: column;
}

.admin-form .form-group[style*="grid-template-columns"] label {
    margin-bottom: 6px;
}

/* Grid layout classes for form groups */
.admin-form .form-group.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.admin-form .form-group.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.admin-form .form-group.grid-2 > div,
.admin-form .form-group.grid-3 > div {
    display: flex;
    flex-direction: column;
}

.admin-form .form-group.grid-2 label,
.admin-form .form-group.grid-3 label {
    margin-bottom: 6px;
}

/* Image upload wrapper styling */
.admin-form .image-upload-wrapper {
    margin-top: 0;
}

.admin-form .image-preview {
    background: var(--admin-white);
    border: 1px solid #d0d0d0;
}

.admin-form .image-preview:hover {
    border-color: var(--admin-primary);
}

/* Required field indicator - use class or add * manually in HTML */
.admin-form label.required::after,
.admin-form .required-label::after {
    content: ' *';
    color: var(--admin-danger);
    font-weight: 600;
    margin-left: 2px;
}

/* Checkbox and radio styling */
.admin-form input[type="checkbox"] + label,
.admin-form input[type="radio"] + label {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0;
    margin-left: 6px;
    font-size: 0.9rem;
    color: var(--admin-text);
    font-weight: 400;
    cursor: pointer;
    user-select: none;
}

[dir="rtl"] .admin-form input[type="checkbox"] + label,
[dir="rtl"] .admin-form input[type="radio"] + label {
    margin-left: 0;
    margin-right: 6px;
}

/* Radio button styling */
.admin-form input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 2px solid #d0d0d0;
    border-radius: 50%;
    background: var(--admin-white);
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.admin-form input[type="radio"]:hover {
    border-color: var(--admin-primary);
}

.admin-form input[type="radio"]:checked {
    border-color: var(--admin-primary);
}

.admin-form input[type="radio"]:checked::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--admin-primary);
}

.admin-form input[type="radio"]:focus {
    outline: 2px solid rgba(30, 58, 95, 0.2);
    outline-offset: 2px;
}

.admin-form input[type="radio"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--surface-muted);
}

[dir="rtl"] .admin-form input[type="radio"] {
    margin-right: 0;
    margin-left: 8px;
}

.current-image img {
    border-radius: 4px;
    border: 2px solid var(--admin-border);
}

.current-file {
    background: var(--admin-light);
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--admin-border);
}

.form-actions .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.form-actions .btn-primary {
    min-width: 150px;
}

.form-actions .btn-secondary {
    min-width: 100px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-primary {
    background: var(--admin-primary);
    color: var(--text-on-primary, #ffffff);
}

.btn-primary:hover {
    background: var(--admin-secondary);
    color: var(--text-on-secondary, var(--text-on-primary, #ffffff));
}

.btn-secondary {
    background: var(--admin-secondary, var(--secondary-color, #718096));
    color: var(--text-on-secondary, var(--text-on-primary, #ffffff));
}

.btn-secondary:hover {
    background: var(--admin-primary, var(--primary-color, #4a5568));
    color: var(--text-on-primary, #ffffff);
}

.btn-danger {
    background: var(--admin-danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: #c53030;
    color: #ffffff;
}

.btn-info {
    background: var(--admin-primary);
    color: var(--text-on-primary, #ffffff);
}

.btn-info:hover {
    background: var(--admin-secondary);
    color: var(--text-on-secondary, var(--text-on-primary, #ffffff));
}

.btn-success {
    background: var(--admin-success);
    color: #ffffff;
}

.btn-success:hover {
    background: #2f855a;
    color: #ffffff;
}

.btn-warning {
    background: var(--admin-warning);
    color: #ffffff;
}

.btn-warning:hover {
    background: #b7791f;
    color: #ffffff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fed7d7;
    color: #742a2a;
    border-right: 4px solid var(--admin-danger);
}

.alert-success {
    background: #c6f6d5;
    color: #22543d;
    border-right: 4px solid var(--admin-success);
}

/* Flash Messages */
.flash-message {
    padding: 15px 20px;
    margin-bottom: 0;
    margin-left: auto;
    margin-right: auto;
    max-width: 600px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flash-success {
    background: #c6f6d5;
    color: #22543d;
    border-right: 4px solid var(--admin-success);
}

.flash-error {
    background: #fed7d7;
    color: #742a2a;
    border-right: 4px solid var(--admin-danger);
}

.flash-info {
    background: #bee3f8;
    color: var(--admin-secondary);
    border-right: 4px solid var(--admin-accent);
}

.close-flash {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: inherit;
    padding: 0;
    margin-right: 10px;
}

/* Activity List */
.activity-list {
    max-height: 600px;
    overflow-y: auto;
}

.activity-list .table {
    color: var(--admin-text);
}

.activity-list .table thead th {
    color: var(--admin-heading, var(--text-heading, var(--admin-primary)));
    border-bottom-color: var(--admin-border);
}

.activity-list .table tbody td {
    color: var(--admin-text);
}

.admin-content a:not(.btn):not(.stat-card):not(.stat-box):not(.page-link):not(.sidebar-nav a) {
    color: var(--link-color, var(--admin-heading, var(--text-heading, var(--admin-primary))));
    text-decoration: underline;
    text-underline-offset: 2px;
}

.admin-content a:not(.btn):not(.stat-card):not(.stat-box):not(.page-link):not(.sidebar-nav a):hover {
    color: var(--link-hover-color, var(--admin-primary));
}

.dashboard-invoice-alert {
    background: color-mix(in srgb, var(--admin-primary) 8%, #fff3cd 92%);
    border: 2px solid color-mix(in srgb, var(--admin-primary) 15%, #ffc107 85%);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    direction: rtl;
    color: var(--alert-warning-text, #856404);
}

.dashboard-invoice-alert__icon {
    font-size: 2rem;
    color: var(--alert-warning-text, #856404);
}

.dashboard-invoice-alert__title {
    margin: 0 0 10px 0;
    color: var(--admin-heading, var(--text-heading, var(--admin-primary)));
    font-size: 1.3rem;
}

.dashboard-invoice-alert__title i {
    color: var(--admin-heading, var(--text-heading, var(--admin-primary)));
}

.dashboard-invoice-alert__body,
.dashboard-invoice-alert__footer {
    margin: 0 0 15px 0;
    color: var(--alert-warning-text, #856404);
    font-size: 1rem;
    line-height: 1.6;
}

.dashboard-invoice-alert__footer {
    margin: 15px 0 0 0;
    font-size: 0.95rem;
}

.dashboard-invoice-alert__footer i {
    color: var(--admin-heading, var(--text-heading, var(--admin-primary)));
}

.dashboard-invoice-alert__panel {
    background: var(--admin-white);
    padding: 15px;
    border-radius: 6px;
    margin-top: 10px;
    border: 1px solid var(--admin-border);
}

.dashboard-invoice-alert__panel-title {
    margin: 0 0 10px 0;
    font-weight: 600;
    color: var(--admin-heading, var(--text-heading, var(--admin-primary)));
}

.dashboard-invoice-alert__list {
    margin: 0;
    padding-right: 20px;
    color: var(--admin-text);
}

.dashboard-invoice-alert__link {
    margin-right: 10px;
    color: var(--link-color, var(--admin-heading, var(--text-heading, var(--admin-primary))));
    text-decoration: underline;
}

.dashboard-invoice-alert__link:hover {
    color: var(--link-hover-color, var(--admin-primary));
}

.dashboard-invoice-alert__link i {
    color: inherit;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.page-link {
    padding: 10px 15px;
    background: var(--admin-white);
    color: var(--admin-heading, var(--text-heading, var(--admin-primary)));
    text-decoration: none;
    border-radius: 4px;
    border: 2px solid var(--admin-border);
    transition: all 0.3s;
}

.page-link:hover {
    background: var(--admin-primary);
    color: var(--admin-on-primary, var(--text-on-primary, #fff));
    border-color: var(--admin-primary);
}

.page-link.active {
    background: var(--admin-primary);
    color: var(--admin-on-primary, var(--text-on-primary, #fff));
    border-color: var(--admin-primary);
}

/* No Content */
.no-content {
    text-align: center;
    padding: 40px 20px;
    color: var(--admin-text);
}

/* Responsive */
@media (max-width: 768px) {
    .admin-sidebar {
        width: 70px;
        height: 100vh;
        position: fixed;
        top: 0;
        z-index: 1000;
        overflow-x: hidden;
    }

    [dir="rtl"] .admin-sidebar {
        right: 0;
    }

    [dir="ltr"] .admin-sidebar {
        left: 0;
    }
    
    [dir="rtl"] .admin-main {
        margin-right: 70px;
    }
    
    [dir="ltr"] .admin-main {
        margin-left: 70px;
    }
    
    .sidebar-nav a {
        font-size: 0;
        padding: 10px 0;
        text-align: center;
        position: relative; /* For badge positioning */
    }

    .sidebar-nav i {
        font-size: 1.4rem;
        margin: 0 !important;
        width: 100%;
        display: block;
        text-align: center;
    }
    
    .badge-flashing {
        position: absolute;
        top: 5px;
        right: 10px; /* Adjust based on design */
        font-size: 9px;
        min-width: 16px;
        height: 16px;
        padding: 2px;
    }
    
    [dir="rtl"] .badge-flashing {
        right: auto;
        left: 10px;
    }
    
    .sidebar-logo {
        margin-bottom: 10px;
    }
    
    .sidebar-logo img {
        max-width: 50px;
        width: 100%;
        height: auto;
    }
    
    .sidebar-profile {
        margin-bottom: 10px;
    }
    
    .sidebar-profile p {
        display: none;
    }
    
    .sidebar-profile-img {
        width: 40px;
        height: auto;
        max-width: 100%;
        aspect-ratio: 1 / 1;
        margin-bottom: 0;
        border-width: 2px;
    }
    
    .sidebar-header {
        padding: 15px 10px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stat-card {
        padding: 15px;
        gap: 12px;
        flex-direction: column;
        text-align: center;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
        margin: 0 auto;
        border-radius: 10px;
    }
    
    .stat-info {
        width: 100%;
    }
    
    .stat-info h3 {
        font-size: 0.85rem;
        margin-bottom: 6px;
    }
    
    .stat-number {
        font-size: 1.5rem;
        line-height: 1.2;
    }
    
    .stat-label {
        font-size: 0.75rem;
        display: block;
        margin-top: 4px;
    }
    
    .data-table-container {
        overflow-x: auto;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    /* Show details row on mobile */
    .table tbody tr:nth-child(even) {
        display: table-row;
    }
    
    .table th,
    .table td {
        padding: 8px 6px;
        font-size: 0.8rem;
    }
    
    .table th {
        font-size: 0.75rem;
        white-space: nowrap;
    }
    
    .table.table-sm th,
    .table.table-sm td {
        padding: 6px 4px;
        font-size: 0.75rem;
    }
    
    .dashboard-section {
        padding: 15px;
    }
    
    .dashboard-section h2 {
        font-size: 1.2rem;
        margin-bottom: 15px;
        padding-bottom: 10px;
    }
    
    .activity-list {
        max-height: 400px;
    }
    
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .form-container {
        padding: 0;
    }
    
    .admin-form .form-group {
        margin-bottom: 14px;
    }

    .admin-form .form-group[style*="grid-template-columns"],
    .admin-iframe-body .form-group[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    
    .admin-form input[type="text"],
    .admin-form input[type="email"],
    .admin-form input[type="number"],
    .admin-form input[type="date"],
    .admin-form input[type="url"],
    .admin-form input[type="password"],
    .admin-form textarea,
    .admin-form select {
        padding: 7px 9px;
        font-size: 0.9rem;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .sidebar-logo img {
        max-width: 35px;
    }
    
    .sidebar-header {
        padding: 10px 5px;
    }
    
    .sidebar-profile-img {
        width: 35px;
        height: auto;
        aspect-ratio: 1 / 1;
        border-width: 2px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-card {
        padding: 12px;
        gap: 10px;
    }
    
    .stat-icon {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
        border-radius: 8px;
    }
    
    .stat-info h3 {
        font-size: 0.8rem;
        margin-bottom: 5px;
    }
    
    .stat-number {
        font-size: 1.3rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .table {
        font-size: 0.75rem;
    }
    
    .table th,
    .table td {
        padding: 6px 4px;
        font-size: 0.7rem;
    }
    
    .table th {
        font-size: 0.7rem;
    }
    
    .table.table-sm th,
    .table.table-sm td {
        padding: 4px 3px;
        font-size: 0.65rem;
    }
    
    .dashboard-section {
        padding: 12px;
    }
    
    .dashboard-section h2 {
        font-size: 1rem;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }
    
    .activity-list {
        max-height: 350px;
    }
    
    /* Hide less important columns on very small screens */
    .table th:nth-child(3),
    .table td:nth-child(3) {
        display: none;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow: auto;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 2px solid var(--admin-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--admin-primary);
    color: var(--admin-on-primary, var(--text-on-primary, #fff));
    border-radius: 10px 10px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.modal form {
    padding: 20px;
}

.modal .form-group {
    margin-bottom: 20px;
}

.modal .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--admin-text);
}

.modal .form-control {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Cairo', sans-serif;
    transition: border-color 0.3s;
}

.modal .form-control:focus {
    outline: none;
    border-color: var(--admin-primary);
}

.modal-footer {
    padding: 20px;
    border-top: 2px solid var(--admin-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--admin-light);
    border-radius: 0 0 10px 10px;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
    line-height: 1;
}

.close:hover {
    transform: scale(1.2);
}

/* Button Styles */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Cairo', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--admin-primary);
    color: var(--text-on-primary, #ffffff);
}

.btn-primary:hover:not(:disabled) {
    background: var(--admin-secondary);
    color: var(--text-on-secondary, var(--text-on-primary, #ffffff));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--admin-primary, var(--primary-color, var(--primary-color))) 40%, transparent);
}

.btn-secondary {
    background: var(--admin-secondary, var(--btn-secondary-bg, var(--secondary-color, #718096)));
    color: var(--text-on-secondary, var(--text-on-primary, #ffffff));
}

.btn-secondary:hover:not(:disabled) {
    background: var(--admin-primary, var(--btn-secondary-hover-bg, var(--primary-color, #4a5568)));
    color: var(--text-on-primary, #ffffff);
}

.btn-danger {
    background: var(--admin-danger);
    color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
    background: #c53030;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.4);
}

.btn-success {
    background: var(--admin-success);
    color: #ffffff;
}

.btn-success:hover:not(:disabled) {
    background: #2f855a;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 161, 105, 0.4);
}

.btn-warning {
    background: var(--admin-warning);
    color: #ffffff;
}

.btn-warning:hover:not(:disabled) {
    background: #b7791f;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(214, 158, 46, 0.4);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1.1rem;
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-header h2 {
        font-size: 1.1rem;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Timeline Styles */
.timeline {
    position: relative;
    padding-left: 1rem;
    border-left: 2px solid #e9ecef;
}
.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}
.timeline-item:last-child {
    padding-bottom: 0;
}
.timeline-marker {
    position: absolute;
    left: -0.6rem;
    top: 0.2rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #e9ecef;
}

/* Hover Lift Effect */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.15)!important;
}

/* Right-to-Left Support for Timeline */
[dir="rtl"] .timeline {
    padding-left: 0;
    padding-right: 1rem;
    border-left: none;
    border-right: 2px solid #e9ecef;
}
[dir="rtl"] .timeline-marker {
    left: auto;
    right: -0.6rem;
}
[dir="rtl"] .border-start {
    border-left: 0 !important;
    border-right: 4px solid #dc3545 !important;
}

/* Form Tabs */
.form-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0;
}

.tab-button {
    padding: 12px 20px;
    background: #f5f5f5;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: color-mix(in srgb, var(--admin-text) 70%, #64748b 30%);
    transition: all 0.3s;
    position: relative;
    top: 2px;
}

.tab-button:hover {
    background: var(--surface-muted);
    color: #333;
}

.tab-button.active {
    background: white;
    color: #3498db;
    border-bottom-color: #3498db;
    font-weight: 600;
}

.tab-button i {
    margin-left: 5px;
}

[dir="rtl"] .tab-button i {
    margin-left: 0;
    margin-right: 5px;
}

/* Form tabs (for users-edit.php) */
.admin-form .tab-content {
    display: none;
    padding: 20px 0;
    animation: fadeIn 0.3s;
}

.admin-form .tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Profile Photo */
.profile-photo-preview {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    border: 3px solid var(--admin-border);
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
}

.profile-photo-preview:hover {
    border-color: var(--admin-primary);
    transform: scale(1.05);
}

.profile-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-placeholder {
    width: 100%;
    height: 100%;
    background: var(--admin-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: color-mix(in srgb, var(--admin-text) 55%, #94a3b8 45%);
}

.profile-placeholder i {
    font-size: 50px;
}

.profile-photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: opacity 0.3s;
    border-radius: 4px;
}

.profile-photo-preview:hover .profile-photo-overlay {
    opacity: 1;
}

/* Status Toggle */
.status-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.status-toggle.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.status-toggle.disabled .status-toggle-slider {
    background-color: #d0d0d0 !important;
}

.status-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.status-toggle-slider {
    width: 48px;
    height: 24px;
    background-color: #d0d0d0;
    border-radius: 24px;
    transition: all 0.3s ease;
    position: relative;
    border: 2px solid transparent;
}

.status-toggle:hover:not(.disabled) .status-toggle-slider {
    border-color: rgba(30, 58, 95, 0.2);
}

.status-toggle-slider:before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.1);
}

[dir="rtl"] .status-toggle-slider:before {
    left: auto;
    right: 2px;
}

[dir="rtl"] .status-toggle input[type="checkbox"]:checked+.status-toggle-slider:before {
    transform: translateY(-50%) translateX(-24px);
}

.status-toggle input[type="checkbox"]:checked+.status-toggle-slider {
    background-color: var(--admin-success);
    border-color: var(--admin-success);
}

.status-toggle input[type="checkbox"]:checked+.status-toggle-slider:before {
    transform: translateY(-50%) translateX(24px);
    box-shadow: 0 2px 6px rgba(56, 161, 105, 0.3), 0 1px 3px rgba(56, 161, 105, 0.2);
}

.status-toggle input[type="checkbox"]:focus+.status-toggle-slider {
    outline: 2px solid rgba(30, 58, 95, 0.2);
    outline-offset: 2px;
}

.status-toggle-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--admin-text);
    min-width: 60px;
}

.status-toggle-label .status-active {
    display: none;
    color: var(--admin-success);
}

.status-toggle-label .status-inactive {
    display: inline-block;
    color: var(--admin-text);
}

.status-toggle-wrapper.status-active .status-toggle-label .status-active {
    display: inline-block;
}

.status-toggle-wrapper.status-active .status-toggle-label .status-inactive {
    display: none;
}

/* Password Clear Button */
.admin-form #password {
    padding-right: 35px;
}

/* Household Section */
.household-section {
    background-color: var(--admin-light);
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.household-members-list .table {
    width: 100%;
    margin-bottom: 0;
    background-color: white;
}

/* CRITICAL: Override global rule that hides even rows */
.household-section .table tbody tr,
.household-section .table tbody tr:nth-child(even),
.household-section .table tbody tr:nth-child(odd) {
    display: table-row !important;
}

/* Invoice Edit Page Styles */
.invoice-item-row:hover {
    background: rgb(222, 226, 231) !important;
}

.invoice-item-row .item-total {
    font-weight: 600;
    color: var(--admin-heading, var(--text-heading, var(--admin-primary)));
    background: var(--admin-white);
}

#subtotal,
#vat_amount {
    font-size: 1.1rem;
    color: var(--admin-text);
}

#total_amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--admin-heading, var(--text-heading, var(--admin-primary)));
}

/* Theme-aware headings (darker than --admin-primary) */
.admin-content h1,
.admin-content h2,
.admin-content h3,
.admin-page h1,
.admin-page h2,
.admin-page h3,
.admin-page .page-header h1,
.admin-page .page-header h2 {
    color: var(--admin-heading, var(--text-heading, var(--admin-primary)));
}

/* Autocomplete Styles */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--admin-border);
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.autocomplete-suggestions.show {
    display: block;
}

.autocomplete-suggestion {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--admin-border);
    transition: background-color 0.2s;
    white-space: nowrap;
    overflow: hidden;
}

.autocomplete-suggestion:hover,
.autocomplete-suggestion.highlighted {
    background-color: #f0f7ff;
}

.autocomplete-suggestion:last-child {
    border-bottom: none;
}

.suggestion-description {
    font-weight: 500;
    color: var(--admin-text);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-details {
    font-size: 0.85rem;
    color: var(--admin-text);
    display: flex;
    gap: 15px;
    flex-wrap: nowrap;
    overflow: hidden;
    white-space: nowrap;
}

.suggestion-details span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.suggestion-details i {
    font-size: 0.75rem;
}

.suggestion-details .badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    font-weight: 600;
}

@media (max-width: 768px) {
    .invoice-item-row .row>div {
        margin-bottom: 10px;
    }
}

/* ========================================
   Common Form Styles (for all admin forms)
   ======================================== */

/* ========================================
   Common Form Styles (for all admin forms)
   ======================================== */

/* Form Container */
.admin-form,
.standard-form,
.library-post-form,
.form-light {
    background-color: var(--surface-muted);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* Form Labels - Common Style */
.admin-form label,
.standard-form label,
.library-post-form label,
.form-light label,
.admin-form .form-label,
.standard-form .form-label,
.library-post-form .form-label,
.form-light .form-label {
    display: block;
    margin-bottom: 4px;
    color: #0d324d;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Form Controls */
.admin-form .form-control,
.standard-form .form-control,
.library-post-form .form-control,
.form-light .form-control {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.admin-form .form-control:focus,
.standard-form .form-control:focus,
.library-post-form .form-control:focus,
.form-light .form-control:focus {
    border-color: #0d324d;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(13, 50, 77, 0.25);
}

/* Form Select */
.admin-form .form-select,
.standard-form .form-select,
.library-post-form .form-select,
.form-light .form-select {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.admin-form .form-select:focus,
.standard-form .form-select:focus,
.library-post-form .form-select:focus,
.form-light .form-select:focus {
    border-color: #0d324d;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(13, 50, 77, 0.25);
}

/* Form Textarea */
.admin-form textarea.form-control,
.standard-form textarea.form-control,
.library-post-form textarea.form-control,
.form-light textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Required Field Indicator */
.admin-form label .text-danger,
.standard-form label .text-danger,
.library-post-form label .text-danger,
.form-light label .text-danger,
.admin-form .form-label .text-danger,
.standard-form .form-label .text-danger,
.library-post-form .form-label .text-danger,
.form-light .form-label .text-danger {
    color: #dc3545;
    margin-right: 4px;
}

/* Form Groups */
.admin-form .form-group,
.standard-form .form-group,
.library-post-form .form-group,
.form-light .form-group {
    margin-bottom: 1rem;
}

/* Form Help Text */
.admin-form .form-text,
.standard-form .form-text,
.library-post-form .form-text,
.form-light .form-text {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Theme-matched admin icons on light surfaces */
.admin-content i.fas,
.admin-content i.far,
.admin-content i.fal,
.dashboard-section h2 i,
.dashboard-section h4 i,
.page-actions i,
.activity-list i,
.admin-header h1 i {
    color: var(--admin-heading, var(--text-heading, var(--admin-primary)));
}

.admin-sidebar i,
.edit-panel-header i,
.btn i,
[class*="btn-"] i {
    color: inherit;
}

.stat-icon,
.stat-icon i {
    color: var(--admin-heading, var(--primary-text-color, var(--text-heading, var(--admin-primary))));
}
