/* AVLoans — AV Equipment Booking Portal
   Srishti Manipal Institute
   Palette: #F7941D (orange), #C8102E (red), neutral grays */

/* ── Reset & base ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --orange:     #F7941D;
    --orange-lt:  #FEF3E6;
    --red:        #C8102E;
    --red-lt:     #FDECEA;
    --dark:       #1A1A1A;
    --mid:        #4A4A4A;
    --muted:      #888;
    --border:     #E0E0E0;
    --bg:         #F4F4F5;
    --white:      #FFFFFF;
    --success:    #2E7D32;
    --success-lt: #E8F5E9;
    --warning:    #E65100;
    --warning-lt: #FFF3E0;
    --info:       #01579B;
    --info-lt:    #E1F5FE;
    --radius:     6px;
    --shadow:     0 1px 4px rgba(0,0,0,.08);
    --shadow-md:  0 2px 12px rgba(0,0,0,.12);
    --font:       'Segoe UI', system-ui, -apple-system, sans-serif;
    --sidebar-w:  260px;
    --topbar-h:   48px;
}

html { font-size: 15px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
ul { list-style: none; }

/* ── Sidebar ──────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 1.25rem 1.1rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: .6rem;
}
.sidebar-logo img {
    width: 100%;
    max-width: 210px;
    height: auto;
}
.sidebar-portal-name {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

.sidebar-nav {
    flex: 1;
    padding: .75rem 0;
    overflow-y: auto;
}

.sidebar-section {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    padding: .9rem 1.1rem .3rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .5rem 1.1rem;
    font-size: .875rem;
    font-weight: 500;
    color: var(--mid);
    text-decoration: none;
    border-radius: 0;
    transition: background .12s, color .12s;
    position: relative;
}
.sidebar-link:hover { background: var(--bg); color: var(--dark); text-decoration: none; }
.sidebar-link.active {
    background: var(--orange-lt);
    color: var(--orange);
}
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--orange);
    border-radius: 0 2px 2px 0;
}
.sidebar-link svg { flex-shrink: 0; opacity: .7; }
.sidebar-link.active svg { opacity: 1; }

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: .5rem 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1.1rem;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
    font-size: .82rem;
    font-weight: 600;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-signout {
    color: var(--muted);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: .3rem;
    border-radius: var(--radius);
    text-decoration: none;
}
.sidebar-signout:hover { color: var(--red); background: var(--red-lt); text-decoration: none; }

/* Notification bell in sidebar footer */
.sidebar-footer .notif-bell {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .5rem 1.1rem;
    font-size: .875rem;
    font-weight: 500;
    color: var(--mid);
    text-decoration: none;
    transition: background .12s, color .12s;
}
.sidebar-footer .notif-bell:hover { background: var(--bg); color: var(--dark); text-decoration: none; }
.sidebar-footer .notif-bell.active { background: var(--orange-lt); color: var(--orange); }

