/**
 * Bago City College Faculty Attendance System
 * Main Stylesheet — Mobile-First Responsive
 */

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

/* ── Design tokens ───────────────────────────────────────────────────────── */
:root {
    --primary-color:   #1e3a5f;
    --secondary-color: #2c5282;
    --accent-color:    #3182ce;
    --success-color:   #48bb78;
    --warning-color:   #ed8936;
    --danger-color:    #f56565;
    --info-color:      #3182ce;
    --light-color:     #f7fafc;
    --dark-color:      #2d3748;
    --text-color:      #4a5568;
    --text-muted:      #718096;
    --border-color:    #e2e8f0;
    --shadow:          0 4px 6px  rgba(0,0,0,.10);
    --shadow-lg:       0 10px 15px rgba(0,0,0,.10);
    --radius:          8px;
    --transition:      all .3s ease;
    --sidebar-width:   220px;
    --header-height:   60px;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
html { font-size: 16px; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-color);
    -webkit-text-size-adjust: 100%;
}

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background-color: #111;
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 900;
    transition: transform .3s ease;
    overflow-y: auto;
}

/* Sidebar header */
.sidebar-header {
    padding: 8px 12px;
    text-align: center;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.sidebar-header .logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.sidebar-header .logo img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    border-radius: 3px;
}

.sidebar-header .logo span {
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .04em;
}

/* Sidebar nav */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 0;
    margin: 0;
    overflow-y: auto;
}

.sidebar-nav .nav-items {
    display: flex;
    flex-direction: column;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 11px 16px;
    color: #fff;
    text-decoration: none;
    font-size: .88rem;
    gap: 10px;
    transition: background .2s;
    min-height: 44px; /* touch target */
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background-color: #575757;
}

.sidebar-nav .icon {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.sidebar-nav .nav-logout {
    margin-top: auto;
    border-top: 1px solid #333;
}

/* Mobile sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 850;
}

.sidebar-overlay.active { display: block; }

/* ── Main content ────────────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    transition: margin-left .3s ease;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: .75rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 800;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
}

.header-content h1 {
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    transition: var(--transition);
}

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-color);
}

.card-body  { padding: .75rem 0; }

.card-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: .75rem;
}

/* ── Stats grid ──────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: .5rem;
    transition: var(--transition);
}

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

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
}

.stat-icon.primary { background-color: var(--primary-color); }
.stat-icon.success { background-color: var(--success-color); }
.stat-icon.warning { background-color: var(--warning-color); }
.stat-icon.danger  { background-color: var(--danger-color);  }

.stat-info h3, .stat-value {
    font-size: 1.7rem;
    font-weight: bold;
    color: var(--dark-color);
}

.stat-info p, .stat-label {
    font-size: .8rem;
    color: var(--text-muted);
}

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group  { margin-bottom: 1.25rem; }

.form-label {
    display: block;
    margin-bottom: .4rem;
    font-weight: 500;
    color: var(--dark-color);
    font-size: .9rem;
}

.form-control {
    width: 100%;
    padding: .65rem .85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: .95rem;
    transition: var(--transition);
    background: white;
    -webkit-appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(49,130,206,.15);
}

.form-control:disabled {
    background-color: var(--light-color);
    cursor: not-allowed;
}

.form-control-static {
    padding: .4rem 0;
    color: var(--text-color);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-height: 44px;
}

.form-check-input {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .6rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    min-height: 40px;
    touch-action: manipulation;
}

.btn:hover    { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active   { transform: translateY(0); }
.btn-primary  { background: var(--primary-color);   color: white; }
.btn-primary:hover  { background: var(--secondary-color); }
.btn-secondary{ background: var(--secondary-color); color: white; }
.btn-success  { background: var(--success-color);   color: white; }
.btn-warning  { background: var(--warning-color);   color: white; }
.btn-danger   { background: var(--danger-color);    color: white; }
.btn-info     { background: var(--info-color);      color: white; }

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-sm  { padding: .4rem .85rem; font-size: .8rem; min-height: 34px; }
.btn-lg  { padding: .85rem 1.75rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    min-width: 500px;
}

.table th,
.table td {
    padding: .75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: .88rem;
}

.table th {
    background-color: var(--light-color);
    font-weight: 600;
    color: var(--dark-color);
    position: sticky;
    top: 0;
    white-space: nowrap;
}

.table tbody tr:hover { background-color: rgba(49,130,206,.04); }

/* ── Status badges ───────────────────────────────────────────────────────── */
.status-badge {
    display: inline-block;
    padding: .2rem .65rem;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 500;
    white-space: nowrap;
}

.status-badge.success { background: rgba(72,187,120,.12);  color: var(--success-color); }
.status-badge.warning { background: rgba(237,137,54,.12);  color: var(--warning-color); }
.status-badge.danger  { background: rgba(245,101,101,.12); color: var(--danger-color);  }
.status-badge.info    { background: rgba(49,130,206,.12);  color: var(--accent-color);  }
.status-badge.primary { background: rgba(30,58,95,.10);    color: var(--primary-color); }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
    padding: .85rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    border-left: 4px solid;
    font-size: .9rem;
}

