/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--primary-font);
    font-size: var(--font-size-base);
    background: var(--main-background);
    direction: rtl;
    height: 100vh;
    overflow: hidden;
    color: var(--text-primary);
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Top Bar */
.top-bar {
    height: 16.67vh;
    background: var(--bar-background);
    color: var(--bar-text-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: var(--box-shadow-light);
    z-index: 1000;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.system-logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.system-logo {
    width: 50px;
    height: 50px;
}

.system-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.system-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.app-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin-bottom: 2px;
}

.system-version {
    font-size: var(--font-size-small);
    opacity: var(--bar-text-opacity);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.entity-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.entity-logo {
    width: 45px;
    height: 45px;
    background: var(--bar-hover-background);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: 1px solid var(--bar-border-color);
    transition: var(--button-transition);
}

.entity-logo:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.entity-logo:active {
    transform: scale(0.98);
}

.entity-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.entity-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.entity-name {
    font-size: var(--font-size-medium);
    font-weight: 600;
    margin-bottom: 2px;
}

.entity-type {
    font-size: var(--font-size-small);
    opacity: var(--bar-text-opacity);
}

.user-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: var(--button-padding);
    background: var(--bar-hover-background);
    border-radius: var(--border-radius);
    border: 1px solid var(--bar-border-color);
}

.user-name {
    font-weight: 600;
    font-size: var(--font-size-base);
    margin-bottom: 2px;
}

.user-role {
    opacity: var(--bar-text-opacity);
    font-size: var(--font-size-small);
}

.logout-btn {
    background: var(--bar-hover-background);
    border: 1px solid var(--bar-border-color);
    color: var(--bar-text-color);
    padding: var(--button-padding);
    border-radius: var(--button-border-radius);
    cursor: pointer;
    transition: var(--button-transition);
    font-size: var(--font-size-base);
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* System Footer */
.system-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bar-background);
    color: var(--bar-text-color);
    padding: 8px 20px;
    text-align: center;
    font-size: 12px;
    border-top: 1px solid #444;
    z-index: 999;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

.footer-content {
    direction: rtl;
}

#systemVersion {
    font-weight: 600;
    color: var(--bar-text-color);
}


/* Main Container */
.main-container {
    display: flex;
    flex-direction: row-reverse;
    height: calc(100vh - 70px - 35px);
    /* 70px top bar + 35px footer */
    overflow: hidden;

}

/* Side Menu */
.side-menu {
    width: 12.5vw;
    background: var(--menu-background);
    box-shadow: var(--box-shadow-light);
    transition: var(--button-transition);
    overflow-y: auto;
    z-index: 100;
}

.side-menu.collapsed {
    width: 60px;
}

.menu-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.menu-title {
    font-size: var(--font-size-large);
    font-weight: 600;
    color: var(--text-primary);
    transition: opacity 0.3s ease;
}

.side-menu.collapsed .menu-title {
    opacity: 0;
    pointer-events: none;
}

.menu-section-title {
    padding: 15px 20px 10px;
    font-size: var(--font-size-small);
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: opacity 0.3s ease;
}

.side-menu.collapsed .menu-section-title {
    opacity: 0;
    pointer-events: none;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    transition: transform 0.3s ease;
    padding: 8px;
    border-radius: 4px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-toggle:hover {
    background: #f0f0f0;
    color: var(--text-primary);
}

.menu-toggle:active {
    background: #e0e0e0;
}

.side-menu.collapsed .menu-header {
    justify-content: flex-end;
    position: relative;
}

.side-menu.collapsed .menu-toggle {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%) rotate(180deg);
    z-index: 2;
}

.menu-items {
    padding: 10px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--button-transition);
    border-right: 3px solid transparent;
}

.menu-item:hover {
    background: var(--hover-background);
    color: var(--text-accent);
    border-right-color: var(--active-border);
}

.menu-item.active {
    background: var(--hover-background);
    color: var(--text-accent);
    border-right-color: var(--active-border);
    font-weight: 600;
}

.menu-item-icon {
    font-size: var(--font-size-large);
    margin-left: 12px;
    min-width: 20px;
}

