/* ================================================================
   MYTCOAT EMPLOYEE PORTAL — portal.css
   Brand: #005985
   Font:  Outfit (Google Fonts)
   ================================================================ */

/* === CSS VARIABLES ============================================= */
:root {
    /* Brand */
    --clr-primary:          #005985;
    --clr-primary-dark:     #003d63;
    --clr-primary-mid:      #0077b6;
    --clr-primary-subtle:   #e0f0f8;
    --clr-primary-gradient: linear-gradient(135deg, #005985 0%, #003d63 100%);

    /* Success */
    --clr-success:          #155724;
    --clr-success-bg:       #d4edda;
    --clr-success-accent:   #28a745;
    --clr-success-gradient: linear-gradient(135deg, #28a745 0%, #20c997 100%);

    /* Warning */
    --clr-warning:          #856404;
    --clr-warning-bg:       #fff3cd;
    --clr-warning-accent:   #d4990a;
    --clr-warning-gradient: linear-gradient(135deg, #d4990a 0%, #e67e22 100%);

    /* Danger */
    --clr-danger:           #721c24;
    --clr-danger-bg:        #f8d7da;
    --clr-danger-accent:    #dc3545;
    --clr-danger-gradient:  linear-gradient(135deg, #dc3545 0%, #c0392b 100%);

    /* Neutrals */
    --clr-bg:               #f0f4f8;
    --clr-surface:          #ffffff;
    --clr-border:           #dce3ea;
    --clr-text:             #1a2733;
    --clr-text-muted:       #6b7a87;
    --clr-text-light:       #9aabb6;

    /* Shadows */
    --shadow-card:          0 2px 8px rgba(0, 89, 133, 0.08);
    --shadow-card-hover:    0 4px 16px rgba(0, 89, 133, 0.14);
    --shadow-float:         0 4px 18px rgba(0, 89, 133, 0.28);
    --shadow-header:        0 2px 12px rgba(0, 0, 0, 0.12);

    /* Radius */
    --radius-sm:   6px;
    --radius-md:   12px;
    --radius-lg:   20px;
    --radius-full: 9999px;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 15px;
    --space-lg: 20px;
    --space-xl: 30px;

    /* Transitions */
    --transition:      0.2s ease;
    --transition-fast: 0.15s ease;

    /* Typography */
    --font: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}


/* === BASE ====================================================== */
*, *::before, *::after { box-sizing: border-box; }

* { font-family: var(--font); }

body {
    background: var(--clr-bg);
    margin: 0;
    padding: 0;
    color: var(--clr-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { text-decoration: none; color: inherit; }


/* === PORTAL HEADER ============================================= */
.portal-header {
    background: var(--clr-primary-gradient);
    color: white;
    padding: var(--space-lg);
    box-shadow: var(--shadow-header);
    position: relative;
}

.portal-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 4px 0;
}

.portal-header .subtitle {
    font-size: 13px;
    opacity: 0.85;
    font-weight: 400;
}

/* Warning variant — callOut page */
.portal-header--warning {
    background: var(--clr-warning-gradient);
}


/* === HEADER UTILITY BUTTON (back / logout) ===================== */
.header-btn {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    background: rgba(255, 255, 255, 0.18);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 15px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    z-index: 200;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    transition: background var(--transition);
}

.header-btn:hover { background: rgba(255, 255, 255, 0.28); color: white; }


/* === CONTENT WRAPPER =========================================== */
.portal-content {
    padding: var(--space-lg);
}

.portal-content--no-top {
    padding-top: 0;
}


/* === SURFACE CARD ============================================== */
.card-surface {
    background: var(--clr-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
}


/* === EMPLOYEE INFO CARD ======================================== */
.employee-card {
    display: flex;
    align-items: center;
    gap: 14px;
}

.employee-avatar {
    background: var(--clr-primary-gradient);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 21px;
    font-weight: 800;
    flex-shrink: 0;
}

.employee-info { flex: 1; min-width: 0; }

.employee-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--clr-text);
    margin-bottom: 3px;
}

.employee-detail {
    font-size: 13px;
    color: var(--clr-text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.employee-detail i {
    width: 14px;
    color: var(--clr-primary);
    opacity: 0.75;
}


/* === STATS GRID ================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: var(--space-lg);
    margin-top: -28px;
}

.stat-card {
    background: var(--clr-surface);
    border-radius: var(--radius-md);
    padding: 18px 12px;
    box-shadow: var(--shadow-card);
    text-align: center;
    display: block;
    color: inherit;
    text-decoration: none;
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
    color: inherit;
    text-decoration: none;
}

.stat-card:active { transform: translateY(0); }

.stat-icon {
    font-size: 28px;
    margin-bottom: 6px;
    line-height: 1;
    display: block;
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--clr-text);
    margin: 4px 0;
    line-height: 1;
    display: block;
}

.stat-label {
    font-size: 11px;
    color: var(--clr-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
    margin-top: 4px;
    display: block;
}


/* === SECTIONS ================================================== */
.portal-section {
    padding: 0 var(--space-lg) var(--space-lg);
}

.section-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--clr-text);
    margin: 0 0 var(--space-md) 0;
    display: flex;
    align-items: center;
    gap: 8px;
}


/* === REQUEST CARDS ============================================= */
.request-card {
    background: var(--clr-surface);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: 10px;
    box-shadow: var(--shadow-card);
    border-left: 4px solid var(--clr-border);
}

.request-card.approved  { border-left-color: var(--clr-success-accent); }
.request-card.pending   { border-left-color: var(--clr-warning-accent); }
.request-card.denied    { border-left-color: var(--clr-danger-accent); }
.request-card.cancelled { border-left-color: var(--clr-text-light); }

.request-dates {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--clr-text);
}

.request-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--clr-text-muted);
    flex-wrap: wrap;
}

.request-reason {
    margin-top: 8px;
    font-size: 13px;
    color: var(--clr-text-muted);
}

.denied-reason {
    margin-top: 8px;
    font-size: 12px;
    color: var(--clr-danger);
    background: var(--clr-danger-bg);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
}


/* === STATUS BADGES ============================================= */
.badge-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.badge-status.approved  { background: var(--clr-success-bg);  color: var(--clr-success); }
.badge-status.pending   { background: var(--clr-warning-bg);  color: var(--clr-warning); }
.badge-status.denied    { background: var(--clr-danger-bg);   color: var(--clr-danger); }
.badge-status.cancelled { background: #e9ecef; color: #6c757d; }
.badge-status.excused   { background: var(--clr-warning-bg);  color: var(--clr-warning); }
.badge-status.unexcused { background: var(--clr-danger-bg);   color: var(--clr-danger); }
.badge-status.time      { background: var(--clr-primary-subtle); color: var(--clr-primary-dark); }


/* === CANCEL BUTTONS (inside cards) ============================= */
.btn-cancel {
    border: none;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: opacity var(--transition-fast);
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-cancel--solid {
    background: var(--clr-danger-accent);
    color: white;
}

.btn-cancel--outline {
    background: white;
    color: var(--clr-danger-accent);
    border: 2px solid var(--clr-danger-accent);
}

.btn-cancel:hover { opacity: 0.82; }


/* === NAV SPACER ================================================= */
/* Prevents last content card from hiding behind the bottom nav */
.nav-spacer { height: 80px; }



/* === EMPTY STATE =============================================== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--clr-text-light);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 14px;
    opacity: 0.3;
    display: block;
}

.empty-state p {
    font-size: 15px;
    margin: 0 0 6px;
    color: var(--clr-text-muted);
}

.empty-state small {
    font-size: 13px;
    color: var(--clr-text-light);
}


/* === ALERT / MESSAGE BOXES ===================================== */
.alert-box {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border-left: 4px solid;
    font-size: 13px;
    margin-bottom: var(--space-md);
    font-weight: 500;
}

.alert-box--success {
    background: var(--clr-success-bg);
    color: var(--clr-success);
    border-color: var(--clr-success-accent);
}

.alert-box--danger {
    background: var(--clr-danger-bg);
    color: var(--clr-danger);
    border-color: var(--clr-danger-accent);
}

.alert-box--info {
    background: var(--clr-primary-subtle);
    color: var(--clr-primary-dark);
    border-color: var(--clr-primary);
}

.alert-box--warning {
    background: var(--clr-warning-bg);
    color: var(--clr-warning);
    border-color: var(--clr-warning-accent);
}


/* === SUMMARY CARD (absences / tardies) ========================= */
.summary-card {
    background: var(--clr-surface);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-card);
    text-align: center;
}

.summary-card__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--clr-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.summary-card__value {
    font-size: 52px;
    font-weight: 800;
    margin: 8px 0;
    line-height: 1;
}

.summary-card__value--danger  { color: var(--clr-danger-accent); }
.summary-card__value--warning { color: var(--clr-warning-accent); }
.summary-card__value--success { color: var(--clr-success-accent); }
.summary-card__value--primary { color: var(--clr-primary); }

.summary-card__badges {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}


/* === MONTH SECTIONS (absences / tardies) ======================= */
.month-section { margin-bottom: var(--space-xl); }

.month-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--clr-text);
    margin-bottom: var(--space-md);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--clr-primary);
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.month-title__count {
    font-size: 13px;
    color: var(--clr-text-light);
    font-weight: 400;
}