.alert-success { background: rgba(72,187,120,.1);  border-color: var(--success-color); color: #276749; }
.alert-warning { background: rgba(237,137,54,.1);  border-color: var(--warning-color); color: #7b3d00; }
.alert-danger  { background: rgba(245,101,101,.1); border-color: var(--danger-color);  color: #9b2335; }
.alert-info    { background: rgba(49,130,206,.1);  border-color: var(--accent-color);  color: #1a4a7a; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active { display: flex; }

.modal-content {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title { font-size: 1.1rem; font-weight: 600; color: var(--dark-color); }

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    line-height: 1;
    padding: .25rem;
    min-width: 36px;
    min-height: 36px;
}

.modal-body   { padding: 1.25rem 1.5rem; }

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: .75rem;
}

/* ── Grid helpers ────────────────────────────────────────────────────────── */
.row { display: flex; flex-wrap: wrap; margin: 0 -.75rem; }

.col-md-3, .col-md-6 { padding: 0 .75rem; flex: 0 0 100%; max-width: 100%; }

/* ── Occupancy map ───────────────────────────────────────────────────────── */
.occupancy-map {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .75rem;
    margin-top: .75rem;
}

.room-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: .85rem;
    border-left: 4px solid;
    transition: var(--transition);
    cursor: pointer;
}

.room-card:hover  { transform: scale(1.03); box-shadow: var(--shadow-lg); }
.room-card.occupied { border-color: var(--danger-color); }
.room-card.vacant   { border-color: var(--success-color); }
.room-card.reserved { border-color: var(--warning-color); }
.room-card h4       { color: var(--dark-color); margin-bottom: .3rem; font-size: .95rem; }
.room-card .status  { font-size: .8rem; font-weight: 500; }
.room-card.occupied .status { color: var(--danger-color); }
.room-card.vacant   .status { color: var(--success-color); }
.room-card.reserved .status { color: var(--warning-color); }

/* ── QR Code section ─────────────────────────────────────────────────────── */
.qr-section {
    text-align: center;
    padding: 1.5rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.qr-code {
    width: 200px;
    height: 200px;
    margin: 1rem auto;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-color);
}

/* ── Login / Register pages ──────────────────────────────────────────────── */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 1.5rem;
}

.login-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem 1.5rem;
    width: 100%;
    max-width: 420px;
}

.login-header { text-align: center; margin-bottom: 1.75rem; }
.login-header h1 { color: var(--primary-color); margin-bottom: .4rem; font-size: 1.6rem; }
.login-header p  { color: var(--text-color); font-size: .9rem; }

/* ── Landing page ────────────────────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 3.5rem 0;
    text-align: center;
}

.hero h1  { font-size: 2rem; margin-bottom: .75rem; }
.hero p   { font-size: 1rem; margin-bottom: 1.5rem; opacity: .9; }

.features { padding: 3rem 0; background: white; }

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    text-align: center;
    padding: 1.75rem;
    border-radius: var(--radius);
    background: var(--light-color);
    transition: var(--transition);
}

.feature-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.feature-icon  { font-size: 2.5rem; margin-bottom: .75rem; }
.feature-card h3 { font-size: 1.2rem; margin-bottom: .75rem; color: var(--dark-color); }
.feature-card p  { color: var(--text-color); font-size: .9rem; }

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn .4s ease; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .5; }
}

.pulse { animation: pulse 2s infinite; }

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

.spinner {
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

/* ── Notification badge ──────────────────────────────────────────────────── */
.notification-badge { position: relative; }