.menu-item-text {
    transition: opacity 0.3s ease;
}

.side-menu.collapsed .menu-item-text {
    opacity: 0;
    pointer-events: none;
}

.side-menu.collapsed .menu-item {
    justify-content: center;
    padding: 12px 20px;
}

/* Main Content */
.main-content {
    order: 1;
    flex: 1;
    background: var(--main-background);
    padding: 30px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 20px;
    /* Extra padding at bottom for breathing room */
}

.content-header {
    margin-bottom: 30px;
}

.page-title {
    font-size: var(--font-size-xxl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: var(--font-size-medium);
}

.content-card {
    background: var(--card-background);
    border-radius: var(--border-radius-large);
    padding: 30px;
    box-shadow: var(--box-shadow-medium);
    margin-bottom: 20px;
}

/* Dashboard */
.dashboard-grid {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
}

.dashboard-card {
    background: var(--card-background);
    border-radius: var(--border-radius-large);
    padding: 24px;
    box-shadow: var(--box-shadow-medium);
    text-align: center;
    transition: var(--button-transition);
    width: 250px;
    min-width: 250px;
    max-width: 250px;
    /* Dynamic height based on screen size */
    min-height: 250px;
    height: calc(100vh - 280px);
    /* Adjust based on top bar and margins */
    max-height: calc(100vh - 200px);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.internal-card {
    background: var(--secondary-background);
    border: 1px solid #000000;
    /* Black border as requested */
    border-radius: var(--border-radius);
    padding: 12px;
    font-size: 11pt;
    font-family: inherit;
    text-align: left;
    /* Changed to left alignment */
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.internal-cards-container {
    flex: 1;
    margin-top: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 4px;
}

.internal-card:hover {
    background: var(--hover-background);
    border-color: #000000;
    /* Keep black border on hover */
}

.internal-card-timestamp {
    color: var(--text-muted);
    font-size: 9pt;
    margin-top: 6px;
    text-align: right;
    /* Keep timestamps left aligned */
}

.internal-card-content {
    color: var(--text-secondary);
    font-size: 10pt;
    line-height: 1.3;
    text-align: right;
    /* Left alignment for content */
}



.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-strong);
}

.dashboard-card-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 8px;
    /* Reduced space between title and card border */
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.dashboard-card-icon {
    font-size: 16pt;
    margin-right: 8px;
    /* RTL spacing */
    flex-shrink: 0;
}

.dashboard-card-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16pt;
    margin: 0;
    flex: 1;
    text-align: right;
    /* RTL alignment */
}

.dashboard-card-plus {
    width: 20px;
    height: 20px;
    margin-left: auto;
    /* Push to leftmost position in RTL */
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.dashboard-card-plus:hover {
    opacity: 1;
    transform: scale(1.1);
}

.dashboard-flex-row {
    display: flex;
    align-items: flex-start;
    gap: 32px;
    margin-bottom: 15px;
    /* 15px from bottom as requested */
    max-width: 1200px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    justify-content: space-between;
    /* Calculate height to reach 15px from bottom */
    height: calc(100vh - 16.67vh - 60px - 15px);
    /* Total height - top bar - padding - bottom margin */
    min-height: 400px;
    /* Minimum height for usability */
}

/* Add dashboard cards wrapper to contain the cards */
.dashboard-cards-wrapper {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
    /* Prevent overflow */
    align-items: flex-start;
    /* Align cards to top */

}

/* Context Buttons */
.context-buttons-section {
    order: 2;
    width: 180px;
    min-width: 180px;
    /* Ensure it doesn't shrink */
    max-width: 180px;
    /* Prevent it from growing */
    height: 260px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 18px;
    padding: 18px 8px;
    box-sizing: border-box;
    background: var(--context-section-background);
    border-radius: var(--border-radius-large);
    box-shadow: var(--box-shadow-light);
    margin: 24px 0 0 0;
    /* Remove right margin to align with edge */
    flex-shrink: 0;
    /* Prevent shrinking */
}

.context-btn {
    width: 100%;
    min-width: 100px;
    height: 48px;
    background: var(--card-background);
    border: 2px solid var(--button-primary-color);
    border-radius: var(--border-radius);
    color: var(--button-primary-color);
    font-size: var(--font-size-medium);
    font-weight: 600;
    cursor: pointer;
    transition: var(--button-transition);
    box-shadow: var(--box-shadow-light);
}

.context-btn:hover {
    background: var(--button-primary-color);
    color: var(--button-text-color);
}

/* Context Button Colors by Order */
.context-buttons-section .context-btn:nth-child(1) {
    background: var(--context-btn-color-1);
    color: var(--context-btn-text);
    border: none;
}

.context-buttons-section .context-btn:nth-child(2) {
    background: var(--context-btn-color-2);
    color: var(--context-btn-text);
    border: none;
}

.context-buttons-section .context-btn:nth-child(3) {
    background: var(--context-btn-color-3);
    color: var(--context-btn-text);
    border: none;
}

/* Tables */
.attributes-table,
.reusable-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: var(--card-background);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow-light);
}