/* Record cards */
.record-card {
    background: var(--clr-surface);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: 10px;
    box-shadow: var(--shadow-card);
    border-left: 4px solid var(--clr-border);
}

.record-card--absent  { border-left-color: var(--clr-danger-accent); }
.record-card--excused { border-left-color: var(--clr-warning-accent); }
.record-card--tardy   { border-left-color: var(--clr-warning-accent); }

.record-date {
    font-size: 15px;
    font-weight: 700;
    color: var(--clr-text);
    margin-bottom: 8px;
}

.record-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--clr-text-muted);
    flex-wrap: wrap;
}


/* === FORM STYLES =============================================== */
.form-card {
    background: var(--clr-surface);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    box-shadow: var(--shadow-card);
    margin-bottom: var(--space-md);
}

.form-label {
    font-weight: 600;
    font-size: 12px;
    color: var(--clr-text-muted);
    margin-bottom: 8px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.form-field {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--clr-border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    color: var(--clr-text);
    background: white;
    transition: border-color var(--transition), box-shadow var(--transition);
    box-sizing: border-box;
    font-family: var(--font);
    appearance: none;
    -webkit-appearance: none;
}

.form-field:focus {
    border-color: var(--clr-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 89, 133, 0.1);
}

.form-field--warning:focus {
    border-color: var(--clr-warning-accent);
    box-shadow: 0 0 0 3px rgba(212, 153, 10, 0.1);
}

textarea.form-field {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    font-size: 12px;
    color: var(--clr-text-muted);
    margin-top: 4px;
    display: block;
}

/* Radio type cards (callOut) */
.radio-group {
    display: flex;
    gap: 12px;
}

.radio-option {
    flex: 1;
    padding: 18px 12px;
    border: 3px solid var(--clr-border);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: white;
    user-select: none;
}

.radio-option input[type="radio"] { display: none; }

.radio-option.selected {
    border-color: var(--clr-warning-accent);
    background: var(--clr-warning-bg);
}

.radio-option:active { transform: scale(0.97); }

.radio-icon { font-size: 32px; margin-bottom: 8px; line-height: 1; display: block; }
.radio-label { font-weight: 700; font-size: 15px; color: var(--clr-text); }

/* Submit button */
.btn-submit {
    width: 100%;
    padding: 15px;
    background: var(--clr-primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-float);
    font-family: var(--font);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: var(--space-lg);
    transition: opacity var(--transition), transform var(--transition-fast);
}

.btn-submit:active { transform: scale(0.98); opacity: 0.9; }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-submit--warning {
    background: var(--clr-warning-gradient);
    box-shadow: 0 4px 15px rgba(212, 153, 10, 0.3);
}


/* === REQUEST TIME OFF PAGE ===================================== */
.form-container {
    max-width: 600px;
    margin: 0 auto;
    padding: var(--space-lg);
}

.page-header {
    background: var(--clr-primary-gradient);
    color: white;
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-header);
}

