/* ============================================================
   style.css - Global Styles
   SRM Institute - Daily Work Progress Reporting System
   ============================================================ */

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

/* ── CSS Variables ── */
:root {
    --srm-navy:     #003087;
    --srm-blue:     #0050b3;
    --srm-gold:     #c8960c;
    --srm-gold-lt:  #f0c535;
    --srm-dark:     #0a1628;
    --srm-grey:     #6b7280;
    --srm-light:    #f4f6fb;
    --srm-white:    #ffffff;
    --srm-border:   #d1d9e6;
    --success:      #16a34a;
    --danger:       #dc2626;
    --warning:      #d97706;
    --radius-sm:    6px;
    --radius-md:    12px;
    --radius-lg:    20px;
    --shadow-sm:    0 1px 3px rgba(0,48,135,0.08);
    --shadow-md:    0 4px 16px rgba(0,48,135,0.12);
    --shadow-lg:    0 8px 32px rgba(0,48,135,0.18);
    --transition:   all 0.25s ease;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--srm-light);
    color: #1e293b;
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--srm-light); }
::-webkit-scrollbar-thumb { background: var(--srm-blue); border-radius: 3px; }

/* ── SRM Header ── */
.srm-header {
    background: linear-gradient(135deg, var(--srm-dark) 0%, var(--srm-navy) 60%, var(--srm-blue) 100%);
    padding: 0;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.srm-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(200,150,12,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.srm-header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px 32px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Logo circle — shows logo.jpg */
.srm-logo-wrap {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    background: var(--srm-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 3px var(--srm-gold), 0 4px 12px rgba(0,48,135,0.3);
    overflow: hidden;
    padding: 4px;
}

/* The actual <img> inside the logo circle */
.srm-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    display: block;
}

.srm-title-block { flex: 1; }

.srm-uni-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--srm-white);
    line-height: 1.2;
    letter-spacing: 0.3px;
}

.srm-campus {
    font-size: 0.82rem;
    color: var(--srm-gold-lt);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-top: 3px;
}

.srm-system-tag {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.65);
    margin-top: 5px;
}

.srm-header-meta {
    text-align: right;
    color: rgba(255,255,255,0.75);
    font-size: 0.8rem;
}

.srm-header-meta strong {
    display: block;
    color: var(--srm-gold-lt);
    font-size: 0.9rem;
}

/* Gold accent stripe */
.srm-stripe {
    height: 4px;
    background: linear-gradient(90deg, var(--srm-gold) 0%, var(--srm-gold-lt) 50%, var(--srm-gold) 100%);
}

/* ── Navbar ── */
.srm-nav {
    background: var(--srm-white);
    border-bottom: 2px solid var(--srm-border);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.srm-nav-links {
    display: flex;
    gap: 4px;
}

.srm-nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 18px;
    color: var(--srm-grey);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.88rem;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
}

.srm-nav-link:hover,
.srm-nav-link.active {
    color: var(--srm-navy);
    border-bottom-color: var(--srm-gold);
    background: rgba(0,48,135,0.04);
}

.srm-nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--srm-grey);
}

.srm-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--srm-navy), var(--srm-blue));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.srm-role-badge {
    background: linear-gradient(135deg, var(--srm-gold), var(--srm-gold-lt));
    color: var(--srm-dark);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.logout-link {
    color: var(--danger) !important;
    border: 1px solid rgba(220,38,38,0.3);
    border-radius: var(--radius-sm);
    padding: 6px 14px !important;
    font-size: 0.82rem;
}

.logout-link:hover { background: rgba(220,38,38,0.08) !important; border-color: var(--danger); }

/* ── Main Content ── */
.srm-main {
    max-width: 1300px;
    margin: 0 auto;
    padding: 28px 24px;
}

/* ── Page Title ── */
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--srm-dark);
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--srm-grey);
    font-size: 0.88rem;
    margin-bottom: 24px;
}

/* ── Cards ── */
.card {
    background: var(--srm-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--srm-border);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 22px;
    background: linear-gradient(90deg, rgba(0,48,135,0.05) 0%, transparent 100%);
    border-bottom: 2px solid var(--srm-border);
}

.card-header-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--srm-navy), var(--srm-blue));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.card-header-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--srm-dark);
}

.card-header-sub {
    font-size: 0.78rem;
    color: var(--srm-grey);
}

.card-body { padding: 22px; }

/* ── Section Card (Form Sections) ── */
.section-card {
    background: var(--srm-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--srm-border);
    margin-bottom: 24px;
    overflow: hidden;
    transition: var(--transition);
}

.section-card:hover { box-shadow: var(--shadow-md); }

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 22px;
    background: linear-gradient(90deg, var(--srm-navy) 0%, var(--srm-blue) 100%);
    color: white;
    cursor: pointer;
    user-select: none;
}