.attributes-table th,
.table-header {
    background: var(--table-header-background);
    color: var(--table-header-text);
    padding: 12px 15px;
    text-align: right;
    font-weight: 600;
    border-bottom: 2px solid var(--table-header-border);
    position: relative;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.column-title {
    cursor: pointer;
    flex: 1;
}

.column-title:hover {
    text-decoration: underline;
}

.sort-icon {
    font-size: var(--font-size-small);
    min-width: 12px;
}

.filter-icon {
    cursor: pointer;
    font-size: var(--font-size-base);
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.filter-icon:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.filter-icon.filtered {
    background-color: #ff6b6b;
    color: var(--button-text-color);
}

.attributes-table td,
.reusable-table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid var(--border-color-light);
    vertical-align: top;
}

.attributes-table tr:nth-child(even),
.reusable-table tr:nth-child(even) {
    background-color: var(--hover-background);
}

.attributes-table tr:hover,
.reusable-table tr:hover {
    background-color: var(--hover-background-light);
}

.table-input {
    width: 100%;
    border: 1px solid #ddd;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: var(--font-size-base);
    direction: rtl;
    font-family: var(--primary-font);
}

.table-input:focus {
    outline: none;
    border-color: var(--input-focus-color);
    box-shadow: var(--input-focus-shadow);
}

.readonly-cell {
    background-color: #f5f5f5;
}

/* Filter Menu */
.filter-menu {
    background: var(--card-background);
    border: 1px solid #ddd;
    border-radius: var(--button-border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    padding: 8px 0;
    direction: rtl;
}

.filter-option {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-option:hover {
    background-color: var(--hover-background-light);
}

.filter-option.clear-filter {
    color: #ff6b6b;
    font-weight: bold;
    border-bottom: 1px solid var(--border-color-light);
    margin-bottom: 4px;
}

.filter-option.clear-filter:hover {
    background-color: #ffe6e6;
}

.filter-menu hr {
    margin: 4px 0;
    border: none;
    border-top: 1px solid var(--border-color-light);
}

/* Empty States */
.attributes-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-style: italic;
}

/* School Year Page Layout */
.schoolyear-container {
    display: flex;
    gap: 20px;
    height: 100%;
    direction: rtl;
    width: 100%;
}

.schoolyear-content {
    flex: 1;
    min-width: 0;
    /* Prevents flex item from overflowing */
    width: calc(100% - 200px);
    /* Main content minus context buttons width */
    max-width: calc(100% - 200px);
}

.schoolyear-content .content-card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.schoolyear-context {
    order: 2;
    /* Places it on the right in RTL */
    width: 180px;
    min-width: 180px;
    max-width: 180px;
    height: 260px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 18px;
    padding: 18px 8px;
    box-sizing: border-box;
    background: var(--context-section-background);
    border-radius: var(--border-radius-large);
    box-shadow: var(--box-shadow-light);
    margin: 0;
    position: sticky;
    top: 20px;
    flex-shrink: 0;
    /* Prevent context buttons from shrinking */
}

.schoolyear-context .context-btn {
    width: 100%;
    min-width: 100px;
    height: 48px;
    border-radius: var(--border-radius);
    font-size: var(--font-size-medium);
    font-weight: 600;
    cursor: pointer;
    transition: var(--button-transition);
    box-shadow: var(--box-shadow-light);
    margin: 0 !important;
    /* Override inline styles */
}

/* Responsive for school year page */
@media (max-width: 900px) {
    .schoolyear-container {
        flex-direction: column;
    }

    .schoolyear-content {
        width: 100%;
        max-width: 100%;
    }

    .schoolyear-context {
        order: 1;
        /* Move to top on mobile */
        width: 100%;
        height: auto;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        margin-bottom: 12px;
        padding: 12px 0;
        position: static;
        min-width: auto;
        max-width: none;
    }

    .schoolyear-context .context-btn {
        width: 30vw;
        min-width: 80px;
        margin: 0 6px !important;
    }
}

/* Ensure content doesn't overflow */
.schoolyear-content * {
    max-width: 100%;
    box-sizing: border-box;
}

#schoolYearSectionContent .content-card {
    width: 100%;
    max-width: 100%;
}

/* Students Page Styles */
.students-container {
    display: flex;
    gap: 20px;
    height: 100%;
    direction: rtl;
    width: 100%;
}

.students-content {
    flex: 1;
    min-width: 0;
    width: calc(100% - 200px);
    max-width: calc(100% - 200px);
}

.screenwithtable-context {
    order: 2;
    width: 180px;
    min-width: 180px;
    max-width: 180px;
    height: 320px;
    /* Taller for 4 buttons */
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 18px;
    padding: 18px 8px;
    box-sizing: border-box;
    background: var(--context-section-background);
    border-radius: var(--border-radius-large);
    box-shadow: var(--box-shadow-light);
    margin: 0;
    position: sticky;
    top: 20px;
    flex-shrink: 0;
}

.screenwithtable-context .context-btn {
    width: 100%;
    min-width: 100px;
    height: 48px;
    border-radius: var(--border-radius);
    font-size: var(--font-size-medium);
    font-weight: 600;
    cursor: pointer;
    transition: var(--button-transition);
    box-shadow: var(--box-shadow-light);
    margin: 0 !important;
    border: none;
    opacity: 0.7;
}

.screenwithtable-context .context-btn:hover {
    opacity: 1;
    transform: translateY(-1px);
}

/* Students Summary Cards */
.students-summary {
    margin-bottom: 30px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    direction: rtl;
}

.summary-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.summary-icon-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    opacity: 0.8;
}

