/* Color Palette Variables */
:root {
    --primary-forest: #1B522A;
    --accent-leaf: #4EA952;
    --text-meadow: #6BB256;
    --bg-offwhite: #F9F9F7;
    --card-white: #FFFFFF;
    --text-dark: #121814;
    --text-muted: #5C6E61;
    --border-light: #E4EAE5;
    --radius-lg: 20px;
    --radius-md: 16px;
    --radius-pill: 50px;
    --shadow-soft: 0 8px 24px rgba(27, 82, 42, 0.06);
    
    /* Status Colors */
    --status-success: #4EA952;
    --status-error: #C0392B;
    --status-warning: #F5A623;
    --status-info: #3498DB;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Updated Body: Fills the screen seamlessly without outer gray gaps */
body {
    background-color: var(--bg-offwhite);
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* Updated App Shell: Fullscreen mobile layout */
.app-container {
    width: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    background-color: var(--bg-offwhite);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ============================================
   TOP APP BAR
   ============================================ */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background-color: var(--card-white);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    height: 32px;
    width: auto;
}

.brand-name {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary-forest);
    letter-spacing: -0.5px;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--primary-forest);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.icon-btn:active {
    background-color: rgba(27, 82, 42, 0.08);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    padding: 20px;
    padding-bottom: 90px; /* Space for sticky bottom nav */
}

/* Auth Pages - Centered */
.main-content.auth-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px 20px;
    padding-bottom: 90px;
}

/* ============================================
   AUTH CONTAINER
   ============================================ */
.auth-container {
    background-color: var(--card-white);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-light);
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-header .brand-logo {
    height: 48px;
    margin-bottom: 12px;
}

.auth-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-forest);
    margin-bottom: 4px;
}

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

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.form-label .required {
    color: #C0392B;
    margin-left: 2px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--border-light);
    border-radius: 12px;
    font-size: 1rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-dark);
    background-color: var(--card-white);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--primary-forest);
    box-shadow: 0 0 0 4px rgba(27, 82, 42, 0.08);
    outline: none;
}

.form-input::placeholder {
    color: #9AACA0;
}

.form-input.has-error {
    border-color: #C0392B;
}

.form-input.has-error:focus {
    box-shadow: 0 0 0 4px rgba(192, 57, 43, 0.12);
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235C6E61' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 44px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    background-color: var(--card-white);
    color: var(--primary-forest);
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(27, 82, 42, 0.08);
    width: 100%;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-ghost {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 12px;
    transition: color 0.2s ease;
}

.btn-ghost:active {
    color: var(--primary-forest);
}

/* ============================================
   AUTH DIVIDER
   ============================================ */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--border-light);
}

.auth-divider span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

/* ============================================
   AUTH FOOTER
   ============================================ */
.auth-footer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary-forest);
    font-weight: 600;
    text-decoration: none;
}

.auth-footer a:active {
    text-decoration: underline;
}

/* ============================================
   ROLE SELECTION CARDS
   ============================================ */
.role-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 20px 0 24px 0;
}

.role-card {
    background-color: var(--bg-offwhite);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.role-card:active {
    transform: scale(0.97);
}

.role-card.selected {
    border-color: var(--primary-forest);
    background-color: rgba(27, 82, 42, 0.04);
}

.role-card .role-icon {
    font-size: 1.5rem;
    color: var(--accent-leaf);
    margin-bottom: 6px;
}

.role-card .role-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dark);
}

.role-card .role-desc {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background-color: var(--card-white);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border-light);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transform: translateY(-100px);
    opacity: 0;
    transition: all 0.4s ease;
    pointer-events: auto;
    border-left: 4px solid var(--primary-forest);
}

.toast.visible {
    transform: translateY(0);
    opacity: 1;
}

.toast-success {
    border-left-color: var(--status-success);
}

.toast-error {
    border-left-color: var(--status-error);
}

.toast-warning {
    border-left-color: var(--status-warning);
}

.toast-info {
    border-left-color: var(--status-info);
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    padding-top: 2px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.toast-message {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    flex-shrink: 0;
}

/* ============================================
   CALL TO ACTION BANNER
   ============================================ */
.hero-card {
    background: linear-gradient(135deg, #1B522A 0%, #29723D 100%);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    color: var(--card-white);
    text-align: center;
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
}

.hero-content h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.hero-content p {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 16px;
}

/* ============================================
   DASHBOARD GRID ACTIONS
   ============================================ */
.grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.action-card {
    background-color: var(--card-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-card:active {
    transform: scale(0.97);
}

.card-icon-wrapper {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background-color: rgba(78, 169, 82, 0.12);
    color: var(--accent-leaf);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 12px;
}

.action-card h3 {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--primary-forest);
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.action-card p {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* ============================================
   BOTTOM NAVIGATION
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 72px;
    background-color: var(--card-white);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 12px;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.725rem;
    font-weight: 600;
    gap: 4px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: color 0.2s ease;
}

.nav-item:active {
    color: var(--primary-forest);
}

.nav-icon {
    font-size: 1.25rem;
    width: 44px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    transition: all 0.2s ease;
}

.nav-item.active {
    color: var(--primary-forest);
}

.nav-item.active .nav-icon {
    background-color: rgba(78, 169, 82, 0.25);
    color: var(--primary-forest);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary-forest); }
.text-success { color: var(--status-success); }
.text-danger { color: var(--status-error); }
.text-warning { color: var(--status-warning); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.mx-auto { margin-left: auto; margin-right: auto; }
.w-full { width: 100%; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.hidden { display: none; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 374px) {
    .auth-container {
        padding: 24px 16px;
    }
    
    .role-grid {
        gap: 8px;
    }
    
    .role-card {
        padding: 12px 8px;
    }
    
    .role-card .role-name {
        font-size: 0.7rem;
    }
    
    .role-card .role-desc {
        font-size: 0.55rem;
    }
}

@media (min-width: 768px) {
    .auth-container {
        max-width: 420px;
    }
}