/**
 * Standardized Student Profile Popup — Styles
 * Companion to /js/student-profile.js
 *
 * Design tokens follow the project's existing palette:
 *   Primary: #059669 / #047857
 *   Accent: #D4AF37
 *   Fonts: Inter + Anek Bangla (loaded via layouts)
 */

/* ── Modal Overlay ── */
.sp-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}
.sp-overlay.show {
    opacity: 1;
    pointer-events: auto;
}
.sp-overlay.show .sp-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ── Modal Card ── */
.sp-modal {
    position: relative;
    background: #ffffff;
    border-radius: 22px;
    max-width: 680px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 28px 60px -12px rgba(0, 0, 0, 0.32);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transform: scale(0.96) translateY(12px);
    opacity: 0;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.22s ease;
}
.sp-modal::-webkit-scrollbar { width: 6px; }
.sp-modal::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* ── Close Button ── */
.sp-close-btn {
    position: sticky;
    top: 16px;
    float: right;
    z-index: 10;
    margin: 16px 16px 0 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    font-size: 1.3rem;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.sp-close-btn:hover {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #059669;
    transform: rotate(90deg);
}

/* ── Card Container ── */
.sp-card {
    padding: 0;
}

/* ── Header (Photo + Identity) ── */
.sp-header {
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 28px 28px 24px;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border-bottom: 1px solid #bbf7d0;
    border-radius: 22px 22px 0 0;
}

/* Avatar */
.sp-avatar {
    width: 88px;
    height: 88px;
    border-radius: 22px;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: #166534;
    flex-shrink: 0;
    border: 3px solid #86efac;
    box-shadow: 0 8px 20px -4px rgba(5, 150, 105, 0.3);
}
.sp-avatar.clickable { cursor: zoom-in; }
.sp-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.sp-avatar-zoom {
    position: absolute;
    inset: 0;
    background: rgba(4, 120, 87, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.sp-avatar.clickable:hover .sp-avatar-zoom { opacity: 1; }
.sp-avatar-zoom svg {
    width: 28px;
    height: 28px;
    stroke: #ffffff;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Header Info */
.sp-header-info {
    flex: 1;
    min-width: 0;
}
.sp-name {
    font-size: 1.35rem;
    font-weight: 800;
    color: #064e3b;
    margin: 0 0 8px;
    line-height: 1.3;
    letter-spacing: -0.3px;
    word-break: break-word;
}
.sp-id-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.sp-id-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: #065f46;
    border: 1px solid #a7f3d0;
    padding: 4px 12px;
    border-radius: 9px;
    font-weight: 800;
    font-size: 0.85rem;
    font-feature-settings: "tnum";
}
.sp-roll-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 0.76rem;
    font-weight: 700;
    background: rgba(212, 175, 55, 0.12);
    color: #8a6d1d;
    border: 1px solid rgba(212, 175, 55, 0.4);
}
.sp-photo-hint {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 8px;
}

/* ── Body ── */
.sp-body {
    padding: 24px 28px 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Section ── */
.sp-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px;
}
.sp-section-title {
    font-size: 0.86rem;
    font-weight: 800;
    color: #065f46;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
    margin-bottom: 14px;
    border-bottom: 1px dashed #e2e8f0;
}
.sp-section-title svg {
    width: 17px;
    height: 17px;
    stroke: #059669;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* ── Grid ── */
.sp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.sp-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.sp-field.full {
    grid-column: 1 / -1;
}
.sp-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.sp-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
    word-break: break-word;
    line-height: 1.45;
}

/* ── Pills (for division/category) ── */
.sp-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
}
.sp-pill-blue {
    background: #f0fdf4;
    color: #047857;
    border: 1px solid #bbf7d0;
}

/* ── Campus Chip ── */
.sp-campus-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    padding: 2px 10px;
    border-radius: 8px;
    font-size: 0.76rem;
    font-weight: 600;
    background: #f0fdf4;
    color: #065f46;
    border: 1px solid #bbf7d0;
    white-space: nowrap;
}

/* ── Google Sheet Link ── */
.sp-sheet-link {
    color: #047857;
    text-decoration: underline;
    font-size: 0.88rem;
    font-weight: 600;
}
.sp-sheet-link:hover {
    color: #065f46;
}

/* ── Phone with Direct Call & WhatsApp Action Buttons ── */
.sp-phone-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.sp-phone-num {
    direction: ltr;
    font-family: inherit;
    font-weight: 700;
}
.sp-contact-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.sp-contact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    cursor: pointer;
}
.sp-contact-btn svg {
    width: 13px;
    height: 13px;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.sp-contact-btn.phone {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}
.sp-contact-btn.phone svg {
    fill: none;
    stroke: currentColor;
}
.sp-contact-btn.phone:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}
.sp-contact-btn.whatsapp {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}
.sp-contact-btn.whatsapp svg {
    fill: currentColor;
    stroke: none;
}
.sp-contact-btn.whatsapp:hover {
    background: #10b981;
    color: #ffffff;
    border-color: #10b981;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

/* ── Photo Lightbox ── */
.sp-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(2, 6, 23, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    cursor: zoom-out;
    overflow: hidden;
    padding: 24px;
}
.sp-lightbox.show {
    opacity: 1;
    pointer-events: auto;
}
.sp-lightbox img {
    max-width: 92vw;
    max-height: 88vh;
    border-radius: 14px;
    object-fit: contain;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
    cursor: default;
    user-select: none;
    -webkit-user-drag: none;
}
.sp-lb-close {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 2;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.sp-lb-close:hover {
    background: rgba(5, 150, 105, 0.85);
    transform: rotate(90deg);
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .sp-overlay { padding: 12px; }
    .sp-modal {
        border-radius: 16px;
        max-height: 92vh;
    }
    .sp-header {
        flex-direction: column;
        text-align: center;
        padding: 24px 20px 20px;
        gap: 14px;
    }
    .sp-name { font-size: 1.15rem; }
    .sp-id-row { justify-content: center; }
    .sp-body { padding: 20px 16px 24px; }
    .sp-grid { grid-template-columns: 1fr; gap: 10px; }
    .sp-section { padding: 14px; }
    .sp-avatar { width: 72px; height: 72px; border-radius: 18px; font-size: 1.6rem; }
    .sp-close-btn { margin: 10px 10px 0 0; }
}

@media (max-width: 380px) {
    .sp-header { padding: 20px 14px 16px; }
    .sp-body { padding: 16px 12px 20px; }
    .sp-avatar { width: 64px; height: 64px; border-radius: 16px; }
}