.summary-info {
    flex: 1;
    text-align: right;
}

.summary-value {
    font-size: 2em;
    font-weight: 700;
    color: #C15A16;
    line-height: 1;
    margin-bottom: 5px;
}

.summary-label {
    font-size: 0.9em;
    color: #666;
    font-weight: 500;
}

/* Global Table Styling with Gridlines - Apply to ALL ReusableTable instances */
.table-container {
    overflow-x: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: white;
    direction: rtl;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    direction: rtl;
    text-align: right;
    font-family: var(--primary-font);
}

.data-table th {
    background-color: #f8f9fa;
    color: #333;
    font-weight: 600;
    padding: 15px 12px;
    border-bottom: 2px solid #dee2e6;
    border-left: 1px solid #dee2e6;
    white-space: nowrap;
    font-size: 0.95em;
    text-align: right;
}

.data-table th:first-child {
    border-right: none;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
    border-left: 1px solid #dee2e6;
    vertical-align: middle;
    text-align: right;
}

.data-table td:first-child {
    border-right: none;
    background-color: #f8f9fa;
    font-weight: 500;
    direction: ltr;
    text-align: right;
}

.data-table tr:hover {
    background-color: #f5f5f5;
}

.data-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.data-table td:nth-child(3) {
    font-weight: 600;
    color: #2c3e50;
}

/* Right-align table cells except actions column */
.data-table td,
.data-table th {
    text-align: right;
}

