/* nadly Modern CSS System */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

:root {
    --primary: #5c6bc0;
    --primary-light: #8e99f3;
    --primary-dark: #26418f;
    --secondary: #26a69a;
    --bg-dark: #0f172a;
    --bg-card-dark: #1e293b;
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --font-ar: 'Tajawal', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: var(--font-ar);
    background-color: var(--bg-dark);
    color: var(--text-light);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    direction: rtl;
    text-align: right;
}

img,
svg {
    max-width: 100%;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Glassmorphism Styles */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Header & Navigation */
.navbar-modern {
    background: rgba(15, 23, 42, 0.8) !important;
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--glass-border);
    padding: 15px 0;
}
.navbar-modern .navbar-brand {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-light) !important;
    background: linear-gradient(45deg, #8e99f3, #26a69a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
}
.navbar-modern .nav-link {
    color: var(--text-muted) !important;
    font-weight: 500;
    margin: 0 10px;
    transition: var(--transition);
}
.navbar-modern .nav-link:hover, 
.navbar-modern .nav-link.active {
    color: var(--text-light) !important;
    transform: translateY(-2px);
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    flex: 0 0 280px;
    background: var(--bg-card-dark);
    border-left: 1px solid var(--glass-border);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.sidebar-content {
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.sidebar-header {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 20px;
    text-align: center;
}

.sidebar-toggle {
    width: 42px;
    height: 42px;
    border: 1px solid var(--glass-border);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-light);
}

.sidebar-logo {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 18px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-item a:hover,
.sidebar-item.active a {
    color: var(--text-light);
    background: rgba(92, 107, 192, 0.15);
    border-right: 4px solid var(--primary-light);
}

.sidebar-item i {
    font-size: 18px;
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 40px;
    background-color: var(--bg-dark);
}

/* Landing Page Hero */
.hero-section {
    padding: 120px 0 80px 0;
    text-align: center;
    position: relative;
}
.hero-title {
    font-size: 54px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-subtitle {
    color: var(--text-muted);
    font-size: 20px;
    max-width: 700px;
    margin: 0 auto 40px auto;
}

/* Buttons */
.btn-modern {
    padding: 12px 28px;
    border-radius: 12px;
    font-weight: 600;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.btn-modern-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(92, 107, 192, 0.4);
}
.btn-modern-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(92, 107, 192, 0.6);
    color: white;
}
.btn-modern-secondary {
    background: linear-gradient(135deg, var(--secondary), #00796b);
    color: white;
    box-shadow: 0 4px 15px rgba(38, 166, 154, 0.4);
}
.btn-modern-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(38, 166, 154, 0.6);
    color: white;
}
.btn-modern-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-light);
}
.btn-modern-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

/* Page headings and responsive data controls */
.page-heading-actions {
    flex: 0 0 auto;
}

.page-heading-button {
    white-space: nowrap;
}

.parents-search-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.parents-search-field {
    width: min(280px, 100%);
}

.parents-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.parents-table {
    min-width: 1040px;
    margin-bottom: 0;
    background: transparent;
}

.parents-table th {
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    border-color: rgba(255, 255, 255, 0.08);
}

.parents-table td {
    padding-block: 14px;
    border-color: rgba(255, 255, 255, 0.06);
}

.account-chip,
.credential-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid #334155;
    border-radius: 10px;
    background: #0f172a;
    white-space: nowrap;
}

.account-chip {
    color: #38bdf8;
    font-family: monospace;
    font-size: 14px;
    font-weight: 700;
}

.account-chip i {
    font-size: 12px;
}

.children-editor {
    width: 220px;
    max-width: 100%;
}

.account-status {
    padding: 7px 10px;
    font-size: 13px;
    white-space: nowrap;
}

.parents-row-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.parents-row-actions form {
    margin: 0;
}

.action-button {
    min-height: 34px;
    padding: 6px 9px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

/* Cards & Stats */
.stat-card {
    padding: 24px;
    transition: var(--transition);
}
.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-light);
}
.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: rgba(92, 107, 192, 0.15);
    color: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 20px;
}

