/* =============================================
   CU SmartDesk | Official Design System
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Source+Sans+3:wght@400;600;700&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
    --cu-red: #CC0000;
    --cu-red-dark: #a00000;
    --cu-red-light: #fff0f0;
    --cu-dark: #1a1a1a;
    --cu-bg: #f4f7f6;
    --cu-border: #e8e8e8;
    --text-main: #212529;
    --text-muted: #6c757d;
    --success: #16a34a;
    --success-bg: #f0fdf4;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.09);
    --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Source Sans 3', sans-serif;
    background: var(--cu-bg);
    margin: 0;
    color: var(--text-main);
    min-height: 100vh;
}

.mono { font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.muted { color: var(--text-muted); font-size: 13px; margin: 4px 0 12px; }

/* -----------------------------------------------
   Header
----------------------------------------------- */
.official-header {
    background: white;
    border-bottom: 4px solid var(--cu-red);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.utility-bar {
    background: var(--cu-dark);
    color: #888;
    padding: 5px 5%;
    font-size: 11px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    letter-spacing: 0.3px;
}

.hack-tag {
    color: var(--cu-red);
    font-weight: 600;
}

.main-nav {
    padding: 10px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-area { display: flex; align-items: center; gap: 14px; }

.main-logo { height: 48px; width: 48px; object-fit: contain; }

/* Fallback logo when image is missing */
.logo-fallback {
    height: 48px;
    width: 48px;
    background: var(--cu-red);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 18px;
    font-family: 'Playfair Display', serif;
    flex-shrink: 0;
}

.logo-text h1 {
    font-family: 'Playfair Display', serif;
    font-size: 17px;
    margin: 0;
    color: var(--cu-red);
    letter-spacing: 0.5px;
}

.logo-text p {
    font-size: 10px;
    margin: 1px 0 0;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.user-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

#pvc-status {
    font-size: 10px;
    color: var(--cu-red);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    animation: pulse-text 2s ease-in-out infinite;
}

@keyframes pulse-text {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.profile-chip {
    width: 34px;
    height: 34px;
    background: var(--cu-red);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

/* -----------------------------------------------
   Layout
----------------------------------------------- */
.dashboard {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 20px;
}

.top-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
    margin-bottom: 22px;
}

.card {
    background: white;
    padding: 22px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--cu-border);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-header h3 { margin: 0; font-size: 15px; }

/* -----------------------------------------------
   Attendance Card
----------------------------------------------- */
.att-flex {
    display: flex;
    align-items: center;
    gap: 28px;
}

.att-gauge {
    width: 90px;
    height: 90px;
    border: 7px solid var(--cu-red);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 17px;
    color: var(--cu-red);
    transition: border-color 0.4s, color 0.4s;
    flex-shrink: 0;
}

.att-stats p { margin: 6px 0; font-size: 14px; }

.tag-urgent {
    background: var(--cu-red-light);
    color: var(--cu-red);
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.att-progress-track {
    margin-top: 14px;
    height: 5px;
    background: #f0f0f0;
    border-radius: 99px;
    overflow: hidden;
}

.att-progress-bar {
    height: 100%;
    background: var(--cu-red);
    border-radius: 99px;
    transition: width 0.8s ease;
}

/* -----------------------------------------------
   Campus Pulse
----------------------------------------------- */
.pulse-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--cu-border);
}

.pulse-item:last-child { border-bottom: none; }

.pulse-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* -----------------------------------------------
   Tab Navigation
----------------------------------------------- */
.tab-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}

.t-btn {
    flex: 1;
    padding: 11px 8px;
    border: 1.5px solid var(--cu-border);
    background: white;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.18s;
    color: var(--text-main);
    font-family: 'Source Sans 3', sans-serif;
}

.t-btn:hover { border-color: var(--cu-red); color: var(--cu-red); }
.t-btn.active { background: var(--cu-red); color: white; border-color: var(--cu-red); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* -----------------------------------------------
   AI Chat
----------------------------------------------- */
.chat-display {
    height: 320px;
    overflow-y: auto;
    background: #fafafa;
    border: 1px solid var(--cu-border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
}

.chat-bubble strong {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    opacity: 0.6;
}

.chat-bubble p { margin: 0; }

.user-bubble {
    background: var(--cu-red-light);
    border: 1px solid #ffd0d0;
    align-self: flex-end;
    color: var(--cu-dark);
}

.ai-bubble {
    background: white;
    border: 1px solid var(--cu-border);
    align-self: flex-start;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
}

.chat-input-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

/* -----------------------------------------------
   Forms & Inputs
----------------------------------------------- */
input[type="text"], textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--cu-border);
    border-radius: 8px;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 14px;
    color: var(--text-main);
    background: white;
    transition: border-color 0.18s;
    resize: vertical;
}

input[type="text"]:focus, textarea:focus {
    outline: none;
    border-color: var(--cu-red);
    box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.08);
}

