/* ═══════════════════════════════════════════════════════
   Juneberry Gardens Timesheet - Base Stylesheet
   Mobile-first responsive design
   ═══════════════════════════════════════════════════════ */

/* ─── CSS Variables ─────────────────────────────────── */
:root {
    --primary: #2E5339;
    --primary-light: #3A6B47;
    --primary-lighter: #4A8A5A;
    --accent: #6BAF7B;
    --bg: #f5f7f5;
    --bg-card: #ffffff;
    --text: #333333;
    --text-light: #666666;
    --text-muted: #999999;
    --border: #dee2e6;
    --border-light: #e9ecef;
    --success: #2E7D32;
    --success-bg: #E8F5E9;
    --error: #C62828;
    --error-bg: #FFEBEE;
    --warning: #E65100;
    --warning-bg: #FFF3E0;
    --info: #1565C0;
    --info-bg: #E3F2FD;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.12);
    --font: Arial, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ─── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-light); text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ─── Container ─────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}
.main-content {
    flex: 1;
    padding-top: 1.5rem;
    padding-bottom: 2rem;
}

/* ─── Navbar ────────────────────────────────────────── */
.navbar {
    background: var(--primary);
    color: #fff;
    padding: 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    min-height: 56px;
}
.nav-brand {
    color: #fff;
    font-weight: bold;
    font-size: 1.1rem;
    text-decoration: none;
    padding: 0.75rem 0;
}
.nav-brand:hover { color: #fff; text-decoration: none; }

.nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}
.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
}

.nav-menu {
    display: none;
    width: 100%;
    padding-bottom: 0.75rem;
}
.nav-open .nav-menu { display: flex; flex-direction: column; }

.nav-link {
    color: rgba(255,255,255,0.9);
    padding: 0.5rem 0;
    display: block;
    text-decoration: none;
    font-size: 0.95rem;
}
.nav-link:hover { color: #fff; text-decoration: none; }
.nav-link-small { font-size: 0.85rem; font-weight: bold; }
.nav-link-logout { color: rgba(255,255,255,0.7); }

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-top: 1px solid rgba(255,255,255,0.2);
    margin-top: 0.25rem;
}
.nav-user-name { color: rgba(255,255,255,0.8); font-size: 0.9rem; }

.nav-dropdown { position: relative; }
.nav-dropdown-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font);
}
.nav-dropdown-menu {
    display: none;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    min-width: 200px;
    overflow: hidden;
    margin-left: 1rem;
}
.nav-dropdown-menu a {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--text);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-light);
}
.nav-dropdown-menu a:last-child { border-bottom: none; }
.nav-dropdown-menu a:hover { background: var(--bg); text-decoration: none; }
.nav-dropdown.open .nav-dropdown-menu { display: block; }

.nav-lang { padding: 0.25rem 0; }

/* Desktop nav */
@media (min-width: 768px) {
    .nav-toggle { display: none; }
    .nav-menu {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0.25rem;
        width: auto;
        padding-bottom: 0;
    }
    .nav-link { padding: 0.5rem 0.75rem; }
    .nav-user { border-top: none; margin-top: 0; margin-left: auto; padding-left: 1rem; }
    .nav-dropdown-menu {
        position: absolute;
        top: 100%;
        right: 0;
        margin-left: 0;
        z-index: 200;
    }
}

/* ─── Cards ─────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.card-header {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-light);
}

/* ─── Alerts ────────────────────────────────────────── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #C8E6C9; }
.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid #FFCDD2; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #FFE0B2; }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid #BBDEFB; }
.alert-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    padding: 0 0.25rem;
}
.alert-close:hover { opacity: 1; }

/* ─── Buttons ───────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s;
    line-height: 1.4;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); color: #fff; text-decoration: none; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-secondary:hover { background: #5a6268; color: #fff; text-decoration: none; }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #B71C1C; color: #fff; text-decoration: none; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #1B5E20; color: #fff; text-decoration: none; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }
.btn-block { display: block; width: 100%; }

/* ─── Forms ─────────────────────────────────────────── */
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}
.form-control {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 1rem;
    color: var(--text);
    background: #fff;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46,83,57,0.15);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}
.form-error {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}
.form-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* ─── Tables ────────────────────────────────────────── */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.table th, .table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}
.table th {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.table tbody tr:nth-child(even) { background: #fafcfa; }
.table tbody tr:hover { background: #f0f5f0; }
.table .text-right { text-align: right; }
.table .text-center { text-align: center; }

/* ─── Badges ────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
}
.badge-open { background: var(--success-bg); color: var(--success); }
.badge-locked { background: var(--error-bg); color: var(--error); }
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-approved { background: var(--success-bg); color: var(--success); }
.badge-rejected { background: var(--error-bg); color: var(--error); }

/* ─── Auth Pages (centered card) ────────────────────── */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
    background: var(--bg);
}
.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    width: 100%;
    max-width: 420px;
}
.auth-title {
    text-align: center;
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* ─── Error Pages ───────────────────────────────────── */
.error-page {
    text-align: center;
    padding: 4rem 1rem;
}
.error-page h1 {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}
.error-page p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

/* ─── Dashboard Grid ────────────────────────────────── */
.dash-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: 1fr;
}
@media (min-width: 640px) {
    .dash-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
    .dash-grid { grid-template-columns: repeat(3, 1fr); }
}
.dash-stat {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    border-left: 4px solid var(--primary);
}
.dash-stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.dash-stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
    margin-top: 0.25rem;
}

/* ─── Footer ────────────────────────────────────────── */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
    padding: 1rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: auto;
}

/* ─── Utilities ─────────────────────────────────────── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.hidden { display: none; }