.data-table td:last-child,
.data-table th:last-child {
    text-align: center;
    /* Actions column centered */
}

/* Loading and Error States */
.loading-spinner {
    text-align: center;
    padding: 40px 20px;
    direction: rtl;
    font-size: 1.1em;
    color: #666;
}

.table-error {
    text-align: center;
    padding: 40px 20px;
    direction: rtl;
    font-size: 1.1em;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
}

.table-error button {
    margin-top: 15px;
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.table-error button:hover {
    background-color: #0056b3;
}

/* Detail cards styling */
.detail-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.detail-card-header {
    background: #e9ecef;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    min-height: 50px;
    border-bottom: 2px solid #dee2e6;
}

.detail-card-header:hover {
    background: linear-gradient(135deg, #b7cdf3 0%, #95a1b8 100%);
}

.detail-card-title {
    margin: 0;
    color: #333;
    font-size: 1.1em;
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50ch;
    /* 50 character limit */
    padding-right: 10px;
}

.card-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.collapse-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    line-height: 1;
    border-radius: 4px;
    flex-shrink: 0;
}

.collapse-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.detail-card.collapsed .collapse-toggle {
    transform: rotate(0deg);
}

.detail-card.expanded .collapse-toggle {
    transform: rotate(45deg);
}


.detail-card-content {
    padding: 20px;
    background: white;
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    direction: rtl;
}

.detail-card.collapsed .detail-card-content {
    max-height: 0;
    padding: 0 20px;
}

/* Ensure action buttons don't interfere with collapse toggle */
.detail-card-header .btn-icon {
    z-index: 2;
    position: relative;
    flex-shrink: 0;
}

/* Enhanced detail card content for table containers following Table Horizontal Scrolling 
.detail-card-content {
    padding: 10px;
    background: white;
    min-height: 75px;
    color: #6c757d;
    direction: rtl;
    overflow-x: auto; // Enable horizontal scroll for card content 
}*/

/* Generic Detail Fields - System-wide styling */
.detail-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    direction: rtl;
    text-align: right;
    padding: 10px;
}

.detail-section {
    background: #f9f9f9;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.detail-section-title {
    color: #C15A16;
    margin-bottom: 15px;
    border-bottom: 2px solid #C15A16;
    padding-bottom: 5px;
    font-size: 1.1em;
    font-weight: 600;
}

.detail-field {
    margin: 8px 0;
    line-height: 1.6;
}

.detail-field-label {
    color: #333;
    font-weight: 600;
    margin-left: 8px;
}

.detail-field-value {
    color: #666;
}

.detail-status-active {
    color: #28a745;
    font-weight: 600;
}

.detail-status-inactive {
    color: #dc3545;
    font-weight: 600;
}

.detail-timestamp {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 10px;
}

/* Action Icons - Ensure proper sizing and isolation */
.action-icon-natural {
    width: 15px;
    height: 15px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}

.btn-icon {
    padding: 4px 6px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background-color: transparent;
    cursor: pointer;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon img {
    width: 15px;
    height: 15px;
    object-fit: contain;
}

/* Ensure table cells don't override icon sizing */
.actions-cell {
    display: flex;
    gap: 5px;
    align-items: center;
    justify-content: center;
}

.actions-cell .btn-icon {
    padding: 4px 6px;
}

.actions-cell .action-icon-natural {
    width: 15px !important;
    height: 15px !important;
}

/* School Attributes Styles */
.attributes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    direction: rtl;
}

.attribute-item {
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    min-height: 75px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.attribute-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9em;
    cursor: pointer;
}

.attribute-value-container {
    display: flex;
    align-items: center;
    gap: 4px;
}

.attribute-suffix {
    font-size: 0.85em;
    color: #6c757d;
    white-space: nowrap;
}

/* School Attributes Editable Styles */
.attribute-input,
.attribute-select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.95em;
    font-family: inherit;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.attribute-input:focus,
.attribute-select:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.attribute-input:disabled,
.attribute-select:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

