/* =========================================================
   AI INNOVATIONS EDUNOTE ECD V1
   PROFESSIONAL MASTER STYLESHEET
   ========================================================= */

:root {
    --primary: #356ae6;
    --primary-dark: #244fc1;
    --primary-soft: #eaf0ff;

    --secondary: #58b88b;
    --secondary-dark: #3f946d;
    --secondary-soft: #e8f7f0;

    --accent-yellow: #f4c95d;
    --accent-orange: #f29d62;
    --accent-purple: #9b7ede;

    --sidebar: #0d1b34;
    --sidebar-soft: #142846;
    --sidebar-hover: #1e3d67;

    --background: #edf2f7;
    --surface: #ffffff;
    --surface-soft: #f8fafc;

    --text: #182235;
    --text-secondary: #4f5d73;
    --text-muted: #7d8999;

    --border: #d9e1ea;
    --border-dark: #c8d2de;

    --success: #2f9e68;
    --success-soft: #e4f6ed;

    --warning: #d58b26;
    --warning-soft: #fff3d9;

    --danger: #d64d4d;
    --danger-soft: #fde8e8;

    --info: #356ae6;
    --info-soft: #eaf0ff;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;

    --shadow-sm: 0 3px 12px rgba(18, 35, 58, 0.06);
    --shadow-md: 0 8px 24px rgba(18, 35, 58, 0.09);
    --shadow-lg: 0 18px 40px rgba(18, 35, 58, 0.14);
}

/* =========================================================
   GLOBAL
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--background);
    color: var(--text);
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

/* =========================================================
   APPLICATION LAYOUT
   ========================================================= */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1000;

    width: 260px;
    height: 100vh;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    color: #ffffff;
    background:
        linear-gradient(
            180deg,
            var(--sidebar) 0%,
            #0a1529 100%
        );
}

.sidebar-brand {
    flex: 0 0 auto;

    min-height: 86px;
    padding: 20px 22px;

    display: flex;
    align-items: center;
    gap: 13px;

    border-bottom: 1px solid rgba(255,255,255,0.12);
}

.brand-mark {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 14px;

    color: #ffffff;
    font-size: 20px;

    background:
        linear-gradient(
            135deg,
            #4c80ef,
            #2f5bc7
        );

    box-shadow: 0 8px 20px rgba(42, 101, 220, 0.35);
}

.brand-title {
    font-size: 21px;
    line-height: 1.1;
    font-weight: 800;
}

.brand-subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: #c7d6ea;
}

.sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;

    display: flex;
    flex-direction: column;
    gap: 4px;

    padding: 13px 14px;

    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(255,255,255,0.22);
}

.sidebar-nav a,
.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 11px;

    padding: 10px 13px;

    border-radius: 9px;

    color: #eaf1fb !important;
    text-decoration: none !important;

    font-size: 14px;
    font-weight: 600;

    transition:
        background 0.18s ease,
        transform 0.18s ease,
        color 0.18s ease;
}

.sidebar-nav a:hover,
.sidebar-footer a:hover {
    color: #ffffff !important;
    background: var(--sidebar-hover);
    transform: translateX(3px);
}

.sidebar-nav a i,
.sidebar-footer a i {
    width: 19px;
    flex: 0 0 19px;

    text-align: center;
    font-size: 15px;
}

.sidebar-footer {
    flex: 0 0 auto;
    padding: 10px 14px 14px;

    border-top: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.08);
}

.main-area {
    width: calc(100% - 260px);
    min-height: 100vh;
    margin-left: 260px;
}

.main-header {
    min-height: 72px;

    padding: 15px 30px;

    display: flex;
    align-items: center;

    border-bottom: 1px solid var(--border);
    background: var(--surface);

    box-shadow: var(--shadow-sm);
}

.main-header strong {
    display: block;
    font-size: 16px;
    color: var(--text);
}