.page-header__back {
    color: white;
    font-size: 20px;
    text-decoration: none;
    flex-shrink: 0;
    opacity: 0.9;
    transition: opacity var(--transition-fast);
}

.page-header__back:hover { opacity: 1; color: white; }

.page-header h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: var(--space-md);
}

.form-col { flex: 1; min-width: 0; }


/* === LOGIN PAGE ================================================ */
body.login-body {
    min-height: 100vh;
    background: var(--clr-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.login-hero {
    width: 100%;
    background: var(--clr-primary-gradient);
    padding: 48px 30px 60px;
    text-align: center;
    color: white;
}

.login-hero__logo {
    max-height: 65px;
    margin-bottom: 18px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.login-hero__label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    opacity: 0.8;
    margin: 0;
}

.login-card {
    background: var(--clr-surface);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 30px rgba(0, 89, 133, 0.15);
    padding: 28px 24px 24px;
    width: calc(100% - 40px);
    max-width: 420px;
    margin: -28px auto 30px;
    position: relative;
    z-index: 1;
}

.login-field {
    margin-bottom: 18px;
}

.login-field label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--clr-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.login-input-wrap {
    display: flex;
    align-items: stretch;
    border: 2px solid var(--clr-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.login-input-wrap:focus-within {
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px rgba(0, 89, 133, 0.1);
}

.login-input-icon {
    display: flex;
    align-items: center;
    padding: 0 13px;
    background: var(--clr-bg);
    color: var(--clr-text-muted);
    font-size: 14px;
    border-right: 2px solid var(--clr-border);
    white-space: nowrap;
    font-weight: 500;
    transition: border-color var(--transition);
}

.login-input-wrap:focus-within .login-input-icon {
    border-right-color: var(--clr-primary);
}

.login-input-wrap input {
    flex: 1;
    border: none;
    outline: none;
    padding: 13px 14px;
    font-size: 16px;
    font-family: var(--font);
    color: var(--clr-text);
    background: white;
    min-width: 0;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--clr-primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font);
    letter-spacing: 0.3px;
    transition: opacity var(--transition), transform var(--transition-fast);
    margin-top: 6px;
    box-shadow: 0 4px 14px rgba(0, 89, 133, 0.3);
}

.btn-login:hover  { opacity: 0.9; }
.btn-login:active { transform: scale(0.98); }

.login-divider {
    border: none;
    border-top: 1px solid var(--clr-border);
    margin: 20px 0 16px;
}

.login-footer-text {
    font-size: 12px;
    color: var(--clr-text-muted);
    line-height: 1.6;
    text-align: center;
}

.btn-exit {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 22px;
    border-radius: var(--radius-full);
    background: var(--clr-danger-bg);
    color: var(--clr-danger-accent);
    font-weight: 700;
    font-size: 13px;
    border: 2px solid var(--clr-danger-accent);
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font);
    transition: background var(--transition);
}

.btn-exit:hover { background: var(--clr-danger-bg); color: var(--clr-danger-accent); }

/* ── Install Guide Buttons (login page) ─────────────────────── */
.install-guide-btns {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}
.install-guide-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 11px 10px;
    border-radius: var(--radius-md);
    background: var(--clr-primary-subtle);
    color: var(--clr-primary);
    border: 1.5px solid #b3d6ea;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font);
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition);
    line-height: 1.3;
}
.install-guide-btn i { font-size: 20px; flex-shrink: 0; }
.install-guide-btn small { font-weight: 500; font-size: 11px; opacity: 0.8; }
.install-guide-btn:hover { background: #c9e8f5; border-color: var(--clr-primary); }

.login-copyright {
    font-size: 12px;
    color: var(--clr-text-light);
    text-align: center;
    padding: 0 20px 30px;
    line-height: 1.6;
}


/* === NOTIFICATION NUDGE ======================================== */
.notif-nudge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--clr-primary-subtle);
    border-left: 4px solid var(--clr-primary);
    padding: 12px 14px;
    margin: 12px 16px 0;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    transition: background 0.3s;
}
.notif-nudge--warn {
    background: #fff8e1;
    border-left-color: #f59e0b;
}
.notif-nudge--success {
    background: var(--clr-success-bg);
    border-left-color: var(--clr-success-accent);
}
.notif-nudge__icon {
    font-size: 22px;
    color: var(--clr-primary);
    flex-shrink: 0;
}
.notif-nudge--warn  .notif-nudge__icon { color: #f59e0b; }
.notif-nudge--success .notif-nudge__icon { color: var(--clr-success-accent); }
.notif-nudge__body {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
    color: var(--clr-text);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.notif-nudge__body strong { font-size: 14px; }
.notif-nudge__btn {
    flex-shrink: 0;
    background: var(--clr-primary-gradient);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font);
    transition: opacity var(--transition);
}
.notif-nudge__btn:disabled { opacity: 0.6; cursor: not-allowed; }
.notif-nudge--warn  .notif-nudge__btn { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.notif-nudge--success .notif-nudge__btn { display: none; }

/* === BIRTHDAY SPLASH =========================================== */
.birthday-splash {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--clr-primary-gradient);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.5s ease;
}

.birthday-splash__inner {
    text-align: center;
    color: white;
    padding: 40px;
}

.birthday-splash__emoji {
    font-size: 80px;
    animation: bounce 1s infinite;
    line-height: 1;
    margin-bottom: 20px;
    display: block;
}

.birthday-splash__title {
    font-size: 42px;
    font-weight: 800;
    margin: 0 0 10px;
}

.birthday-splash__name {
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 20px;
    opacity: 0.9;
}

.birthday-splash__msg {
    font-size: 18px;
    opacity: 0.85;
    margin-bottom: 30px;
}

.birthday-splash__btn {
    background: white;
    color: var(--clr-primary);
    border: none;
    padding: 14px 38px;
    border-radius: var(--radius-full);
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font);
}