/* Subscriptions & Pricing */
.pricing-card {
    padding: 40px 30px;
    text-align: center;
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.pricing-card.popular {
    border: 2px solid var(--primary);
    position: relative;
}
.pricing-badge {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 4px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}
.price-value {
    font-size: 42px;
    font-weight: 800;
    margin: 20px 0;
    color: white;
}
.price-value span {
    font-size: 16px;
    color: var(--text-muted);
}

/* Forms & Inputs */
.form-group-modern {
    margin-bottom: 20px;
}
.form-label-modern {
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
}
.form-control-modern {
    width: 100%;
    min-width: 0;
    background: rgba(15, 23, 42, 0.5) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px !important;
    color: var(--text-light) !important;
    padding: 14px 18px !important;
    transition: var(--transition) !important;
    text-align: right;
}
.form-control-modern:focus {
    border-color: var(--primary-light) !important;
    box-shadow: 0 0 0 3px rgba(92, 107, 192, 0.25) !important;
}

/* Alerts */
.alert-modern {
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: var(--bg-card-dark);
    color: var(--text-light);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Leaflet Map integration */
#map {
    height: 400px;
    max-height: 58vh;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    margin-bottom: 20px;
    z-index: 1;
}

/* Modal Styling */
.modal-content-modern {
    background: var(--bg-card-dark);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
}
.modal-header-modern {
    border-bottom: 1px solid var(--glass-border);
}
.modal-footer-modern {
    border-top: 1px solid var(--glass-border);
}

/* Slip Print Styling */
.print-slips-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 20px;
}

.parent-slip {
    background: white;
    color: #334155;
    border: 2px dashed #94a3b8;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    box-sizing: border-box;
    font-family: var(--font-ar);
}

.parent-slip-header {
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.parent-slip-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

.parent-slip-school {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

.parent-slip-row {
    margin-bottom: 8px;
    font-size: 14px;
}

.parent-slip-label {
    font-weight: 700;
    color: #475569;
    display: inline-block;
    width: 100px;
}

.parent-slip-value {
    color: #0f172a;
    font-family: monospace;
    font-size: 15px;
}

.parent-slip-footer {
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
    margin-top: 15px;
    font-size: 12px;
    color: #64748b;
    text-align: center;
}

@media (max-width: 991.98px) {
    .dashboard-container {
        display: block;
    }

    .sidebar {
        position: sticky;
        top: 0;
        z-index: 1030;
        width: 100%;
        padding: 10px 16px;
        border-left: 0;
        border-bottom: 1px solid var(--glass-border);
        box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
    }

    .sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin: 0;
        padding: 0;
        border: 0;
    }

    .sidebar-logo {
        font-size: 23px;
    }

    .sidebar-content {
        max-height: calc(100vh - 64px);
        overflow-y: auto;
        padding-top: 12px;
    }

    .sidebar-content.show {
        display: flex;
    }

    .sidebar-menu {
        gap: 5px;
    }

    .sidebar-item a {
        padding: 11px 13px;
    }

    .sidebar-account {
        margin-top: 12px !important;
        padding-top: 14px !important;
    }

    .main-content {
        width: 100%;
        padding: 24px;
    }

    .table-responsive {
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 767.98px) {
    .main-content {
        padding: 18px 14px 28px;
    }

    .page-heading {
        align-items: stretch !important;
        flex-direction: column;
    }

    .page-heading h2,
    .main-content h2 {
        font-size: clamp(1.35rem, 7vw, 1.75rem);
        line-height: 1.35;
    }

    .page-heading-button {
        width: 100%;
        justify-content: center;
    }

    .glass-panel {
        border-radius: 14px;
    }

    .parents-list-card {
        padding: 16px !important;
    }

    .parents-search-form {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        width: 100%;
    }

    .parents-search-field {
        width: 100%;
        grid-column: 1 / -1;
    }

    .parents-search-form .search-action-button {
        justify-content: center;
        padding-inline: 16px !important;
    }

    .parents-search-form:not(.has-cancel) .search-action-button {
        grid-column: 1 / -1;
    }

    .parents-table-wrap {
        overflow: visible;
    }

    .parents-table,
    .parents-table tbody {
        display: block;
        min-width: 0;
        width: 100%;
    }

    .parents-table thead {
        display: none;
    }

    .parents-table tr {
        display: block;
        margin-bottom: 14px;
        padding: 4px 14px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 14px;
        background: rgba(15, 23, 42, 0.62);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    }

    .parents-table tr:last-child {
        margin-bottom: 0;
    }

    .parents-table td {
        display: grid;
        grid-template-columns: 108px minmax(0, 1fr);
        align-items: center;
        gap: 12px;
        width: 100%;
        padding: 12px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    }

    .parents-table td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 12px;
        font-weight: 700;
    }

    .parents-table td:last-child {
        border-bottom: 0;
    }

    .parents-table .empty-state-cell {
        display: block;
        padding: 24px 8px !important;
        border: 0;
    }

    .parents-table .empty-state-cell::before {
        content: none;
    }

    .account-chip,
    .credential-chip,
    .account-status {
        max-width: 100%;
        justify-self: start;
    }

    .children-editor {
        width: 100%;
    }

    .parents-actions-cell {
        display: block !important;
    }

    .parents-actions-cell::before {
        display: block;
        margin-bottom: 9px;
    }

    .parents-row-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        white-space: normal;
    }

    .parents-row-actions form,
    .parents-row-actions .action-button {
        width: 100%;
    }

    .parents-row-actions form:only-child {
        grid-column: 1 / -1;
    }

    .btn-modern {
        padding: 10px 16px;
    }

    .navbar-modern .navbar-collapse .d-flex {
        flex-direction: column;
    }

    .navbar-modern .navbar-collapse .btn {
        width: 100%;
        justify-content: center;
    }

    .hero-section {
        padding: 72px 0 48px;
    }

    .hero-title {
        font-size: clamp(2rem, 10vw, 3rem);
    }

    .hero-subtitle {
        font-size: 1rem;
        padding-inline: 10px;
    }

    #map {
        height: 320px;
    }
}