.main-header span {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

.container {
    width: 100%;
    max-width: 1500px;

    margin: 0 auto;
    padding: 28px 30px 40px;
}

/* =========================================================
   HEADERS AND BRANDING
   ========================================================= */

.page-header {
    margin-bottom: 22px;

    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.page-header h1 {
    margin: 0 0 7px;

    font-size: 30px;
    line-height: 1.15;
    font-weight: 800;

    color: var(--text);
}

.page-header p {
    margin: 0;
    line-height: 1.55;
    color: var(--text-secondary);
}

.dashboard-centre-header {
    display: flex;
    align-items: center;
    gap: 18px;

    margin-bottom: 24px;
    padding: 18px 22px;

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.dashboard-centre-logo {
    width: 78px;
    height: 78px;
    flex: 0 0 78px;

    padding: 5px;

    border: 1px solid var(--border);
    border-radius: 14px;

    object-fit: contain;
    background: #ffffff;
}

.dashboard-centre-name {
    margin: 0 0 5px;
    font-size: 26px;
    font-weight: 800;
}

.dashboard-centre-subtitle {
    margin: 0;
    color: var(--text-secondary);
}

/* =========================================================
   CARDS
   ========================================================= */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));

    gap: 18px;
    margin-bottom: 22px;
    align-items: stretch;
}

.card {
    width: 100%;
    min-width: 0;

    margin-bottom: 22px;
    padding: 22px;

    overflow-wrap: anywhere;

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    background: var(--surface);
    box-shadow: var(--shadow-sm);

    transition:
        box-shadow 0.18s ease,
        transform 0.18s ease;
}

.card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.card h2 {
    margin: 0 0 16px;

    display: flex;
    align-items: center;
    gap: 10px;

    font-size: 21px;
    line-height: 1.25;
    color: var(--text);
}

.card h2 i {
    color: var(--primary);
}

.card p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-icon {
    width: 52px;
    height: 52px;

    margin-bottom: 16px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 14px;

    color: #ffffff;
    font-size: 20px;

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--primary-dark)
        );

    box-shadow: 0 8px 18px rgba(53,106,230,0.28);
}

.stat-value {
    margin-bottom: 7px;

    font-size: 38px;
    line-height: 1;
    font-weight: 800;

    color: var(--text);
}

.stat-title {
    font-size: 14px;
    color: var(--text-secondary);
}

/* =========================================================
   BUTTONS
   ========================================================= */

.actions,
.form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 11px;
}

.actions {
    margin-top: 15px;
}

.form-actions {
    align-self: end;
}

.button,
.btn-primary,
.btn-small,
.btn-secondary {
    border: 0;
    border-radius: 9px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    text-decoration: none !important;
    font-weight: 700;

    transition:
        background 0.18s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

.button,
.btn-primary {
    min-height: 42px;
    padding: 10px 16px;

    color: #ffffff !important;
    background: var(--primary);
}

.btn-small {
    min-height: 32px;
    margin: 2px;
    padding: 6px 10px;

    color: #ffffff !important;
    background: var(--primary);
    font-size: 12px;
}

.btn-secondary {
    min-height: 42px;
    padding: 10px 16px;

    color: var(--text) !important;
    border: 1px solid var(--border-dark);
    background: #ffffff;
}

.button:hover,
.btn-primary:hover,
.btn-small:hover {
    transform: translateY(-1px);
    background: var(--primary-dark);
    box-shadow: 0 6px 15px rgba(53,106,230,0.22);
}

.btn-secondary:hover {
    background: var(--primary-soft);
}

/* =========================================================
   TABLES
   ========================================================= */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.data-table,
table {
    width: 100%;

    margin-top: 16px;

    border-collapse: collapse;
    overflow: hidden;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    background: var(--surface);
}

th,
td {
    padding: 12px 13px;

    border-bottom: 1px solid var(--border);

    text-align: left;
    vertical-align: top;

    font-size: 13px;
    line-height: 1.45;
}

th {
    color: #334057;
    font-weight: 800;
    background: #f5f8fc;
}

tbody tr:hover {
    background: #fafcff;
}

/* =========================================================
   FORM CONTROLS
   ========================================================= */

label {
    color: #344158;
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-width: 0;

    padding: 10px 11px;

    border: 1px solid var(--border-dark);
    border-radius: 8px;

    color: var(--text);
    background: #ffffff;

    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

textarea {
    min-height: 82px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #99a4b5;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;

    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(53,106,230,0.12);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 17px 20px;
    align-items: start;
}

.form-grid > div {
    min-width: 0;
}

.form-grid > div > label {
    display: block;
    margin-bottom: 7px;
}

/* =========================================================
   CHILD AND PARENT FORMS
   ========================================================= */

.child-form {
    width: 100%;
    max-width: 100%;
}

.child-form .card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 20px;
}

.child-form .card h2 {
    padding-bottom: 12px;
    margin-bottom: 16px;

    border-bottom: 1px solid var(--border);

    font-size: 19px;
}

.child-form .form-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;

    gap: 18px 20px !important;
    align-items: start !important;
}