.notification-badge .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    font-weight: bold;
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--text-muted); }
.d-block      { display: block; }
.d-flex       { display: flex; }
.flex-wrap    { flex-wrap: wrap; }
.align-items-center   { align-items: center; }
.align-items-start    { align-items: flex-start; }
.justify-content-between { justify-content: space-between; }
.justify-content-center  { justify-content: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }
.mt-1  { margin-top: .5rem; }
.mt-2  { margin-top: 1rem; }
.mt-3  { margin-top: 1.5rem; }
.mt-4  { margin-top: 2rem; }
.mb-1  { margin-bottom: .5rem; }
.mb-2  { margin-bottom: 1rem; }
.mb-3  { margin-bottom: 1.5rem; }
.mb-4  { margin-bottom: 2rem; }
.p-1   { padding: .5rem; }
.p-2   { padding: 1rem; }
.p-3   { padding: 1.5rem; }
.p-4   { padding: 2rem; }
.hidden { display: none !important; }
.show   { display: block; }

/* ── Responsive breakpoints ──────────────────────────────────────────────── */

/* Small phones (< 480px) */
@media (max-width: 479px) {
    .header-content h1  { font-size: .95rem; }
    .stats-grid         { grid-template-columns: 1fr 1fr; }
    .stat-icon          { width: 42px; height: 42px; font-size: 1.1rem; }
    .stat-info h3       { font-size: 1.3rem; }
    .btn                { padding: .55rem 1rem; font-size: .82rem; }
    .btn-lg             { padding: .7rem 1.2rem; }
    .card               { padding: 1rem; }
    .login-card         { padding: 1.5rem 1rem; }
    .hero h1            { font-size: 1.5rem; }
    .table th,
    .table td           { padding: .55rem .65rem; font-size: .8rem; }
}

/* Mobile (≤ 768px) — sidebar becomes an overlay drawer */
@media (max-width: 768px) {
    /* Sidebar slides off-screen by default */
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
        box-shadow: none;
    }

    /* Sidebar open state */
    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,.35);
    }

    /* Main content takes full width */
    .main-content {
        margin-left: 0 !important;
    }

    .main-content .container { padding: 0 .75rem; }

    /* Main content pushed when sidebar open */
    body.sidebar-open .main-content {
        /* Don't push on mobile — sidebar overlays */
    }

    /* Stats: 2-column on phone */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: .75rem;
    }

    /* Form rows collapse to single column */
    .form-row { grid-template-columns: 1fr; }

    /* Grid cols full-width */
    .col-md-3, .col-md-6 { flex: 0 0 100%; max-width: 100%; }

    /* Header button groups wrap */
    .header-content { gap: .4rem; }
    .d-flex.gap-2   { flex-wrap: wrap; }

    /* Cards slightly tighter */
    .card { padding: 1rem; }

    /* Hero text */
    .hero h1 { font-size: 1.6rem; }
    .hero    { padding: 2.5rem 0; }

    /* Occupancy grid */
    .occupancy-map { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }

    /* Login card full-width */
    .login-card { padding: 1.75rem 1.25rem; }

    /* Modal full-screen on small screens */
    .modal { padding: .5rem; align-items: flex-end; }
    .modal-content { max-height: 92vh; border-radius: var(--radius) var(--radius) 0 0; }

    /* Table cells tighter */
    .table th, .table td { padding: .6rem .75rem; font-size: .83rem; }

    /* Buttons in header - icon only hint */
    .header-content .btn-sm span { display: none; }

    /* Dashboard quick-action rows */
    .dashboard-actions { flex-wrap: wrap; gap: .5rem; }
}

/* Tablet (769px – 1024px) — sidebar shown but narrower */
@media (min-width: 769px) and (max-width: 1024px) {
    :root { --sidebar-width: 200px; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .col-md-6 { flex: 0 0 50%; max-width: 50%; }

    .hero h1 { font-size: 2.25rem; }

    .main-content { padding: 1rem; }
}

/* Desktop (≥ 1025px) */
@media (min-width: 1025px) {
    .col-md-3 { flex: 0 0 25%; max-width: 25%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }

    .main-content { padding: 1.5rem 2rem; }

    .hero h1 { font-size: 2.75rem; }
    .hero p  { font-size: 1.2rem; }
}

/* Print */
@media print {
    .sidebar, .sidebar-overlay, header, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    body { font-size: 11pt; background: white; }
}