@media (max-width: 379.98px) {
    .main-content {
        padding-inline: 10px;
    }

    .parents-table tr {
        padding-inline: 11px;
    }

    .parents-table td {
        grid-template-columns: 92px minmax(0, 1fr);
        gap: 8px;
    }

    .parents-row-actions {
        grid-template-columns: 1fr;
    }

    .parents-row-actions form,
    .parents-row-actions form:only-child {
        grid-column: 1;
    }
}

@media print {
    @page {
        margin: 10mm;
        size: A4 portrait;
    }
    
    html, body {
        background: #ffffff !important;
        background-color: #ffffff !important;
        color: #000000 !important;
        margin: 0 !important;
        padding: 0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .dashboard-container, 
    .main-content {
        background: #ffffff !important;
        background-color: #ffffff !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
        min-height: auto !important;
    }

    .no-print, 
    nav, 
    header, 
    footer, 
    aside, 
    .sidebar {
        display: none !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .print-slips-container {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
        padding: 0 !important;
        margin: 0 !important;
        background: #ffffff !important;
    }

    .parent-slip {
        border: 2px dashed #333333 !important;
        border-radius: 8px !important;
        background: #ffffff !important;
        background-color: #ffffff !important;
        color: #000000 !important;
        padding: 15px !important;
        box-shadow: none !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .parent-slip-header {
        border-bottom: 1px solid #dddddd !important;
    }

    .parent-slip-title {
        color: #000000 !important;
        font-weight: 700 !important;
    }

    .parent-slip-school {
        color: #333333 !important;
    }

    .parent-slip-label {
        color: #222222 !important;
    }

    .parent-slip-value {
        color: #000000 !important;
    }

    .parent-slip-footer {
        color: #444444 !important;
        border-top: 1px solid #dddddd !important;
    }
}