.notif-count {
    background: var(--red);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ── Page wrap & main content ─────────────── */
.page-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.page-wrap.with-sidebar {
    margin-left: var(--sidebar-w);
}

.main-content {
    flex: 1;
    padding: 2rem 0 3rem;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

/* ── Mobile top bar ───────────────────────── */
.mobile-topbar {
    display: none;
    align-items: center;
    gap: .75rem;
    padding: 0 1rem;
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 150;
}
.mobile-portal-name {
    font-size: .9rem;
    font-weight: 700;
    color: var(--dark);
    letter-spacing: .04em;
}
.hamburger {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: .4rem;
}
.hamburger span {
    display: block;
    width: 20px; height: 2px;
    background: var(--mid);
    border-radius: 2px;
    transition: background .15s;
}
.hamburger:hover span { background: var(--dark); }

.notif-bell {
    position: relative;
    color: var(--mid);
    display: flex;
    align-items: center;
    text-decoration: none;
}
.notif-bell:hover { color: var(--orange); text-decoration: none; }
.notif-bell .notif-count {
    position: absolute;
    top: -5px; right: -6px;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 190;
}
body.sidebar-open .sidebar-overlay { display: block; }
body.sidebar-open .sidebar { transform: translateX(0); }

/* ── Login page ───────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: var(--bg);
}
.login-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-logo img { max-width: 200px; height: auto; }
.login-logo h1 { font-size: 1.1rem; font-weight: 700; color: var(--dark); margin-top: .75rem; }
.login-logo p  { font-size: .82rem; color: var(--muted); }

/* ── Cards ────────────────────────────────── */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}
.card-title { font-size: 1rem; font-weight: 600; color: var(--dark); }

/* ── Page header ──────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: .75rem;
}
.page-header h1 { font-size: 1.4rem; font-weight: 700; color: var(--dark); }
.page-header p  { color: var(--muted); font-size: .9rem; margin-top: .2rem; }

/* ── Buttons ──────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1.1rem;
    border-radius: var(--radius);
    font-size: .88rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
    line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary  { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn-primary:hover { background: #e0840f; border-color: #e0840f; color: #fff; }

.btn-danger   { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #a80d25; border-color: #a80d25; color: #fff; }

.btn-outline  { background: transparent; color: var(--mid); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); color: var(--dark); }

.btn-success  { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #1b5e20; color: #fff; }

.btn-sm { padding: .3rem .75rem; font-size: .82rem; }

/* ── Forms ────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 500;
    color: var(--mid);
    margin-bottom: .35rem;
}
.form-control {
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .9rem;
    font-family: var(--font);
    color: var(--dark);
    background: var(--white);
    transition: border-color .15s;
    line-height: 1.5;
}
.form-control:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(247,148,29,.12);
}
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-hint  { font-size: .8rem;  color: var(--muted); margin-top: .25rem; }
.form-error { font-size: .8rem;  color: var(--red);   margin-top: .25rem; }
.required::after { content: ' *'; color: var(--red); }

/* ── Tables ───────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th {
    text-align: left;
    padding: .6rem .9rem;
    background: var(--bg);
    color: var(--mid);
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 2px solid var(--border);
}
td {
    padding: .7rem .9rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--dark);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ── Badges ───────────────────────────────── */
.badge {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 20px;
    font-size: .73rem;
    font-weight: 600;
    letter-spacing: .02em;
}
.badge-success   { background: var(--success-lt); color: var(--success); }
.badge-warning   { background: var(--warning-lt); color: var(--warning); }
.badge-danger    { background: var(--red-lt);     color: var(--red); }
.badge-info      { background: var(--info-lt);    color: var(--info); }
.badge-secondary { background: var(--bg);         color: var(--muted); }
.badge-student   { background: var(--orange-lt);  color: var(--orange); }
.badge-faculty   { background: var(--info-lt);    color: var(--info); }
.badge-admin     { background: var(--red-lt);     color: var(--red); }

/* ── Alerts ───────────────────────────────── */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: .9rem;
    border-left: 3px solid transparent;
}
.alert-success { background: var(--success-lt); color: var(--success); border-color: var(--success); }
.alert-error   { background: var(--red-lt);     color: var(--red);     border-color: var(--red); }
.alert-warning { background: var(--warning-lt); color: var(--warning); border-color: var(--warning); }
.alert-info    { background: var(--info-lt);    color: var(--info);    border-color: var(--info); }

/* ── Stats grid ───────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1rem;
    text-align: center;
}
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--orange); line-height: 1; }
.stat-card .stat-label { font-size: .75rem; color: var(--muted); margin-top: .35rem; text-transform: uppercase; letter-spacing: .04em; }

/* ── Equipment grid ───────────────────────── */
.equipment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}
.equipment-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s;
}
.equipment-card:hover { box-shadow: var(--shadow-md); }
.equipment-card img { width: 100%; height: 160px; object-fit: cover; background: var(--bg); }
.equipment-card-body { padding: 1rem; flex: 1; display: flex; flex-direction: column; }
.equipment-card-name { font-weight: 600; font-size: .95rem; color: var(--dark); margin-bottom: .25rem; }
.equipment-card-category { font-size: .78rem; color: var(--muted); margin-bottom: .5rem; }
.equipment-card-avail { font-size: .85rem; color: var(--success); font-weight: 500; margin-top: auto; }
.equipment-card-avail.none { color: var(--red); }

/* ── Booking thread ───────────────────────── */
.thread { display: flex; flex-direction: column; gap: .75rem; }
.thread-msg { display: flex; gap: .75rem; font-size: .88rem; }
.thread-msg.system { justify-content: center; text-align: center; }
.thread-msg.system .thread-bubble {
    background: var(--bg); color: var(--muted); font-size: .8rem;
    border: none; padding: .35rem .75rem; border-radius: 20px;
}
.thread-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--orange-lt); color: var(--orange);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .8rem; flex-shrink: 0;
}
.thread-bubble {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: .6rem .9rem; flex: 1;
}
.thread-meta { font-size: .75rem; color: var(--muted); margin-bottom: .2rem; }
.thread-form { margin-top: 1rem; display: flex; gap: .5rem; }
.thread-form textarea { flex: 1; }