.child-form .form-grid > div {
    width: 100%;
    min-width: 0;
}

.child-form .form-grid > div > label {
    display: block;
    margin-bottom: 7px;
}

.child-form .form-grid input,
.child-form .form-grid select,
.child-form .form-grid textarea {
    width: 100% !important;
    min-width: 0;
}

.child-form .form-grid textarea {
    min-height: 96px;
}

/* =========================================================
   CONSENT / PERMISSION GRID
   ========================================================= */

.child-form .consent-grid,
.consent-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;

    width: 100%;
    max-width: 100%;

    overflow: hidden;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    background: #ffffff;
}

.child-form .consent-grid .checkbox-row,
.consent-grid .checkbox-row {
    min-height: 68px;
    margin: 0 !important;
    padding: 16px 20px;

    display: flex !important;
    align-items: center !important;
    gap: 14px;

    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);

    color: var(--text);
    font-size: 15px;
    font-weight: 700;

    background: #ffffff;
    cursor: pointer;
}

.child-form .consent-grid .checkbox-row:nth-child(2n),
.consent-grid .checkbox-row:nth-child(2n) {
    border-right: 0;
}

.child-form .consent-grid .checkbox-row:nth-last-child(-n + 2),
.consent-grid .checkbox-row:nth-last-child(-n + 2) {
    border-bottom: 0;
}

.child-form .consent-grid .checkbox-row:hover,
.consent-grid .checkbox-row:hover {
    background: #f8fbff;
}

.child-form .consent-grid .checkbox-row input[type="checkbox"],
.consent-grid .checkbox-row input[type="checkbox"] {
    width: 21px !important;
    height: 21px !important;
    min-width: 21px !important;
    flex: 0 0 21px;

    margin: 0 !important;
    padding: 0 !important;

    accent-color: var(--primary);
}

/* =========================================================
   LINKED CHILD CARDS
   ========================================================= */

.linked-children-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 16px;

    width: 100%;
    max-width: 100%;
}

.linked-child-card {
    width: 100%;
    min-width: 0;

    display: flex;
    align-items: flex-start;
    gap: 14px;

    padding: 18px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: #ffffff;
    cursor: pointer;

    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.18s ease;
}

.linked-child-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 20px rgba(37,99,235,0.10);
    transform: translateY(-1px);
}

.linked-child-card input[type="checkbox"] {
    width: 21px !important;
    height: 21px !important;
    min-width: 21px;

    margin: 2px 0 0 !important;

    accent-color: var(--primary);
}

.linked-child-content {
    flex: 1;
    min-width: 0;
}

.linked-child-name {
    margin-bottom: 8px;

    font-size: 17px;
    font-weight: 800;
    color: var(--text);
}

.linked-child-meta {
    display: grid;
    gap: 5px;

    font-size: 13px;
    color: var(--text-secondary);
}

.linked-child-alerts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;

    margin-top: 10px;
}

/* =========================================================
   ALERTS
   ========================================================= */

.alert-success,
.alert-error,
.alert-warning,
.alert-info,
.error {
    margin-bottom: 18px;
    padding: 13px 16px;

    border-radius: 10px;

    line-height: 1.45;
}

.alert-success {
    color: #17633f;
    border: 1px solid #bce7d0;
    background: var(--success-soft);
}

.alert-error,
.error {
    color: #8b2929;
    border: 1px solid #f3c0c0;
    background: var(--danger-soft);
}

.alert-warning {
    color: #80500f;
    border: 1px solid #f2d592;
    background: var(--warning-soft);
}

.alert-info {
    color: #244fad;
    border: 1px solid #c5d5fa;
    background: var(--info-soft);
}

/* =========================================================
   BADGES
   ========================================================= */

.badge {
    display: inline-block;

    padding: 5px 9px;

    border-radius: 999px;

    color: #3e4858;
    background: #e8edf3;

    font-size: 11px;
    font-weight: 800;
}

.badge-success {
    color: #17633f;
    background: var(--success-soft);
}

