/**
 * Frontend Styles for Student Growth Tracker (Scoped: .sgt-portal-wrapper)
 */

.sgt-portal-wrapper {
    --sgt-primary: #1e40af;
    --sgt-primary-light: #3b82f6;
    --sgt-text-main: #1f2937;
    --sgt-text-muted: #6b7280;
    --sgt-border: #e5e7eb;
    --sgt-bg-card: #ffffff;
    --sgt-bg-light: #f9fafb;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--sgt-text-main);
    line-height: 1.5;
    box-sizing: border-box;
    margin: 20px auto;
    max-width: 1100px;
    padding: 0 16px;
}

.sgt-portal-wrapper *,
.sgt-portal-wrapper *::before,
.sgt-portal-wrapper *::after {
    box-sizing: inherit;
}

/* --- Login Card --- */
.sgt-login-card {
    max-width: 480px;
    margin: 40px auto;
    background: var(--sgt-bg-card);
    border: 1px solid var(--sgt-border);
    border-radius: 12px;
    padding: 36px 32px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

.sgt-login-header {
    text-align: center;
    margin-bottom: 24px;
}
.sgt-login-logo {
    max-height: 70px;
    margin-bottom: 12px;
}
.sgt-school-name {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--sgt-primary);
    margin: 0 0 4px;
}
.sgt-login-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px;
}
.sgt-login-subtitle {
    font-size: 13px;
    color: var(--sgt-text-muted);
    margin: 0;
}

.sgt-login-error {
    background: #fef2f2;
    border-left: 4px solid #ef4444;
    color: #991b1b;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 18px;
}

.sgt-input-group {
    margin-bottom: 18px;
}
.sgt-input-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #374151;
}