/* === ANIMATIONS ================================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-18px); }
}

@keyframes slideUp {
    from { transform: translateY(24px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}


/* === UTILITY CLASSES =========================================== */
.text-muted    { color: var(--clr-text-muted) !important; }
.text-danger   { color: var(--clr-danger-accent) !important; }
.text-success  { color: var(--clr-success-accent) !important; }
.text-primary  { color: var(--clr-primary) !important; }
.fw-bold       { font-weight: 700; }
.fw-normal     { font-weight: 400; }
.d-none        { display: none; }
.mt-2          { margin-top: var(--space-sm); }
.mt-3          { margin-top: var(--space-md); }
.mb-0          { margin-bottom: 0; }
.mb-2          { margin-bottom: var(--space-sm); }
.mb-3          { margin-bottom: var(--space-md); }
.text-center   { text-align: center; }
.text-small    { font-size: 12px; }


/* === RESPONSIVE ================================================ */
@media (max-width: 380px) {
    .stats-grid {
        gap: 8px;
        padding: var(--space-md);
    }
    .stat-value  { font-size: 22px; }
    .fab         { width: 52px; height: 52px; font-size: 20px; }
    .fab--notify { bottom: 158px; }
    .fab--callout{ bottom: 88px; }
}

@media (min-width: 600px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 768px) {
    .login-hero { padding: 60px 40px 70px; }
    .login-card { padding: 36px 32px 28px; }
}


