/*
 * FreshTrack -- Custom CSS
 * Supplements Tailwind CDN. Keep this file minimal.
 */

/* ── Page background: soft sage (produce / mandi — not white) ───── */

:root {
    /* HSL ~152° 28% 92% — clearly green-tinted, easy on the eyes all day */
    --ft-page-bg: #e4f0e9;
    --ft-page-bg-rgb: 228, 240, 233;
}

html {
    background-color: var(--ft-page-bg);
}

body.ft-page {
    background-color: var(--ft-page-bg);
    min-height: 100vh;
}

/* Sticky strip: solid tint only (backdrop-filter breaks Flowbite dropdown / Popper) */
.ft-navbar-strip {
    background-color: rgba(var(--ft-page-bg-rgb), 0.96);
    overflow: visible;
}

.ft-footer-strip {
    background-color: rgba(var(--ft-page-bg-rgb), 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top-color: rgba(22, 101, 52, 0.12); /* green-800 @ 12% */
}

/* ── Pill Navbar ──────────────────────────────────────────────── */

.ft-navbar {
    background: linear-gradient(135deg, #14532d 0%, #166534 60%, #15803d 100%);
    border-radius: 9999px;
    box-shadow: 0 4px 20px 0 rgba(22, 101, 52, 0.35),
                0 1px 4px 0 rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.10);
    min-height: 52px;
    overflow: visible;
}

/* Language toggle button */
.ft-lang-btn {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.20);
    backdrop-filter: blur(4px);
}
.ft-lang-btn:hover {
    background: rgba(249, 115, 22, 0.85);   /* orange-500 */
    border-color: transparent;
}

/* User button */
.ft-user-btn {
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.ft-user-btn:hover {
    background: rgba(255, 255, 255, 0.20);
}

/* ── Flowbite Dropdown Overrides ──────────────────────────────── */

.ft-dropdown {
    z-index: 1000 !important; /* above sticky nav (z-50) and footer (z-40) */
    background: #ffffff;
    border: 1px solid #e7e5e4;           /* stone-200 */
    border-radius: 0.875rem;
    box-shadow: 0 8px 32px 0 rgba(22, 101, 52, 0.13),
                0 2px 8px 0 rgba(0, 0, 0, 0.07);
    overflow: hidden;
    padding: 0;
}

.ft-dropdown-header {
    background: #f8fafc;
}

.ft-dropdown-divider {
    height: 1px;
    background: #f1f0ef;                 /* stone-100 */
    margin: 0;
}

.ft-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 1rem;
    color: #44403c;                      /* stone-700 */
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
}
.ft-dropdown-item:hover {
    background: #f0fdf4;                 /* green-50 */
    color: #166534;                      /* green-800 */
}
.ft-dropdown-item:hover svg {
    color: #166534;
}

.ft-dropdown-item-danger {
    color: #dc2626;
}
.ft-dropdown-item-danger:hover {
    background: #fef2f2;
    color: #dc2626;
}
.ft-dropdown-item-danger svg {
    color: #dc2626;
}

/* ── RTL Overrides ────────────────────────────────────────────── */

[dir="rtl"] input::placeholder,
[dir="rtl"] textarea::placeholder {
    text-align: right;
}

[dir="rtl"] select {
    background-position: left 0.75rem center;
    padding-left: 2.5rem;
    padding-right: 0.75rem;
}

/* Input placeholder text alignment */
[dir="rtl"] input::placeholder,
[dir="rtl"] textarea::placeholder {
    text-align: right;
}

/* Select arrow position in RTL */
[dir="rtl"] select {
    background-position: left 0.75rem center;
    padding-left: 2.5rem;
    padding-right: 0.75rem;
}

/* ── Form Inputs (Flowbite-compatible custom ring) ─────────────── */

.ft-input {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    border: 1px solid #e7e5e4;       /* stone-200 */
    border-radius: 0.5rem;
    background-color: #ffffff;
    color: #292524;                  /* stone-800 */
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

.ft-input:focus {
    border-color: #166534;           /* green-800 */
    box-shadow: 0 0 0 3px rgba(22, 101, 52, 0.15);
}

.ft-input.error {
    border-color: #dc2626;           /* red-600 */
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* ── Auth Card ────────────────────────────────────────────────── */

.auth-card {
    background: #ffffff;
    border: 1px solid #e7e5e4;       /* stone-200 */
    border-radius: 1rem;
    box-shadow: 0 4px 24px 0 rgba(22, 101, 52, 0.08),
                0 1px 4px 0 rgba(0, 0, 0, 0.04);
    padding: 2rem;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
}

@media (max-width: 480px) {
    .auth-card {
        border-radius: 0.75rem;
        padding: 1.5rem 1.25rem;
        border-left: none;
        border-right: none;
        border-radius: 0;
        box-shadow: none;
        border-top: 1px solid #e7e5e4;
    }
}

/* ── Alert / Toast ────────────────────────────────────────────── */

.ft-alert {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.ft-alert-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.ft-alert-success {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.ft-alert-warning {
    background-color: #fffbeb;
    border: 1px solid #fed7aa;
    color: #92400e;
}

/* ── Primary Button ───────────────────────────────────────────── */

.ft-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6875rem 1.25rem;
    background-color: #166534;
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.1s;
    outline: none;
}

.ft-btn-primary:hover {
    background-color: #15803d;
}

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

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

/* ── Field Label ──────────────────────────────────────────────── */

.ft-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #44403c;                 /* stone-700 */
    margin-bottom: 0.3rem;
}

/* ── Divider with text ────────────────────────────────────────── */

.ft-divider {
    position: relative;
    text-align: center;
    margin: 1.25rem 0;
}

.ft-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e7e5e4;
}

.ft-divider span {
    position: relative;
    background: #ffffff;
    padding: 0 0.75rem;
    font-size: 0.75rem;
    color: #a8a29e;                 /* stone-400 */
}

/* ── Link styles ──────────────────────────────────────────────── */

.ft-link {
    color: #166534;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s;
}

.ft-link:hover {
    color: #15803d;
    text-decoration: underline;
}

/* ── Page loading spinner ─────────────────────────────────────── */

.ft-spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: ft-spin 0.7s linear infinite;
    display: inline-block;
}

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

/* ── Scrollbar (webkit) ───────────────────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--ft-page-bg);
}

::-webkit-scrollbar-thumb {
    background: #d6d3d1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a29e;
}
