/* Base soft card (neumorphic style) */
.smaio-card {
    background: #f7f8fb;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    box-shadow:
        8px 8px 16px rgba(15, 23, 42, 0.12),
        -6px -6px 12px rgba(255, 255, 255, 0.9);
}

/* Generic wrapper for single forms like login */
.smaio-form-wrapper {
    max-width: 800px;
    margin: 28px auto;
    padding: 22px 26px;
    box-sizing: border-box;
}

/* Headings */
.smaio-form-wrapper h2,
.smaio-form-wrapper h3,
.smaio-form-wrapper h4,
.smaio-teacher-dashboard h2 {
    margin-top: 0;
    color: #111827;
    font-weight: 600;
}

.smaio-subtitle {
    color: #6b7280;
    margin-top: -4px;
    margin-bottom: 16px;
}

/* Inner form */
.smaio-form-inner {
    margin-top: 8px;
}

/* Inputs & selects */
.smaio-form-wrapper input[type="text"],
.smaio-form-wrapper input[type="password"],
.smaio-form-wrapper input[type="number"],
.smaio-form-wrapper input[type="date"],
.smaio-form-wrapper select,
.smaio-parent-page input[type="text"],
.smaio-parent-page input[type="number"],
.smaio-parent-page input[type="date"],
.smaio-parent-page select {
    width: 100%;
    max-width: 320px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    box-sizing: border-box;
    font-size: 14px;
    background: #f9fafb;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.smaio-form-wrapper input:focus,
.smaio-form-wrapper select:focus,
.smaio-parent-page input:focus,
.smaio-parent-page select:focus {
    outline: none;
    border-color: #2563eb;
    background-color: #ffffff;
    box-shadow: 0 0 0 1px #2563eb33;
}

/* Buttons */
.smaio-btn-primary,
.smaio-form-wrapper button {
    background: #2563eb;
    color: #ffffff;
    border: none;
    padding: 8px 18px;
    cursor: pointer;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    display: inline-block;
    transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

.smaio-btn-primary:hover,
.smaio-form-wrapper button:hover {
    background: #1d4ed8;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

.smaio-btn-secondary {
    background: #eef1f7;
    color: #111827;
    border: 1px solid #d1d5db;
    padding: 7px 16px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    display: inline-block;
}

.smaio-btn-secondary:hover {
    background: #e0e4ee;
}

/* Alerts */
.smaio-error {
    background: #fef2f2;
    color: #b91c1c;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #fecaca;
    margin-top: 8px;
    font-size: 13px;
}

.smaio-success {
    background: #ecfdf3;
    color: #166534;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #bbf7d0;
    margin-bottom: 10px;
    font-size: 13px;
}

/* Tables */
.smaio-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 13px;
}

.smaio-table th,
.smaio-table td {
    border: 1px solid #e5e7eb;
    padding: 6px 8px;
    text-align: left;
}

.smaio-table th {
    background: #f3f4f6;
    font-weight: 600;
    color: #374151;
}

.smaio-table-wrap {
    overflow-x: auto;
}

/* =========================================================
   TEACHER DASHBOARD (Tabs UI) — v1.7.0
   =======================================================*/

.smaio-teacher-dashboard {
    max-width: 1100px;
    margin: 30px auto;
    padding: 0 12px 24px;
}

.smaio-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f2f4fa;
    padding: 12px 16px;
    border-radius: 18px;
    border: 1px solid #e5e7eb;
    box-shadow:
        8px 8px 16px rgba(15, 23, 42, 0.12),
        -6px -6px 12px rgba(255, 255, 255, 0.9);
    margin-bottom: 14px;
}

.smaio-page-header h2 {
    margin: 0 0 4px;
    color: #111827;
}

.smaio-page-header .smaio-subtitle {
    margin: 0;
    color: #6b7280;
}

/* Nav buttons */
.smaio-teacher-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0 14px;
}