/* === BOTTOM NAVIGATION ========================================= */
.portal-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--clr-surface);
    border-top: 1px solid var(--clr-border);
    display: flex;
    align-items: stretch;
    z-index: 500;
    box-shadow: 0 -2px 12px rgba(0, 89, 133, 0.08);
    padding-bottom: env(safe-area-inset-bottom);
}

.portal-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--clr-text-muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    position: relative;
    transition: color var(--transition-fast), background var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: var(--font);
    padding: 0;
}

.portal-nav-item i {
    font-size: 18px;
    line-height: 1;
    transition: transform var(--transition-fast);
}

.portal-nav-item:hover,
.portal-nav-item:active {
    color: var(--clr-primary);
    background: var(--clr-primary-subtle);
    text-decoration: none;
}

.portal-nav-item.active         { color: var(--clr-primary); }
.portal-nav-item.active i       { transform: scale(1.1); }

.portal-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--clr-primary);
    border-radius: 0 0 2px 2px;
}

/* Time Off item — primary tint */
.portal-nav-item--primary       { color: var(--clr-primary); }
.portal-nav-item--primary:hover { color: var(--clr-primary-dark); }

/* Call Out item — danger tint */
.portal-nav-item--danger        { color: var(--clr-danger-accent); }
.portal-nav-item--danger:hover  { color: #b02a37; background: var(--clr-danger-bg); }

/* Unread badge */
.portal-nav-badge {
    position: absolute;
    top: 6px;
    left: calc(50% + 4px);
    background: var(--clr-danger-accent);
    color: white;
    border-radius: var(--radius-full);
    font-size: 9px;
    font-weight: 800;
    padding: 1px 5px;
    min-width: 16px;
    text-align: center;
    line-height: 1.4;
    border: 2px solid var(--clr-surface);
}

/* Responsive — center + round corners on tablets */
@media (min-width: 600px) {
    .portal-bottom-nav {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 16px 16px 0 0;
        border-left: 1px solid var(--clr-border);
        border-right: 1px solid var(--clr-border);
    }
}


/* === MORE SHEET ================================================= */
.nav-more-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 498;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.nav-more-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.nav-more-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 64px; /* sits on top of nav */
    background: var(--clr-surface);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 30px rgba(0, 89, 133, 0.12);
    z-index: 499;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    padding-bottom: env(safe-area-inset-bottom);
    max-width: 600px;
    margin: 0 auto;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

.nav-more-sheet.open {
    transform: translateY(0);
}

.nav-more-handle {
    width: 36px;
    height: 4px;
    background: var(--clr-border);
    border-radius: 2px;
    margin: 12px auto 8px;
}

.nav-more-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--clr-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 8px 20px 4px;
}

.nav-more-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    text-decoration: none;
    color: var(--clr-text);
    transition: background var(--transition-fast);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    font-family: var(--font);
}

.nav-more-row:hover    { background: var(--clr-primary-subtle); text-decoration: none; color: var(--clr-text); }
.nav-more-row:active   { background: var(--clr-primary-subtle); }
.nav-more-row--soon    { opacity: 0.4; pointer-events: none; }