.sgt-input-box {
    position: relative;
    display: flex;
    align-items: center;
}
.sgt-input-box .sgt-icon {
    position: absolute;
    left: 12px;
    color: #9ca3af;
    font-size: 18px;
    pointer-events: none;
}
.sgt-input-box input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.sgt-input-box input:focus {
    outline: none;
    border-color: var(--sgt-primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.sgt-toggle-pwd {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
}

.sgt-btn-submit {
    width: 100%;
    background: var(--sgt-primary);
    color: #ffffff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}
.sgt-btn-submit:hover {
    background: #1d4ed8;
}

.sgt-login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: var(--sgt-text-muted);
}
.sgt-hotline-link {
    color: var(--sgt-primary);
    font-weight: 600;
    text-decoration: none;
}

/* --- Dashboard Container --- */
.sgt-dashboard-container {
    display: flex;
    flex-direction: column;
}

.sgt-dashboard-header {
    background: #ffffff;
    border: 1px solid var(--sgt-border);
    border-radius: 12px;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.sgt-student-info {
    display: flex;
    align-items: center;
    gap: 16px;
}
.sgt-student-avatar {
    width: 56px;
    height: 56px;
    background: #eff6ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sgt-primary);
}
.sgt-student-avatar .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
}
.sgt-student-name {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
    color: #111827;
}
.sgt-meta-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.sgt-badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}
.sgt-badge-class { background: #dbeafe; color: #1e40af; }
.sgt-badge-teacher { background: #fef3c7; color: #92400e; }
.sgt-badge-code { background: #f3f4f6; color: #374151; }

.sgt-header-actions {
    display: flex;
    gap: 10px;
}
.sgt-btn-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
}
.sgt-btn-pdf {
    background: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
}
.sgt-btn-pdf:hover { background: #b91c1c; }
.sgt-btn-print {
    background: #f3f4f6;
    color: #1f2937;
    border-color: #d1d5db;
}
.sgt-btn-print:hover { background: #e5e7eb; }
.sgt-btn-logout {
    background: #fee2e2;
    color: #991b1b;
}
.sgt-btn-logout:hover { background: #fecaca; }

.sgt-info-strip {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
    font-size: 13px;
}
.sgt-strip-label { color: var(--sgt-text-muted); }
.sgt-strip-val { font-weight: 600; margin-left: 4px; color: #1e293b; }

/* Cards & Layout */
.sgt-card {
    background: #ffffff;
    border: 1px solid var(--sgt-border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.sgt-mb-24 { margin-bottom: 24px; }
.sgt-card-title {
    margin: 0 0 20px;
    font-size: 17px;
    font-weight: 700;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 12px;
}
.sgt-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sgt-grid-2-equal {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
@media (max-width: 800px) {
    .sgt-grid-2-equal { grid-template-columns: 1fr; }
}

.sgt-radar-container {
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
}
.sgt-radar-svg { width: 100%; height: auto; }
.sgt-radar-label { font-size: 10px; font-weight: 600; fill: #4b5563; }

.sgt-sub-card {
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}
.sgt-box-subtitle {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}
.sgt-needs-list {
    margin: 0;
    padding-left: 0;
    list-style: none;
    font-size: 13px;
}
.sgt-needs-list li { margin-bottom: 6px; }
.sgt-goal-text { margin: 0; font-size: 13px; line-height: 1.6; color: #374151; }

/* Month Navigation */
.sgt-fe-month-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 8px;
}
.sgt-fe-month-tab-btn {
    flex: 1;
    min-width: 80px;
    padding: 10px 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.15s;
    position: relative;
}
.sgt-fe-month-tab-btn:hover { background: #f3f4f6; }
.sgt-fe-month-tab-btn.active {
    background: var(--sgt-primary);
    border-color: var(--sgt-primary);
    color: #ffffff;
}
.sgt-tab-num { font-size: 14px; font-weight: 700; }
.sgt-tab-label { font-size: 11px; }
.sgt-tab-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
}
.sgt-fe-month-tab-btn.active .sgt-tab-dot { background: #ffffff; }

/* Quantitative Scores List */
.sgt-criteria-list { display: flex; flex-direction: column; gap: 12px; }
.sgt-criteria-row {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 6px;
    gap: 14px;
    flex-wrap: wrap;
}
.sgt-criteria-name {
    width: 220px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}
.sgt-criteria-bar-box { flex: 1; min-width: 150px; }
.sgt-bar-track {
    width: 100%;
    height: 10px;
    background: #e5e7eb;
    border-radius: 5px;
    overflow: hidden;
}
.sgt-bar-fill { height: 100%; border-radius: 5px; transition: width 0.4s ease; }
.sgt-criteria-score { width: 170px; text-align: right; }
.sgt-score-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}

/* Colors for score levels */
.score-5 { background: #8b5cf6; color: #ffffff; }
.score-4 { background: #10b981; color: #ffffff; }
.score-3 { background: #3b82f6; color: #ffffff; }
.score-2 { background: #f59e0b; color: #ffffff; }
.score-1 { background: #ef4444; color: #ffffff; }
.score-0 { background: #9ca3af; color: #ffffff; }

/* Qualitative Notes Grid */
.sgt-notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.sgt-note-box {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px;
}
.sgt-note-label { font-size: 12px; font-weight: 700; text-transform: uppercase; display: block; margin-bottom: 4px; }
.sgt-note-content { margin: 0; font-size: 13px; color: #374151; }

.sgt-teacher-remark-card {
    background: #eff6ff;
    border-left: 4px solid var(--sgt-primary);
    padding: 16px 20px;
    border-radius: 0 8px 8px 0;
    margin-top: 16px;
}
.sgt-remark-header {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--sgt-primary);
    margin-bottom: 8px;
    font-size: 14px;
}
.sgt-remark-body { font-size: 13px; line-height: 1.6; color: #1e3a8a; }

/* Parent Feedback */
.sgt-feedback-card { margin-top: 24px; background: #fafafa; }
.sgt-feedback-desc { font-size: 13px; color: var(--sgt-text-muted); margin-bottom: 12px; }
.sgt-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    resize: vertical;
    margin-bottom: 12px;
}
.sgt-btn-feedback {
    background: #059669;
    color: #ffffff;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.sgt-btn-feedback:hover { background: #047857; }
.sgt-feedback-success {
    background: #d1fae5;
    color: #065f46;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 12px;
}

.sgt-empty-month-box {
    text-align: center;
    padding: 40px 20px;
    background: #f9fafb;
    border: 2px dashed #e5e7eb;
    border-radius: 12px;
    color: var(--sgt-text-muted);
}
.sgt-empty-month-box .dashicons { font-size: 36px; width: 36px; height: 36px; margin-bottom: 8px; color: #9ca3af; }
.sgt-empty-month-box h4 { margin: 0 0 6px; font-size: 16px; color: #374151; }
.sgt-empty-month-box p { margin: 0; font-size: 13px; }

/* --- A4 Print Specifics --- */
.sgt-print-only { display: none; }

@media print {
    @page {
        size: A4 portrait;
        margin: 10mm;
    }
    body * { visibility: hidden; }
    #sgt-print-report-container, #sgt-print-report-container * { visibility: visible; }
    #sgt-print-report-container {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 20px;
        background: #ffffff;
        color: #000000;
        font-size: 11pt;
    }
    .sgt-print-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
    .sgt-print-header-left { display: flex; align-items: center; gap: 12px; }
    .sgt-print-logo { max-height: 55px; }
    .sgt-print-school-info h3 { margin: 0; font-size: 13pt; text-transform: uppercase; }
    .sgt-print-school-info p { margin: 2px 0 0; font-size: 9pt; }
    .sgt-print-header-right { text-align: right; }
    .sgt-print-header-right h2 { margin: 0; font-size: 12pt; text-transform: uppercase; }
    .sgt-print-header-right p { margin: 2px 0 0; font-size: 9pt; }
    .sgt-print-divider { border-bottom: 2px solid #000000; margin: 10px 0 14px; }
    
    .sgt-print-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 10pt; }
    .sgt-print-table td, .sgt-print-table th { padding: 4px 6px; border: 1px solid #555555; }
    .sgt-print-matrix th { background: #f0f0f0 !important; font-size: 9pt; text-align: center; }
    .sgt-print-section { margin: 12px 0 6px; font-size: 11pt; text-transform: uppercase; font-weight: bold; }
    
    .sgt-print-signatures { display: flex; justify-content: space-between; margin-top: 30px; text-align: center; }
    .sgt-sig-box { width: 30%; font-size: 9.5pt; }
    .sgt-sig-box p { margin: 2px 0; }
}

/* --- SGT Toast Notifications (Frontend) --- */
.sgt-toast-container {
    position: fixed;
    top: 25px;
    right: 25px;
    z-index: 9999999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 440px;
    width: calc(100vw - 50px);
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.sgt-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 10px;
    background: #ffffff;
    color: #1e293b;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
    border-left: 5px solid #1e40af;
    font-size: 14px;
    line-height: 1.55;
    pointer-events: auto;
    animation: sgtToastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.sgt-toast.sgt-toast-hiding {
    opacity: 0;
    transform: translateX(40px);
}

.sgt-toast-icon {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    flex-shrink: 0;
    margin-top: 2px;
}

.sgt-toast-content {
    flex: 1;
    word-break: break-word;
}

.sgt-toast-content strong {
    font-weight: 600;
    color: #0f172a;
}

.sgt-toast-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: 6px;
    color: #94a3b8;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}

.sgt-toast-close:hover {
    color: #334155;
}

.sgt-toast-success {
    border-left-color: #10b981;
}
.sgt-toast-success .sgt-toast-icon {
    color: #10b981;
}

.sgt-toast-error {
    border-left-color: #ef4444;
}
.sgt-toast-error .sgt-toast-icon {
    color: #ef4444;
}

.sgt-toast-warning {
    border-left-color: #f59e0b;
}
.sgt-toast-warning .sgt-toast-icon {
    color: #f59e0b;
}

.sgt-toast-info {
    border-left-color: #1e40af;
}
.sgt-toast-info .sgt-toast-icon {
    color: #1e40af;
}

@keyframes sgtToastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-15px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