textarea { min-height: 100px; margin-bottom: 12px; }

/* -----------------------------------------------
   Buttons
----------------------------------------------- */
.btn-cu {
    background: var(--cu-red);
    color: white;
    border: none;
    padding: 11px 22px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    font-family: 'Source Sans 3', sans-serif;
    transition: background 0.18s, transform 0.1s;
    white-space: nowrap;
}

.btn-cu:hover { background: var(--cu-red-dark); }
.btn-cu:active { transform: scale(0.98); }
.btn-cu:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--cu-border);
    color: var(--text-main);
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Source Sans 3', sans-serif;
    transition: all 0.18s;
    white-space: nowrap;
}

.btn-outline:hover { border-color: var(--cu-red); color: var(--cu-red); }

.sync-btn {
    background: #f0f0f0;
    border: 1px solid var(--cu-border);
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Source Sans 3', sans-serif;
    transition: all 0.18s;
}

.sync-btn:hover { background: #e4e4e4; }
.sync-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* -----------------------------------------------
   Moderation Feedback
----------------------------------------------- */
.mod-msg {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    min-height: 20px;
}

.mod-success { background: var(--success-bg); color: var(--success); border: 1px solid #bbf7d0; }
.mod-error { background: var(--cu-red-light); color: var(--cu-red); border: 1px solid #fecaca; }
.mod-loading { background: #f8fafc; color: var(--text-muted); border: 1px solid var(--cu-border); }

/* -----------------------------------------------
   Grievance Letter Result
----------------------------------------------- */
.letter-result {
    margin-top: 16px;
    padding: 20px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    font-family: 'Source Sans 3', sans-serif;
    min-height: 20px;
}

.letter-success {
    background: #fafaf8;
    border: 1px solid var(--cu-border);
    border-left: 4px solid var(--cu-red);
    color: var(--text-main);
}

.letter-loading {
    background: #f8fafc;
    color: var(--text-muted);
    border: 1px dashed var(--cu-border);
}

.letter-error {
    background: var(--cu-red-light);
    color: var(--cu-red);
    border: 1px solid #fecaca;
}

/* Grievance extra fields */
.grv-meta-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.grv-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* -----------------------------------------------
   Directory
----------------------------------------------- */
.directory-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--cu-border);
    gap: 12px;
}

.directory-item:last-child { border-bottom: none; }

.dir-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dir-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--cu-red-light);
    color: var(--cu-red);
    font-weight: 800;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dir-role { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.dir-email { font-size: 11px; color: var(--cu-red); margin-top: 2px; }

/* -----------------------------------------------
   Status bar
----------------------------------------------- */
.status-msg {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 10px;
}

/* -----------------------------------------------
   Responsive
----------------------------------------------- */
@media (max-width: 768px) {
    .top-row { grid-template-columns: 1fr; }
    .tab-nav { flex-wrap: wrap; }
    .t-btn { flex: 1 1 45%; }
    .grv-meta-row { grid-template-columns: 1fr; }
    .chat-input-row { flex-direction: column; }
    .main-nav { flex-direction: column; gap: 10px; text-align: center; }
}