.nav-more-row__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.nav-more-row__icon--blue   { background: var(--clr-primary-subtle);  color: var(--clr-primary); }
.nav-more-row__icon--green  { background: var(--clr-success-bg);       color: var(--clr-success-accent); }
.nav-more-row__icon--grey   { background: #f0f0f0; color: #6c757d; }
.nav-more-row__icon--orange { background: #fdebd0; color: #e67e22; }
.nav-more-row__icon--purple { background: #e8e0f5; color: #6f42c1; }

.nav-more-row__info     { flex: 1; text-align: left; }
.nav-more-row__title    { font-size: 15px; font-weight: 600; }
.nav-more-row__sub      { font-size: 12px; color: var(--clr-text-muted); margin-top: 1px; }

.nav-more-row__right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.nav-more-badge {
    background: var(--clr-danger-accent);
    color: white;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    min-width: 20px;
    text-align: center;
}

/* Notification toggle pill */
.notif-toggle {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: var(--clr-border);
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}

.notif-toggle::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.notif-toggle.on {
    background: var(--clr-success-accent);
}

.notif-toggle.on::after {
    transform: translateX(20px);
}

.notif-toggle.blocked {
    background: #adb5bd;
    cursor: not-allowed;
}

.nav-more-row__icon--danger { background: var(--clr-danger-bg);  color: var(--clr-danger-accent); }

.nav-more-row--logout:hover {
    background: var(--clr-danger-bg);
}

.nav-more-row__title--danger { color: var(--clr-danger-accent); }

/* Sheet divider */
.nav-more-divider {
    height: 1px;
    background: var(--clr-border);
    margin: 4px 20px;
}

/* Sheet bottom padding */
.nav-more-sheet__footer {
    height: 16px;
}


/* === PUSH PROMPT ================================================ */
.push-prompt {
    position: fixed;
    bottom: 74px;
    left: 12px;
    right: 12px;
    background: var(--clr-surface);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 24px rgba(0, 89, 133, 0.16);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 490;
    border: 1px solid var(--clr-primary-subtle);
    animation: slideUp 0.3s ease;
    max-width: 576px;
    margin: 0 auto;
}

.push-prompt__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--clr-primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.push-prompt__content { flex: 1; min-width: 0; }

.push-prompt__title {
    font-size: 13px;
    font-weight: 700;
    color: var(--clr-text);
    margin-bottom: 2px;
}

.push-prompt__text {
    font-size: 11px;
    color: var(--clr-text-muted);
    line-height: 1.4;
}

.push-prompt__actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.push-prompt__enable {
    background: var(--clr-primary);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font);
    white-space: nowrap;
}

.push-prompt__dismiss {
    background: none;
    border: none;
    color: var(--clr-text-muted);
    font-size: 11px;
    cursor: pointer;
    font-family: var(--font);
    padding: 2px 0;
    text-align: center;
}

@media (max-width: 380px) {
    .nav-more-sheet { bottom: 60px; }
}

/* ── Camera button ────────────────────────────────────────────── */
.chat-img-btn {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--clr-bg);
    border: 2px solid var(--clr-border);
    color: var(--clr-text-muted);
    font-size: 16px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.15s, color 0.15s;
}
.chat-img-btn:hover { border-color: var(--clr-primary); color: var(--clr-primary); }
.chat-img-btn.has-files { border-color: var(--clr-success-accent); color: var(--clr-success-accent); }

.chat-gif-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--clr-bg);
    border: 2px solid var(--clr-border);
    color: var(--clr-primary);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.chat-gif-btn:hover {
    border-color: var(--clr-primary);
    background: var(--clr-primary-subtle);
}

/* ── Preview strip internals ──────────────────────────────────── */
.preview-thumbs {
    display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px;
}
.preview-footer { display: flex; align-items: center; justify-content: space-between; }
.preview-count { font-size: 12px; color: var(--clr-text-muted); font-weight: 600; }
.preview-clear {
    font-size: 12px; color: var(--clr-danger-accent);
    background: none; border: none; cursor: pointer; font-family: var(--font); padding: 0;
}
.preview-thumb__remove {
    position: absolute; top: -6px; right: -6px;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--clr-danger-accent); color: white;
    border: 2px solid white; font-size: 10px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0; line-height: 1;
}

/* ── Links in messages ────────────────────────────────────────── */
.msg-link { text-decoration: underline; opacity: 0.9; word-break: break-all; }
.msg-group.mine   .msg-link { color: rgba(255,255,255,0.95); }
.msg-group.theirs .msg-link { color: var(--clr-primary); }

/* ── Lightbox ─────────────────────────────────────────────────── */
.img-lightbox {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    padding: 20px; animation: fadeIn 0.2s ease;
}
.img-lightbox img {
    max-width: 100%; max-height: 90dvh;
    object-fit: contain; border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.img-lightbox__close {
    position: absolute; top: 20px; right: 20px;
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,0.15); color: white;
    border: 2px solid rgba(255,255,255,0.3);
    font-size: 16px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* ── GIF picker ───────────────────────────────────────────────── */
.gif-picker {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(0,0,0,0.45);
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.gif-picker.open {
    display: flex;
}

.gif-picker__panel {
    width: 100%;
    max-width: 520px;
    max-height: min(680px, 86dvh);
    background: var(--clr-surface);
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.18);
}

.gif-picker__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--clr-primary-gradient);
    color: white;
    flex-shrink: 0;
}

.gif-picker__title {
    font-size: 15px;
    font-weight: 800;
}

.gif-picker__close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.14);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.gif-picker__search {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--clr-border);
    flex-shrink: 0;
}

