/* ============================================================
   Internship Monitoring System - Component Styles (Mobile-First)
   ============================================================ */

/* ─── Cards ────────────────────────────────────────── */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--color-border);
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.card-body {
    font-size: var(--font-size-sm);
}

/* ─── Stat Cards (Dashboard) ───────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.stat-value {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
    margin-top: 4px;
}

/* ─── Buttons ──────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    min-height: var(--tap-target);
    text-decoration: none;
    transition: background 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}
.btn-primary:hover { background: var(--color-primary-dark); }

.btn-success {
    background: var(--color-accent);
    color: white;
}
.btn-success:hover { background: var(--color-accent-dark); }

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-warning {
    background: var(--color-warning);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: var(--font-size-xs);
    min-height: 36px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: var(--font-size-lg);
    min-height: 52px;
    border-radius: var(--radius-md);
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ─── Forms ────────────────────────────────────────── */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--color-text);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-base);
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(26, 82, 118, 0.1);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-error {
    color: var(--color-danger);
    font-size: var(--font-size-xs);
    margin-top: 4px;
}

.form-hint {
    color: var(--color-text-light);
    font-size: var(--font-size-xs);
    margin-top: 4px;
}

/* ─── Tabs ─────────────────────────────────────────── */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: var(--spacing-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    padding: 10px var(--spacing-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text-light);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    white-space: nowrap;
    min-height: var(--tap-target);
    transition: color 0.2s, border-color 0.2s;
}

.tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* ─── Badges ───────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    line-height: 1.6;
}