/* Hebrew RTL support for select dropdown */
.attribute-select {
    direction: rtl;
    text-align: right;

    padding-right: 8px;
    appearance: auto;
    -webkit-appearance: auto;
    -moz-appearance: auto;
}

.attribute-select option {
    direction: rtl;
    text-align: right;
}

/* Checkbox styling for boolean attributes */
.attribute-checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    direction: rtl;
}

.attribute-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.attribute-checkbox:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.attribute-checkbox-label {
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.attribute-checkbox:checked+.attribute-checkbox-label {
    color: #28a745;
}

.attribute-checkbox:not(:checked)+.attribute-checkbox-label {
    color: #dc3545;
}

/* Number input for integer attributes */
.attribute-input[type="number"] {
    text-align: right;
}

.attribute-input[type="number"]::-webkit-inner-spin-button,
.attribute-input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
    margin-left: 8px;
}

/* School Attributes Dialog Overlays */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    direction: rtl;
}

.dialog-box {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    text-align: center;
}

.dialog-title {
    margin-bottom: 20px;
    color: #333;
}

.dialog-title.warning {
    color: #dc3545;
}

.dialog-message {
    margin-bottom: 30px;
    color: #6c757d;
    font-size: 16px;
}

.dialog-message.warning {
    color: #333;
}

.dialog-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.dialog-btn {
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.dialog-btn.save {
    background: #28a745;
    color: white;
}

.dialog-btn.dont-save {
    background: #dc3545;
    color: white;
}

.dialog-btn.cancel {
    background: #6c757d;
    color: white;
}

.dialog-btn.stay {
    background: #007bff;
    color: white;
}

.dialog-btn.leave {
    background: #6c757d;
    color: white;
}


.autocomplete-arrow {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #6b7280;
    pointer-events: none;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

/* Rotate arrow when dropdown is open */
.autocomplete-dropdown.show ~ .autocomplete-arrow {
    transform: translateY(-50%) rotate(180deg);
}

/* School Classes Edit Mode - Select Dropdown Styling */
.class-row select.class-level,
#classesTableContainer select[data-field="level"] {
    padding: 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    text-align: right;
    font-family: Arial, sans-serif;
    font-size: 14px;
    direction: rtl;
    background-color: white;
    cursor: pointer;
    width: 100%;
}

.class-row select.class-level:focus,
#classesTableContainer select[data-field="level"]:focus {
    outline: none;
    border-color: #C15A16;
    box-shadow: 0 0 0 2px rgba(193, 90, 22, 0.1);
}



.class-row select.class-level option,
#classesTableContainer select[data-field="level"] option {
    padding: 8px;
    font-family: Arial, sans-serif;
    direction: rtl;
}

/* Delete button styling */
.dialog-btn.delete {
    background-color: #dc3545;
    color: white;
}

.dialog-btn.delete:hover {
    background-color: #c82333;
}

/* Warning dialog title */
.dialog-title.warning {
    color: #856404;
}

* Inline edit button for detail fields */ .btn-icon-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 4px;
    margin-left: 8px;
    /* border: 1px solid #dee2e6;
    border-radius: 4px; */
    background-color: transparent;
    cursor: pointer;
    vertical-align: middle;
    transition: all 0.2s ease;
}

.btn-icon-inline:hover {
    background-color: #f8f9fa;
    border-color: #0d6efd;
    transform: scale(1.05);
}

.btn-icon-inline:active {
    background-color: #e9ecef;
    transform: scale(0.98);
}


/* Upload Section Styling */
.upload-section {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
}

.upload-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 18px;
}

.upload-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.form-group input,
.form-group select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.form-group input[type="file"] {
    padding: 6px;
}

.btn-upload {
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: center;
}

.btn-upload:hover {
    background-color: #218838;
}

.btn-upload:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.65;
}

.documents-table-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .upload-form {
        grid-template-columns: 1fr;
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    direction: rtl;
}

.modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
}

.modal-header h2,
.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
}

.modal-close:hover,
.modal-close:focus {
    color: #000;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    padding: 20px;
    border-top: 1px solid #dee2e6;
}