.gif-picker__input {
    flex: 1;
    min-width: 0;
    border: 2px solid var(--clr-border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 15px;
    font-family: var(--font);
    outline: none;
}

.gif-picker__input:focus {
    border-color: var(--clr-primary);
}

.gif-picker__submit {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--clr-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.gif-picker__status {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--clr-text-muted);
    flex-shrink: 0;
}

.gif-picker__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 0 12px 12px;
    overflow-y: auto;
}

.gif-picker__item {
    border: none;
    padding: 0;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    background: var(--clr-bg);
    cursor: pointer;
}

.gif-picker__item:disabled {
    opacity: 0.5;
    cursor: wait;
}

.gif-picker__item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.gif-picker__powered {
    padding: 8px 12px 12px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--clr-text-light);
    text-align: right;
    flex-shrink: 0;
}

/* === CHAT PAGE ================================================= */
/* ── Layout ───────────────────────────────────────────── */
/*
 * Use position:fixed on the shell so it pins exactly above the bottom
 * nav on every device/browser. dvh-based heights are unreliable in
 * Android PWA mode — fixed+bottom is the only truly safe approach.
 */
body.chat-page {
    overflow: hidden;
    height: 100%;
    /* NOT position:fixed — that makes body the containing block for
       fixed children in Android PWA, breaking bottom calculations. */
}

.chat-shell {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 64px; /* JS (syncChatShell) overrides with actual nav height */
    display: flex;
    overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────── */
.chat-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--clr-surface);
    border-right: 1px solid var(--clr-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* height fills the fixed shell automatically via flex */
    transition: transform 0.25s ease;
    z-index: 100;
}

.sidebar-header {
    padding: 16px 18px;
    background: var(--clr-primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.sidebar-back {
    color: white;
    text-decoration: none;
    font-size: 13px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: opacity 0.15s;
}

.sidebar-back:hover { opacity: 1; color: white; }

.sidebar-rooms {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.room-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    cursor: pointer;
    text-decoration: none;
    color: var(--clr-text);
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    position: relative;
}

.room-item:hover {
    background: var(--clr-primary-subtle);
    color: var(--clr-text);
    text-decoration: none;
}

.room-item.active {
    background: var(--clr-primary-subtle);
    border-left-color: var(--clr-primary);
    color: var(--clr-primary-dark);
}

.room-item__icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--clr-primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 15px;
    flex-shrink: 0;
}

.room-item.managers .room-item__icon {
    background: linear-gradient(135deg, #1a2733, #2d3748);
}

.room-item__info { flex: 1; min-width: 0; }

.room-item__name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-item__sub {
    font-size: 11px;
    color: var(--clr-text-muted);
    margin-top: 1px;
}

.room-badge {
    background: var(--clr-danger-accent);
    color: white;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
}

/* ── Chat Panel ───────────────────────────────────────── */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.chat-header {
    background: var(--clr-primary-gradient);
    color: white;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    box-shadow: var(--shadow-header);
}

.chat-header__menu {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
}

.chat-header__icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.chat-header__info { flex: 1; min-width: 0; }

.chat-header__name {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
}

.chat-header__sub {
    font-size: 11px;
    opacity: 0.8;
    margin-top: 1px;
}

/* ── Messages ─────────────────────────────────────────── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scroll-behavior: smooth;
}

/* Date divider */
.chat-date-divider {
    text-align: center;
    margin: 12px 0 8px;
    position: relative;
}

.chat-date-divider span {
    background: var(--clr-bg);
    padding: 0 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--clr-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

.chat-date-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0; right: 0;
    height: 1px;
    background: var(--clr-border);
}

/* Message bubble */
.msg-group { display: flex; flex-direction: column; gap: 2px; }
.msg-group.mine   { align-items: flex-end; }
.msg-group.theirs { align-items: flex-start; }

.msg-sender {
    font-size: 11px;
    font-weight: 700;
    color: var(--clr-text-muted);
    margin: 6px 0 2px 46px;
}

.msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.msg-group.mine .msg-row { flex-direction: row-reverse; }

.msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--clr-primary-gradient);
    color: white;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: flex-end;
}

.msg-group.mine .msg-avatar { display: none; }

.msg-bubble {
    min-width: 60px;         /* prevents single-word slivers */
    max-width: 72%;
    padding: 9px 13px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: normal;      /* don't break mid-word unless forced */
    overflow-wrap: break-word; /* only break when truly necessary */
    position: relative;
}

