@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #14b8a6;
    --primary-dark: #0d9488;
    --accent-blue: #6366f1;
    --danger-grad-start: #f43f5e;
    --danger-grad-end: #a855f7;
    --bg: #f4f6f9;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #94a3b8;
    --border: #eef1f5;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 20px;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 90px;
}

h2, h3 {
    font-weight: 700;
}

/* ========== APP HEADER ========== */
.app-header {
    background: var(--card);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--text);
}

.app-logo .logo-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
}

.app-logo small {
    display: block;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: -2px;
}

.header-avatar img, .header-avatar .avatar-placeholder {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.header-avatar .avatar-placeholder {
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

/* ========== LOGIN ========== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg);
}

.login-card {
    background: var(--card);
    border-radius: 28px;
    padding: 50px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(20, 184, 166, 0.08);
    text-align: center;
}

.login-card .logo-icon-lg {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), var(--accent-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    color: white;
}

.login-card h2 {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.login-card .form-control {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 14px;
    padding: 14px 18px;
    font-size: 0.95rem;
    margin-bottom: 14px;
}

.login-card .form-control:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.12);
    color: var(--text);
}

.login-card .btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 14px;
    padding: 15px;
    font-weight: 700;
    font-size: 1rem;
    width: 100%;
}

/* ========== HOME / CLOCK CARD ========== */
.clock-hero {
    text-align: center;
    padding: 24px 20px 8px;
}

.clock-hero .time-display {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.clock-hero .date-display {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.clock-action-btn {
    width: 190px;
    height: 190px;
    border-radius: 32px;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 auto;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.clock-action-btn:hover {
    transform: scale(1.03);
    color: white;
}

.clock-action-btn.state-in {
    background: linear-gradient(135deg, #2dd4bf, var(--accent-blue));
    box-shadow: 0 15px 35px rgba(20, 184, 166, 0.35);
}

.clock-action-btn.state-out {
    background: linear-gradient(135deg, var(--danger-grad-start), var(--danger-grad-end));
    box-shadow: 0 15px 35px rgba(244, 63, 94, 0.35);
}

.clock-action-btn.state-done {
    background: white;
    border: 2px solid var(--border);
    color: var(--text);
    box-shadow: none;
}

.clock-action-btn i {
    font-size: 2.2rem;
}

.stats-row {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 28px 20px;
    text-align: center;
}

.stats-row .stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 6px;
    color: var(--primary);
    font-size: 0.95rem;
}

.stats-row .stat-value {
    font-weight: 700;
    font-size: 0.95rem;
}

.stats-row .stat-label {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ========== CARDS ========== */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 2px 12px rgba(0,0,0,0.03);
}

.card .form-control, .card textarea {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 14px;
    padding: 13px 16px;
}

.card .form-control:focus, .card textarea:focus {
    background: white;
    border-color: var(--primary);
    color: var(--text);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.12);
}

/* ========== BOTTOM NAV ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 200;
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 500;
    flex: 1;
}

.bottom-nav a i {
    font-size: 1.3rem;
}

.bottom-nav a.active {
    color: var(--primary);
}

/* ========== PROFILE / MORE PAGE ========== */
.profile-header {
    text-align: center;
    padding: 30px 20px 10px;
}

.profile-header img, .profile-header .avatar-placeholder-lg {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 12px;
}

.profile-header .avatar-placeholder-lg {
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--text-muted);
    margin: 0 auto 12px;
}

.profile-header h4 {
    font-weight: 700;
    margin-bottom: 2px;
}

.profile-header p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.menu-list {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.menu-list a, .menu-list .menu-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
    font-weight: 500;
}

.menu-list a:last-child, .menu-list .menu-row:last-child {
    border-bottom: none;
}

.menu-list a:hover {
    background: var(--bg);
}

.menu-list i.menu-icon {
    color: var(--primary);
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}

.menu-list .chevron {
    margin-left: auto;
    color: var(--text-muted);
}

/* ========== ATTENDANCE LIST ========== */
.attendance-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.attendance-row:last-child {
    border-bottom: none;
}

.attendance-row .att-date {
    font-weight: 600;
    font-size: 0.9rem;
}

.attendance-row .att-times {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.status-pill {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

.status-pill.present {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
}

.status-pill.pending {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
}

.status-pill.absent {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
}

/* ========== DOCUMENTS ========== */
.doc-box {
    border: 1.5px dashed var(--border);
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg);
    aspect-ratio: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.doc-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.doc-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
}

.doc-empty i {
    font-size: 2rem;
    margin-bottom: 8px;
}

.doc-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    color: white;
    text-align: center;
    font-size: 0.8rem;
    padding: 14px 0 8px;
    font-weight: 600;
}

/* ========== TABLES (admin) ========== */
.table {
    color: var(--text);
}

.table thead th {
    background: rgba(20, 184, 166, 0.08) !important;
    border: none;
    color: var(--primary-dark);
    font-weight: 700;
    padding: 14px;
    font-size: 0.85rem;
}

.table tbody td {
    border-color: var(--border);
    padding: 14px;
    vertical-align: middle;
}

/* ========== BUTTONS ========== */
.btn {
    border-radius: 12px;
    font-weight: 600;
    padding: 10px 20px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
}

/* ========== FLASH ========== */
.flash-container {
    position: fixed;
    top: 16px;
    right: 16px;
    left: 16px;
    z-index: 2000;
    max-width: 420px;
    margin-left: auto;
}

.alert {
    border-radius: 14px;
    border: none;
    font-weight: 500;
    font-size: 0.88rem;
}

/* ========== CAMERA CAPTURE OVERLAY ========== */
.camera-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.camera-overlay video, .camera-overlay canvas {
    max-width: 100%;
    max-height: 65vh;
    border-radius: 16px;
}

.camera-status {
    color: white;
    margin-bottom: 14px;
    font-size: 0.95rem;
    text-align: center;
}

.camera-controls {
    display: flex;
    gap: 14px;
    margin-top: 22px;
}

.camera-controls button {
    border: none;
    border-radius: 50px;
    padding: 14px 26px;
    font-weight: 700;
    font-size: 0.95rem;
}

.camera-capture-btn, .camera-confirm-btn {
    background: var(--primary);
    color: white;
}

.camera-cancel-btn, .camera-retake-btn {
    background: rgba(255,255,255,0.15);
    color: white;
}
/* ========== CONTAINED SCROLL FOR TABLES & LISTS ========== */
.table-responsive {
    max-height: 70vh;
    overflow-y: auto;
}

.scroll-box {
    max-height: 60vh;
    overflow-y: auto;
}

.table-responsive thead th,
.scroll-box .sticky-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--card);
}

.cal-day {
    width: 32px; height: 32px; margin: 0 auto;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem;
}
.cal-day.is-today { background: var(--primary); color: #fff; font-weight: 700; }
.cal-day.has-shift { background: rgba(20,184,166,0.12); color: var(--primary-dark); font-weight: 600; }
.cal-day.outside-month { color: var(--text-muted); opacity: 0.4; }