.smaio-teacher-nav button {
    border: 1px solid #d1d5db;
    background: #f8fafc;
    color: #111827;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.smaio-teacher-nav button:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.smaio-teacher-nav button.is-active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

.smaio-teacher-panels {
    margin-top: 8px;
}

.smaio-teacher-panel {
    display: none;
}

.smaio-teacher-panel.is-active {
    display: block;
}

/* panel card */
.smaio-teacher-panel .smaio-teacher-section {
    padding: 14px 16px;
}

/* =========================================================
   Form rows & cols
   =======================================================*/
.smaio-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-bottom: 6px;
}

.smaio-form-col {
    flex: 1 1 180px;
}

/* Badges & highlights */
.smaio-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #075985;
    font-weight: 500;
    font-size: 12px;
}

.smaio-highlight-percentage {
    font-size: 20px;
    font-weight: 600;
    color: #166534;
}

/* Chips for attendance summary */
.smaio-chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 6px;
    margin-bottom: 4px;
}
.smaio-chip-present { background: #dbeafe; color: #1d4ed8; }
.smaio-chip-absent  { background: #fee2e2; color: #b91c1c; }
.smaio-chip-leave   { background: #fef9c3; color: #854d0e; }
.smaio-chip-sunday  { background: #dcfce7; color: #166534; }

/* Card icons */
.smaio-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-right: 6px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.25);
}
.smaio-icon-filter { background: linear-gradient(135deg, #0ea5e9, #38bdf8); }
.smaio-icon-attendance { background: linear-gradient(135deg, #22c55e, #16a34a); }
.smaio-icon-fee { background: linear-gradient(135deg, #f97316, #ea580c); }
.smaio-icon-result { background: linear-gradient(135deg, #6366f1, #4f46e5); }

/* =========================================================
   PARENT LOOKUP PAGE
   =======================================================*/

.smaio-parent-page {
    max-width: 1100px;
    margin: 26px auto 32px;
    padding: 0 12px 18px;
}

/* Top bar */
.smaio-parent-topbar { margin-bottom: 12px; }

.smaio-parent-topbar-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 14px;
    background: #f1f3fb;
    border: 1px solid #e5e7eb;
    box-shadow:
        6px 6px 14px rgba(15, 23, 42, 0.08),
        -4px -4px 10px rgba(255, 255, 255, 0.95);
}

.smaio-parent-logo-wrap img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    background: #fff;
}

.smaio-parent-logo-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e5e7eb;
    color: #111827;
    font-weight: 700;
    font-size: 16px;
}

.smaio-parent-school-meta { display: flex; flex-direction: column; }
.smaio-parent-school-name { font-size: 16px; font-weight: 600; color: #111827; }
.smaio-parent-school-tagline { font-size: 12px; color: #6b7280; }

.smaio-parent-page h2 {
    margin: 8px 0 16px;
    font-size: 20px;
    color: #111827;
    font-weight: 600;
}

/* Grid */
.smaio-parent-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.smaio-parent-card { padding: 14px 16px; }

.smaio-parent-card h3 {
    margin-top: 0;
    margin-bottom: 4px;
    font-size: 15px;
    color: #111827;
    display: flex;
    align-items: center;
}

.smaio-card-desc { margin: 0 0 10px; font-size: 13px; color: #6b7280; }

/* Attendance chart */
.smaio-att-chart {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.smaio-att-day {
    border: 1px solid #e5e7eb;
    background: #ffffff;
    border-radius: 10px;
    padding: 6px 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
}

.smaio-att-day-date { font-size: 11px; color: #374151; white-space: nowrap; }

.smaio-att-day-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    flex: 0 0 10px;
    background: #cbd5e1;
}

.smaio-att-present .smaio-att-day-dot { background: #2563eb; }
.smaio-att-absent  .smaio-att-day-dot { background: #dc2626; }
.smaio-att-leave   .smaio-att-day-dot { background: #ca8a04; }
.smaio-att-sunday  .smaio-att-day-dot { background: #16a34a; }
.smaio-att-not_marked .smaio-att-day-dot { background: #94a3b8; }

.smaio-att-present { border-color: #bfdbfe; background: #eff6ff; }
.smaio-att-absent { border-color: #fecaca; background: #fef2f2; }
.smaio-att-leave { border-color: #fde68a; background: #fffbeb; }
.smaio-att-sunday { border-color: #bbf7d0; background: #f0fdf4; }
.smaio-att-not_marked { border-color: #e5e7eb; background: #ffffff; }

.smaio-att-legend {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    font-size: 12px;
    color: #374151;
}

.smaio-att-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.smaio-att-legend-dot { width: 10px; height: 10px; border-radius: 999px; background: #cbd5e1; }
.smaio-att-legend-item.smaio-att-present .smaio-att-legend-dot { background:#2563eb; }
.smaio-att-legend-item.smaio-att-absent  .smaio-att-legend-dot { background:#dc2626; }
.smaio-att-legend-item.smaio-att-leave   .smaio-att-legend-dot { background:#ca8a04; }
.smaio-att-legend-item.smaio-att-sunday  .smaio-att-legend-dot { background:#16a34a; }

/* Pagination */
.smaio-pagination-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}
.smaio-pagination-info { font-size: 12px; color: #6b7280; }

.smaio-inline-print-form { margin: 6px 0 8px; }

/* Fix fee tables on small screens */
.smaio-parent-card-fee .smaio-table th,
.smaio-parent-card-fee .smaio-table td,
.smaio-parent-print-page .smaio-table th,
.smaio-parent-print-page .smaio-table td {
    white-space: nowrap;
}

/* =========================================================
   Teacher Monthly Attendance Sheet Print (A4 Landscape)
   =======================================================*/

.smaio-month-sheet {
    max-width: 1100px;
    margin: 20px auto;
    padding: 0 12px 20px;
}

.smaio-month-sheet .smaio-sheet-meta {
    margin: 10px 0 12px;
    font-size: 13px;
    color: #374151;
}

.smaio-att-sheet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.smaio-att-sheet-table th,
.smaio-att-sheet-table td {
    border: 1px solid #e5e7eb;
    padding: 3px 4px;
    text-align: center;
}

.smaio-att-sheet-table th {
    background: #f3f4f6;
    font-weight: 600;
    color: #111827;
}

.smaio-att-sheet-name {
    text-align: left !important;
    min-width: 160px;
}

.smaio-att-sheet-roll {
    min-width: 55px;
}

.smaio-att-sheet-sunday {
    background: #dcfce7; /* green highlight */
}

.smaio-att-sheet-pagebreak {
    display: none;
}

@media print {
    @page {
        size: A4 landscape;
        margin: 10mm;
    }

    /* repeat header on each page */
    table.smaio-att-sheet-table thead {
        display: table-header-group;
    }
    table.smaio-att-sheet-table tbody {
        display: table-row-group;
    }

    .smaio-att-sheet-pagebreak {
        display: table-row;
        page-break-after: always;
    }
    .smaio-att-sheet-pagebreak td {
        border: 0 !important;
        padding: 0 !important;
        height: 0 !important;
    }

    /* hide nav/site header/footer if theme prints them */
    header, footer, nav { display: none !important; }
}

/* =========================================================
   Responsive tweaks
   =======================================================*/

/* Parent portal: switch to 1 column earlier to avoid cut cards */
@media (max-width: 1024px) {
    .smaio-parent-grid {
        grid-template-columns: 1fr;
    }
    .smaio-att-chart {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Small screens */
@media (max-width: 700px) {
    .smaio-form-wrapper {
        margin: 16px;
        padding: 16px 18px;
    }

    .smaio-parent-page {
        margin: 20px auto 24px;
        padding: 0 6px 16px;
    }

    .smaio-parent-grid {
        gap: 12px;
    }

    .smaio-card {
        border-radius: 14px;
    }

    .smaio-teacher-nav {
        gap: 8px;
    }
    .smaio-teacher-nav button {
        flex: 1 1 auto;
        width: 100%;
        text-align: center;
    }
}