.msg-group.mine .msg-bubble {
    background: var(--clr-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.msg-group.theirs .msg-bubble {
    background: var(--clr-surface);
    color: var(--clr-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}

.msg-time {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 3px;
    padding: 0 4px;
}

.msg-group.mine .msg-time   { text-align: right; }
.msg-group.theirs .msg-time { text-align: left; margin-left: 38px; }

/* Deleted message */
.msg-bubble.deleted {
    background: transparent !important;
    color: var(--clr-text-muted) !important;
    font-style: italic;
    border: 1px dashed var(--clr-border);
    box-shadow: none;
}

/* Delete button (appears on hover) */
.msg-bubble-wrap { position: relative; }

.msg-delete {
    position: absolute;
    top: 4px;
    right: -28px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--clr-danger-bg);
    color: var(--clr-danger-accent);
    border: none;
    font-size: 10px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.msg-group.mine .msg-delete { right: auto; left: -28px; }
.msg-bubble-wrap:hover .msg-delete { display: flex; }

/* ── Typing / Empty States ────────────────────────────── */
.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--clr-text-muted);
    padding: 40px 20px;
    text-align: center;
}

.chat-empty i { font-size: 48px; opacity: 0.2; margin-bottom: 14px; }
.chat-empty p { font-size: 14px; margin: 0; }

/* ── Input Bar ────────────────────────────────────────── */
.chat-input-bar {
    padding: 10px 14px;
    background: var(--clr-surface);
    border-top: 1px solid var(--clr-border);
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.chat-input-wrap {
    flex: 1;
    background: var(--clr-bg);
    border: 2px solid var(--clr-border);
    border-radius: 22px;
    padding: 8px 14px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    transition: border-color 0.2s;
}

.chat-input-wrap:focus-within {
    border-color: var(--clr-primary);
}

#chatInput {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font);
    font-size: 15px;
    color: var(--clr-text);
    resize: none;
    max-height: 100px;
    line-height: 1.4;
    min-height: 22px;
}

#chatInput::placeholder { color: var(--clr-text-light); }

.chat-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--clr-primary-gradient);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s, transform 0.15s;
    box-shadow: 0 2px 8px rgba(0,89,133,0.3);
}

.chat-send-btn:hover   { opacity: 0.9; }
.chat-send-btn:active  { transform: scale(0.93); }
.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* Constrain the preview strip height */
.chat-image-preview {
    padding: 10px 14px;
    border-top: 1px solid var(--clr-border);
    background: var(--clr-bg);
    display: none;
    max-height: 110px;   /* ← add this */
    overflow-y: auto;    /* ← and this */
}

.preview-thumb {
    position: relative;
    width: 68px;
    height: 68px;
    flex-shrink: 0;      /* ← add this — prevents flex from squishing them */
}

.preview-thumb img {
    width: 68px;
    height: 68px;
    max-width: 68px;     /* ← add max-width */
    max-height: 68px;    /* ← add max-height */
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--clr-border);
    display: block;      /* ← add this — removes phantom inline space */
}

/* ── Mobile overlay sidebar ───────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}

.msg-image {
    width: 220px;        /* fixed width — not max, not 100% */
    height: 220px;       /* square crop like every chat app ever */
    border-radius: 10px;
    display: block;
    cursor: zoom-in;
    object-fit: cover;   /* crops nicely, no stretching */
    flex-shrink: 0;
}

.msg-group.mine .msg-bubble,
.msg-group.theirs .msg-bubble {
    max-width: 260px; /* slightly wider than image to account for padding */
}
@media (max-width: 640px) {
    .chat-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 80%;
        max-width: 300px;
        transform: translateX(-100%);
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    }

    .chat-sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open { display: block; }

    .chat-header__menu { display: flex; }

    .msg-bubble { max-width: 85%; }
}

/* ── Scrollbar ────────────────────────────────────────── */
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--clr-border); border-radius: 2px; }

/* ── Connection status ────────────────────────────────── */
.chat-status {
    text-align: center;
    padding: 4px;
    font-size: 11px;
    font-weight: 600;
    display: none;
}

.chat-status.offline {
    display: block;
    background: var(--clr-danger-bg);
    color: var(--clr-danger-accent);
}

.chat-status.reconnecting {
    display: block;
    background: var(--clr-warning-bg);
    color: var(--clr-warning);
}

/* === GIF PICKER OVERRIDES ====================================== */
.chat-gif-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--clr-bg);
    border: 2px solid var(--clr-border);
    color: var(--clr-primary);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.gif-picker[hidden] {
    display: none !important;
}

.gif-picker {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(0,0,0,0.45);
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.gif-picker.open {
    display: flex;
}

.gif-picker__panel {
    width: 100%;
    max-width: 520px;
    max-height: min(680px, 86dvh);
    background: var(--clr-surface);
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.18);
}

.gif-picker__header,
.gif-picker__search {
    flex-shrink: 0;
}

.gif-picker__grid {
    overflow-y: auto;
}