.badge-danger {
    color: #8b2929;
    background: var(--danger-soft);
}

.badge-warning {
    color: #80500f;
    background: var(--warning-soft);
}

.badge-info {
    color: #244fad;
    background: var(--info-soft);
}

/* =========================================================
   LOGIN
   ========================================================= */

.login-body {
    min-height: 100vh;
    padding: 20px;

    display: flex;
    align-items: center;
    justify-content: center;

    background:
        linear-gradient(
            135deg,
            #eef4ff,
            #f3fbf7
        );
}

.login-card {
    width: 100%;
    max-width: 400px;

    padding: 34px;

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.login-card h1 {
    margin-top: 0;
    color: var(--primary-dark);
}

.login-card label {
    display: block;
    margin-top: 15px;
    margin-bottom: 6px;
}

.login-card button {
    width: 100%;
    min-height: 44px;

    margin-top: 20px;

    border: 0;
    border-radius: 9px;

    color: #ffffff;
    font-weight: 800;

    background: var(--primary);
}

/* =========================================================
   PROFILE AND LEGACY CARDS
   ========================================================= */

.form-card,
.profile-card {
    width: 100%;
    max-width: 900px;

    padding: 24px;

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.form-card label {
    display: block;
    margin-top: 15px;
    margin-bottom: 6px;
}

.form-card button {
    min-height: 42px;
    margin-top: 20px;
    padding: 10px 16px;

    border: 0;
    border-radius: 9px;

    color: #ffffff;
    font-weight: 700;

    background: var(--primary);
}

.cancel-link {
    margin-left: 12px;
}

.section-title {
    margin-top: 32px;
}

/* =========================================================
   CHART
   ========================================================= */

.chart-container {
    position: relative;

    width: 100%;
    height: 420px;
}

.chart-container canvas {
    max-height: 420px;
}

/* =========================================================
   EMPTY STATE
   ========================================================= */

.empty-state {
    padding: 45px 20px;

    text-align: center;
    color: var(--text-secondary);
}

.empty-state i {
    margin-bottom: 14px;

    color: var(--primary);
    font-size: 38px;
}

.empty-state h3 {
    margin: 0 0 8px;
    color: var(--text);
}

/* =========================================================
   DOCUMENT / LOGO HOOKS
   ========================================================= */

.document-header {
    display: flex;
    align-items: center;
    gap: 16px;

    margin-bottom: 22px;
    padding-bottom: 16px;

    border-bottom: 2px solid var(--primary-soft);
}

.document-logo {
    width: 72px;
    height: 72px;

    padding: 4px;

    border: 1px solid var(--border);
    border-radius: 12px;

    object-fit: contain;
    background: #ffffff;
}

.document-header-text h1,
.document-header-text h2 {
    margin: 0 0 5px;
}

.document-header-text p {
    margin: 0;
    color: var(--text-secondary);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1100px) {
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
    }

    .app-shell {
        flex-direction: column;
    }

    .main-area {
        width: 100%;
        margin-left: 0;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        overflow: visible;
    }

    .sidebar-nav a {
        flex: 1 1 210px;
    }

    .container {
        padding: 24px;
    }
}

@media (max-width: 800px) {
    .page-header {
        flex-direction: column;
    }

    .cards,
    .form-grid,
    .child-form .form-grid,
    .child-form .consent-grid,
    .consent-grid,
    .linked-children-grid {
        grid-template-columns: 1fr !important;
    }

    .child-form .consent-grid .checkbox-row,
    .consent-grid .checkbox-row {
        border-right: 0 !important;
        border-bottom: 1px solid var(--border) !important;
    }

    .child-form .consent-grid .checkbox-row:last-child,
    .consent-grid .checkbox-row:last-child {
        border-bottom: 0 !important;
    }

    .table-wrapper {
        overflow-x: auto;
    }
}

@media (max-width: 700px) {
    .container {
        padding: 17px;
    }

    .main-header {
        padding: 14px 18px;
    }

    .page-header h1 {
        font-size: 25px;
    }

    .dashboard-centre-header {
        align-items: flex-start;
    }

    .dashboard-centre-logo {
        width: 62px;
        height: 62px;
        flex-basis: 62px;
    }

    .data-table,
    table {
        min-width: 720px;
    }

    .card {
        padding: 18px;
    }
}