.section-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 2px solid var(--srm-gold);
    color: var(--srm-gold-lt);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
    flex-shrink: 0;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 600;
    flex: 1;
}

.section-chevron {
    transition: transform 0.3s;
    opacity: 0.7;
}

.section-header.collapsed .section-chevron { transform: rotate(-90deg); }

.section-body { padding: 22px; }

/* ── Repeatable Row ── */
.repeat-row {
    background: var(--srm-light);
    border: 1px solid var(--srm-border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
    animation: fadeInRow 0.3s ease;
}

@keyframes fadeInRow {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.remove-row {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(220,38,38,0.1);
    border: 1px solid rgba(220,38,38,0.3);
    color: var(--danger);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
}

.remove-row:hover { background: var(--danger); color: white; }

/* ── Form Elements ── */
.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--srm-dark);
    margin-bottom: 5px;
    display: block;
}

.form-control, .form-select {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--srm-border);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    color: #1e293b;
    background: var(--srm-white);
    transition: var(--transition);
    outline: none;
}

.form-control:focus, .form-select:focus {
    border-color: var(--srm-blue);
    box-shadow: 0 0 0 3px rgba(0,80,179,0.12);
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--srm-navy), var(--srm-blue));
    color: white;
    box-shadow: 0 3px 10px rgba(0,48,135,0.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(0,48,135,0.35); }

.btn-gold {
    background: linear-gradient(135deg, var(--srm-gold), var(--srm-gold-lt));
    color: var(--srm-dark);
    box-shadow: 0 3px 10px rgba(200,150,12,0.25);
}
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(200,150,12,0.35); }

.btn-success {
    background: linear-gradient(135deg, #15803d, var(--success));
    color: white;
}
.btn-success:hover { transform: translateY(-1px); }

.btn-danger {
    background: linear-gradient(135deg, #b91c1c, var(--danger));
    color: white;
}
.btn-danger:hover { transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--srm-border);
    color: var(--srm-grey);
}
.btn-outline:hover { border-color: var(--srm-blue); color: var(--srm-blue); background: rgba(0,80,179,0.04); }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }

.btn-add {
    background: rgba(0,48,135,0.06);
    border: 1.5px dashed var(--srm-blue);
    color: var(--srm-blue);
    width: 100%;
    justify-content: center;
    padding: 10px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}
.btn-add:hover { background: rgba(0,48,135,0.1); }

/* ── Dashboard Stats ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--srm-white);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--srm-border);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-icon-blue  { background: linear-gradient(135deg, var(--srm-navy), var(--srm-blue)); color: white; }
.stat-icon-gold  { background: linear-gradient(135deg, var(--srm-gold), var(--srm-gold-lt)); color: var(--srm-dark); }
.stat-icon-green { background: linear-gradient(135deg, #15803d, #16a34a); color: white; }
.stat-icon-red   { background: linear-gradient(135deg, #b91c1c, #dc2626); color: white; }

.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--srm-dark); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--srm-grey); margin-top: 4px; }

/* ── Table ── */
.srm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.87rem;
}

.srm-table thead th {
    background: linear-gradient(90deg, var(--srm-navy), var(--srm-blue));
    color: white;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.3px;
}

.srm-table thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.srm-table thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

.srm-table tbody tr {
    border-bottom: 1px solid var(--srm-border);
    transition: background 0.15s;
}

.srm-table tbody tr:hover { background: rgba(0,48,135,0.03); }

.srm-table td { padding: 12px 16px; color: #374151; vertical-align: middle; }

.srm-table tbody tr:last-child { border-bottom: none; }

.table-wrap {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--srm-border);
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-blue   { background: rgba(0,80,179,0.12); color: var(--srm-blue); }
.badge-gold   { background: rgba(200,150,12,0.15); color: #92700a; }
.badge-green  { background: rgba(22,163,74,0.12); color: var(--success); }
.badge-red    { background: rgba(220,38,38,0.12); color: var(--danger); }
.badge-grey   { background: rgba(107,114,128,0.12); color: var(--srm-grey); }
.badge-hod    { background: rgba(0,48,135,0.1); color: var(--srm-navy); }
.badge-admin  { background: linear-gradient(90deg,#b91c1c22,#dc262622); color: var(--danger); }

/* ── Priority ── */
.priority-High   { color: var(--danger); font-weight: 700; }
.priority-Medium { color: var(--warning); font-weight: 700; }
.priority-Low    { color: var(--success); font-weight: 700; }

/* ── Login Page ── */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, var(--srm-dark) 0%, var(--srm-navy) 50%, #1a4480 100%);
    position: relative;
    overflow: hidden;
}

.login-bg-pattern {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(200,150,12,0.12) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0,80,179,0.2) 0%, transparent 50%);
    pointer-events: none;
}

.login-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.login-box {
    background: rgba(255,255,255,0.97);
    border-radius: var(--radius-lg);
    padding: 42px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.4);
    backdrop-filter: blur(12px);
}