.badge-success { background: #d5f5e3; color: #1e8449; }
.badge-warning { background: #fdebd0; color: #b7950b; }
.badge-danger  { background: #fadbd8; color: #c0392b; }
.badge-info    { background: #d6eaf8; color: #2471a3; }
.badge-neutral { background: #eaecee; color: #5d6d7e; }

/* ─── Tables (responsive) ──────────────────────────── */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

th {
    font-weight: 600;
    color: var(--color-text-light);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

tr:hover td {
    background: rgba(26, 82, 118, 0.02);
}

/* ─── Modals ───────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1500;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    min-width: var(--tap-target);
    min-height: var(--tap-target);
}

.modal-body {
    padding: var(--spacing-md);
}

.modal-footer {
    padding: var(--spacing-md);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}

/* ─── Camera Preview ───────────────────────────────── */
.camera-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto var(--spacing-md);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
}

.camera-container video {
    width: 100%;
    display: block;
}

.camera-container canvas {
    display: none;
}

.camera-overlay {
    position: absolute;
    bottom: 12px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
}

.camera-capture-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid white;
    background: rgba(255,255,255,0.3);
    cursor: pointer;
}

.camera-capture-btn:active {
    background: rgba(255,255,255,0.7);
}

/* ─── GPS Status ───────────────────────────────────── */
.gps-status {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 10px var(--spacing-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-md);
}

.gps-active {
    background: #d5f5e3;
    color: #1e8449;
}

.gps-searching {
    background: #fdebd0;
    color: #b7950b;
}

.gps-error {
    background: #fadbd8;
    color: #c0392b;
}

.gps-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.gps-active .gps-dot    { background: #27ae60; }
.gps-searching .gps-dot { background: #f39c12; animation: pulse 1.5s infinite; }
.gps-error .gps-dot     { background: #e74c3c; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

/* ─── Attendance Buttons ───────────────────────────── */
.attendance-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.attendance-btn {
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    border: none;
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: white;
    cursor: pointer;
    min-height: 80px;
    transition: transform 0.1s, opacity 0.2s;
}

.attendance-btn:active {
    transform: scale(0.96);
}

.attendance-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-time-in {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.btn-time-out {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

/* ─── Notification Bell ────────────────────────────── */
.notif-bell {
    position: relative;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    min-width: var(--tap-target);
    min-height: var(--tap-target);
}

.notif-count {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--color-danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── Progress Bar ─────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--color-border);
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease;
}

.progress-fill.success { background: var(--color-accent); }
.progress-fill.primary { background: var(--color-primary); }
.progress-fill.warning { background: var(--color-warning); }
.progress-fill.danger  { background: var(--color-danger); }

/* ─── Empty State ──────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--color-text-light);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

/* ─── Auth Pages ───────────────────────────────────── */
.auth-container {
    max-width: 400px;
    margin: var(--spacing-xl) auto;
}

.auth-logo {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.auth-logo .logo-text {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--color-primary);
}

.auth-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
}

.auth-footer {
    text-align: center;
    margin-top: var(--spacing-lg);
    font-size: var(--font-size-sm);
}

/* Bootstrap 5.3 + Tabler visual bridge */
.page-body {
    --bs-body-font-size: 0.875rem;
}

.page-body .card,
.auth-card {
    --bs-card-border-color: var(--tblr-border-color);
    --bs-card-border-radius: var(--tblr-border-radius-lg);
    --bs-card-cap-bg: transparent;
    background: var(--tblr-bg-surface);
    border: 1px solid var(--tblr-border-color);
    border-radius: var(--tblr-border-radius-lg);
    box-shadow: var(--tblr-shadow-card);
    margin-bottom: 1.5rem;
    padding: 0;
}

.page-body .card-header {
    min-height: 3.25rem;
    padding: 0.875rem 1rem;
    margin: 0;
    border-bottom: 1px solid var(--tblr-border-color);
    background: transparent;
}

.page-body .card-body {
    padding: 1rem;
    color: var(--tblr-body-color);
}

.page-body .card > form,
.page-body .card > p,
.page-body .card > .form-error {
    margin-left: 1rem;
    margin-right: 1rem;
}

.page-body .card > form { margin-top: 1rem; margin-bottom: 1rem; }
.page-body .card > p { margin-top: 0.5rem; margin-bottom: 0.5rem; }
.card-title { font-size: 0.875rem; font-weight: 600; letter-spacing: 0; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    position: relative;
    min-height: 126px;
    padding: 1rem;
    overflow: hidden;
    text-align: left;
    background: var(--tblr-bg-surface);
    border: 1px solid var(--tblr-border-color);
    border-radius: var(--tblr-border-radius-lg);
    box-shadow: var(--tblr-shadow-card);
}

.stat-icon {
    display: inline-flex;
    width: 2.25rem;
    height: 2.25rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    border-radius: var(--tblr-border-radius);
    font-size: 1rem;
}
.stat-icon-primary { color: #4f46e5; background: #eef2ff; }
.stat-icon-success { color: #16a34a; background: #e8f7ee; }
.stat-icon-info { color: #0ea5e9; background: #e6f7fe; }
.stat-icon-warning { color: #d97706; background: #fef3e2; }
.stat-value { color: var(--tblr-body-color); font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat-label { margin-top: 0.25rem; color: var(--tblr-muted); font-size: 0.75rem; font-weight: 500; }

.btn {
    --bs-btn-font-size: 0.875rem;
    --bs-btn-border-radius: 4px;
    --bs-btn-font-weight: 600;
    min-height: 2.375rem;
    box-shadow: none;
}
.btn-primary { --bs-btn-bg: #4f46e5; --bs-btn-border-color: #4f46e5; --bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca; --bs-btn-active-bg: #4338ca; background-image: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); }
.btn-outline-primary { --bs-btn-color: #4f46e5; --bs-btn-border-color: #c7c4f7; --bs-btn-hover-bg: #eef2ff; --bs-btn-hover-color: #4338ca; --bs-btn-hover-border-color: #b3b0f3; --bs-btn-active-bg: #e0e4ff; --bs-btn-active-color: #4338ca; }
.btn-success { --bs-btn-bg: #2fb344; --bs-btn-border-color: #2fb344; --bs-btn-hover-bg: #269438; --bs-btn-hover-border-color: #269438; }
.btn-danger { --bs-btn-bg: #d63939; --bs-btn-border-color: #d63939; }
.btn-block { width: 100%; }

.form-group { margin-bottom: 1rem; }
.form-label { margin-bottom: 0.375rem; color: #334155; font-size: 0.8125rem; font-weight: 600; }
.form-control,
.form-select,
.form-input,
.form-textarea {
    min-height: 2.375rem;
    border-color: #cbd5e1;
    border-radius: 4px;
    box-shadow: none;
    color: var(--tblr-body-color);
    font-size: 0.875rem;
}
textarea.form-control,
.form-textarea { min-height: 7.25rem; padding-top: 0.625rem; }
.form-control:focus,
.form-select:focus,
.form-input:focus,
.form-textarea:focus {
    border-color: #a5a3f5;
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.14);
}
.form-hint { margin-top: 0.375rem; color: var(--tblr-muted); font-size: 0.75rem; }
.form-error { margin-top: 0.5rem; color: #d63939; font-size: 0.8125rem; }

.tabs {
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--tblr-border-color);
}
.tab {
    min-height: 2.5rem;
    padding: 0.625rem 0.875rem;
    color: var(--tblr-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    border-width: 0 0 2px;
    border-radius: 0;
}
.tab:hover { color: #4f46e5; background: #f5f6ff; }
.tab.active { color: #4f46e5; border-bottom-color: #4f46e5; }

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.5rem;
    padding: 0.1875rem 0.5rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0;
}
.badge-success { color: #15803d; background: #e8f7ee; }
.badge-warning { color: #b45309; background: #fef3e2; }
.badge-danger { color: #b91c1c; background: #fdecec; }
.badge-info { color: #0e7490; background: #e6f7fe; }
.badge-neutral { color: #526173; background: #edf1f5; }

.table-responsive { border-radius: 0 0 var(--tblr-border-radius-lg) var(--tblr-border-radius-lg); }
.table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: #f8fafc;
    --bs-table-border-color: var(--tblr-border-color);
    margin-bottom: 0;
    color: var(--tblr-body-color);
    font-size: 0.8125rem;
}
.table > :not(caption) > * > * { padding: 0.75rem 1rem; vertical-align: middle; }
.table thead th { color: var(--tblr-muted); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.04em; white-space: nowrap; }

.datagrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--tblr-border-color); border-radius: 4px; overflow: hidden; }
.datagrid-item { min-height: 4.75rem; padding: 0.75rem; border-right: 1px solid var(--tblr-border-color); border-bottom: 1px solid var(--tblr-border-color); }
.datagrid-item:nth-child(even) { border-right: 0; }
.datagrid-item:nth-last-child(-n + 2) { border-bottom: 0; }
.datagrid-title { margin-bottom: 0.25rem; color: var(--tblr-muted); font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.datagrid-content { color: var(--tblr-body-color); font-size: 0.875rem; font-weight: 600; }
.progress-label { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; color: var(--tblr-muted); font-size: 0.8125rem; }
.progress { height: 0.5rem; background: #e9eef5; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: inherit; }
.progress-bar-primary { background: linear-gradient(90deg, #6366f1, #4f46e5); }

.gps-indicator,
.gps-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.875rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.8125rem;
}
.gps-active { color: #1b7a2b; background: #eaf7ed; border-color: #ccecd2; }
.gps-searching { color: #9a5a00; background: #fff4dd; border-color: #f7dfa8; }
.gps-error { color: #ad2222; background: #fce8e8; border-color: #f3c4c4; }
.gps-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; flex: 0 0 auto; }
.gps-active .gps-dot { background: #2fb344; }.gps-searching .gps-dot { background: #f59f00; }.gps-error .gps-dot { background: #d63939; }

.permission-card .card-body { padding: 1rem; }
.permission-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.permission-actions .btn { min-width: 0; }

.location-card { overflow: hidden; }
.live-map-wrap { height: 14rem; background: #edf6ef; }
.live-map-wrap iframe { display: block; width: 100%; height: 100%; border: 0; }

.camera-container { max-width: 36rem; margin: 0 auto 1rem; border: 1px solid #1e293b; border-radius: var(--tblr-border-radius-lg); box-shadow: var(--tblr-shadow-card); }
.camera-container video { min-height: 13rem; object-fit: cover; }
.camera-overlay { padding-bottom: 1rem; }
.camera-btn,
.camera-capture-btn { width: 3.5rem; height: 3.5rem; border: 4px solid #fff; background: rgba(79, 70, 229, 0.9); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35); }
.attendance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin: 1rem 0 1.5rem; }
.attendance-btn { min-height: 4.25rem; border: 1px solid transparent; border-radius: 4px; box-shadow: var(--tblr-shadow-card); font-size: 0.875rem; }
.btn-time-in { background: #2fb344; }.btn-time-out { background: #d63939; }

.modal-overlay { background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(2px); }
.modal { border: 1px solid var(--tblr-border-color); border-radius: var(--tblr-border-radius-lg); box-shadow: 0 1rem 3rem rgba(15, 23, 42, 0.18); }
.modal-header,.modal-footer { padding: 1rem; border-color: var(--tblr-border-color); }.modal-body { padding: 1rem; }

.auth-wrapper { display: grid; min-height: calc(100vh - var(--tblr-navbar-height) - 3rem); place-items: center; }
.auth-container { width: min(100%, 25rem); margin: 2rem auto; }
.auth-logo { margin-bottom: 1.5rem; }.auth-logo h1 { margin: 0.875rem 0 0; color: var(--tblr-body-color); font-size: 1.25rem; font-weight: 700; }
.auth-logo-icon { display: inline-grid; width: 3.5rem; height: 3.5rem; place-items: center; color: #fff; background: linear-gradient(135deg, #6366f1, #4f46e5); border-radius: 8px; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.06em; box-shadow: 0 0.5rem 1rem rgba(79, 70, 229, 0.2); }
.auth-card { padding: 1.5rem; }.auth-card-title { margin-bottom: 1.25rem; color: var(--tblr-body-color); font-size: 1rem; font-weight: 600; }.auth-footer { margin-top: 1rem; color: var(--tblr-muted); font-size: 0.8125rem; }

@media (min-width: 768px) {
    .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .stat-card { min-height: 140px; }
    .datagrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .datagrid-item { border-bottom: 0; }
    .datagrid-item:nth-child(even) { border-right: 1px solid var(--tblr-border-color); }
    .datagrid-item:last-child { border-right: 0; }
    .auth-wrapper { min-height: calc(100vh - var(--tblr-navbar-height) - 4rem); }
}