/* ── Barcodes ─────────────────────────────── */
.barcode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.barcode-sticker {
    border: 1px dashed var(--border); border-radius: var(--radius);
    padding: .75rem; text-align: center; background: var(--white);
}
.barcode-sticker svg { max-width: 100%; }
.barcode-sticker .asset-tag { font-size: .75rem; font-weight: 600; margin-top: .35rem; font-family: monospace; }
.barcode-sticker .equip-name { font-size: .72rem; color: var(--muted); }

/* ── Notifications ────────────────────────── */
.notif-list { display: flex; flex-direction: column; gap: .5rem; }
.notif-item {
    display: flex; gap: .75rem; padding: .75rem 1rem;
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius); font-size: .88rem; align-items: flex-start;
}
.notif-item.unread { border-left: 3px solid var(--orange); background: var(--orange-lt); }
.notif-item .notif-msg { flex: 1; color: var(--dark); }
.notif-item .notif-time { font-size: .78rem; color: var(--muted); white-space: nowrap; }

/* ── Checklist ────────────────────────────── */
.checklist { display: flex; flex-direction: column; gap: .5rem; }
.checklist-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .5rem .75rem; background: var(--bg); border-radius: var(--radius); font-size: .88rem;
}

/* ── Status stepper ───────────────────────── */
.stepper { display: flex; align-items: center; margin-bottom: 1.5rem; overflow-x: auto; }
.step {
    display: flex; flex-direction: column; align-items: center;
    gap: .25rem; flex: 1; min-width: 80px; position: relative;
    font-size: .75rem; color: var(--muted); text-align: center;
}
.step::before {
    content: ''; position: absolute;
    top: 12px; right: -50%; width: 100%; height: 2px;
    background: var(--border); z-index: 0;
}
.step:last-child::before { display: none; }
.step-dot { width: 24px; height: 24px; border-radius: 50%; background: var(--border); z-index: 1; position: relative; }
.step.done   .step-dot  { background: var(--success); }
.step.active .step-dot  { background: var(--orange); box-shadow: 0 0 0 3px var(--orange-lt); }
.step.done   .step-label { color: var(--success); }
.step.active .step-label { color: var(--orange); font-weight: 600; }

/* ── Tabs ─────────────────────────────────── */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; }
.tab-btn {
    padding: .6rem 1.1rem; font-size: .88rem; font-weight: 500;
    color: var(--muted); background: none; border: none; cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: color .15s; text-decoration: none; display: inline-block;
}
.tab-btn:hover { color: var(--dark); text-decoration: none; }
.tab-btn.active { color: var(--orange); border-bottom-color: var(--orange); }

/* ── Empty state ──────────────────────────── */
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--muted); }
.empty-state h2 { font-size: 1.2rem; margin-bottom: .5rem; color: var(--mid); }
.empty-state p  { margin-bottom: 1.25rem; }

/* ── Filter bar ───────────────────────────── */
.filter-bar { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.25rem; }
.filter-bar .form-control { width: auto; min-width: 150px; }

/* ── Qty control ──────────────────────────── */
.qty-control { display: flex; align-items: center; gap: .4rem; }

/* ── Cart qty controls (on equipment cards) ─ */
.cart-qty-wrap {
    display: none;
    align-items: center;
    gap: .4rem;
}
.cart-qty-wrap .cart-qty-btn {
    width: 30px; height: 30px;
    padding: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
}
.cart-qty-num {
    min-width: 28px;
    text-align: center;
    font-weight: 600;
    font-size: .95rem;
    color: var(--dark);
}
.cart-remove-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: .85rem;
    padding: .2rem .35rem;
    margin-left: .1rem;
    border-radius: var(--radius);
    transition: color .15s, background .15s;
}
.cart-remove-btn:hover { color: var(--red); background: var(--red-lt); }

/* ── Equipment access lock ────────────────── */
.equip-locked {
    opacity: .7;
}
.equip-lock-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .78rem;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .25rem .55rem;
    background: var(--bg);
}

/* ── Print ────────────────────────────────── */
@media print {
    .sidebar, .mobile-topbar, .btn, .no-print { display: none !important; }
    .page-wrap.with-sidebar { margin-left: 0; }
    body { background: #fff; }
    .barcode-sticker { break-inside: avoid; border: 1px solid #000; }
}

/* ── Responsive ───────────────────────────── */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: var(--shadow-md);
    }
    .page-wrap.with-sidebar { margin-left: 0; }
    .mobile-topbar { display: flex; }
    .main-content { padding-top: 1.5rem; }
}

@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .equipment-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .barcode-grid { grid-template-columns: repeat(2, 1fr); }
    .page-header { flex-direction: column; }
}

@media (max-width: 480px) {
    .login-box { padding: 1.75rem 1.25rem; }
    .card { padding: 1rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