.login-logo-wrap {
    text-align: center;
    margin-bottom: 28px;
}

/* Login card logo (right side panel) — shows logo.jpg */
.login-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--srm-white);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    box-shadow: 0 0 0 4px var(--srm-gold), 0 8px 24px rgba(0,48,135,0.3);
    overflow: hidden;
    padding: 6px;
}

.login-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.login-uni { font-family: 'Playfair Display', serif; font-size: 1.15rem; font-weight: 700; color: var(--srm-dark); }
.login-campus { font-size: 0.78rem; color: var(--srm-grey); letter-spacing: 1px; text-transform: uppercase; }
.login-system { font-size: 0.82rem; color: var(--srm-blue); font-weight: 600; margin-top: 6px; }

.login-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--srm-dark);
    margin-bottom: 22px;
    text-align: center;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--srm-border);
}

/* ── Alert ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 18px;
    border: 1px solid;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success { background: rgba(22,163,74,0.08); border-color: rgba(22,163,74,0.3); color: #15803d; }
.alert-danger  { background: rgba(220,38,38,0.08); border-color: rgba(220,38,38,0.3); color: #b91c1c; }
.alert-info    { background: rgba(0,80,179,0.08); border-color: rgba(0,80,179,0.3); color: var(--srm-blue); }
.alert-warning { background: rgba(217,119,6,0.08); border-color: rgba(217,119,6,0.3); color: var(--warning); }

/* ── Filter Bar ── */
.filter-bar {
    background: var(--srm-white);
    border: 1px solid var(--srm-border);
    border-radius: var(--radius-md);
    padding: 18px 22px;
    margin-bottom: 22px;
    display: flex;
    gap: 14px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-label { font-size: 0.78rem; font-weight: 600; color: var(--srm-grey); }
.filter-group .form-control,
.filter-group .form-select { min-width: 160px; }

/* ── Footer ── */
.srm-footer {
    background: var(--srm-dark);
    color: rgba(255,255,255,0.55);
    text-align: center;
    padding: 18px;
    font-size: 0.78rem;
    margin-top: 40px;
    border-top: 3px solid var(--srm-gold);
}

.srm-footer span { color: var(--srm-gold-lt); }

/* ── Print Styles ── */
@media print {
    .srm-nav, .btn, .filter-bar, .srm-footer,
    .btn-add, .remove-row, .no-print { display: none !important; }
    .section-body { display: block !important; }
    body { background: white; }
    .srm-header { background: #003087 !important; print-color-adjust: exact; }
}

/* ── Responsive ── */
@media (max-width: 992px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .srm-header-inner { padding: 14px 18px; gap: 14px; }
    .srm-uni-name { font-size: 1.15rem; }
    .srm-main { padding: 18px 14px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-grid-2,
    .form-grid-3,
    .form-grid-4 { grid-template-columns: 1fr; }
    .srm-nav { padding: 12px 14px; flex-wrap: wrap; gap: 10px; justify-content: center; }
    .srm-nav-links { flex-wrap: wrap; justify-content: center; gap: 6px; }
    .srm-nav-user { flex-wrap: wrap; justify-content: center; width: 100%; margin-top: 6px; }
    .login-box { padding: 28px 20px; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-group .form-control, .filter-group .form-select { min-width: 100%; }
    /* Wrap tables to allow horizontal scrolling on tiny screens */
    .table-wrap, .report-section-body, .view-table { overflow-x: auto; display: block; width: 100%; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .srm-header-meta { display: none; }
    .srm-header-inner { flex-direction: column; text-align: center; }
    .srm-logo-wrap { width: 60px; height: 60px; }
}

/* ── Misc ── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.mt-4  { margin-top: 16px; }
.mt-8  { margin-top: 32px; }
.mb-4  { margin-bottom: 16px; }
.mb-8  { margin-bottom: 32px; }
.gap-12 { gap: 12px; }
.flex  { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--srm-grey);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 14px; opacity: 0.5; }
.empty-state h3 { font-size: 1.1rem; color: var(--srm-dark); margin-bottom: 6px; }

/* ── Report View ── */
.report-view-section {
    margin-bottom: 28px;
}

.report-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--srm-white);
    background: linear-gradient(90deg, var(--srm-navy), var(--srm-blue));
    padding: 10px 18px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-section-body {
    border: 1px solid var(--srm-border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    overflow: hidden;
}

.view-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.view-table th {
    background: rgba(0,48,135,0.06);
    font-weight: 600;
    color: var(--srm-navy);
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--srm-border);
    font-size: 0.8rem;
}

.view-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--srm-border);
    vertical-align: top;
}

.view-table tr:last-child td { border-bottom: none; }

/* Animated spinner */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
