@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-color: #f8fafc;
    --surface-light: rgba(255, 255, 255, 0.9);
    --surface-border: rgba(10, 102, 68, 0.15);
    --primary: #0A6644;
    --primary-hover: #085236;
    --secondary: #bed73d;
    --success: #0A6644;
    --danger: #ef4444;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: radial-gradient(ellipse at 20% 20%, rgba(10,102,68,0.07) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 80%, rgba(10,102,68,0.05) 0%, transparent 55%),
                linear-gradient(160deg, #f0f9f4 0%, #f8fafc 40%, #eef6f2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* =========================================
 * ZEN DECORATIVE FLOATING ORBS
 * These sit in the background as visual depth
 * ========================================= */
body::before {
    content: '';
    position: fixed;
    top: -120px;
    right: -100px;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(10,102,68,0.12) 0%, rgba(10,102,68,0.03) 60%, transparent 80%);
    pointer-events: none;
    z-index: 0;
    animation: zenFloat1 18s ease-in-out infinite;
}

body::after {
    content: '';
    position: fixed;
    bottom: -80px;
    left: -120px;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(10,102,68,0.10) 0%, rgba(190,215,61,0.04) 60%, transparent 80%);
    pointer-events: none;
    z-index: 0;
    animation: zenFloat2 22s ease-in-out infinite;
}

/* Orb helper class for extra shapes injected via PHP */
.zen-orb {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.zen-orb-1 {
    width: 280px; height: 280px;
    top: 40%; left: -60px;
    background: radial-gradient(circle, rgba(10,102,68,0.08) 0%, transparent 75%);
    animation: zenFloat1 25s ease-in-out infinite reverse;
}

.zen-orb-2 {
    width: 180px; height: 180px;
    top: 15%; right: 8%;
    background: radial-gradient(circle, rgba(10,102,68,0.07) 0%, transparent 70%);
    animation: zenFloat2 19s ease-in-out infinite 3s;
}

.zen-orb-3 {
    width: 350px; height: 350px;
    bottom: 10%; right: -80px;
    background: radial-gradient(circle, rgba(190,215,61,0.07) 0%, rgba(10,102,68,0.04) 50%, transparent 75%);
    animation: zenFloat3 28s ease-in-out infinite 6s;
}

.zen-orb-4 {
    width: 120px; height: 120px;
    top: 60%; right: 20%;
    background: radial-gradient(circle, rgba(10,102,68,0.09) 0%, transparent 70%);
    animation: zenFloat1 15s ease-in-out infinite 2s;
}

/* Geometric accent ring */
.zen-ring {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    border: 1.5px solid rgba(10,102,68,0.10);
}

.zen-ring-1 {
    width: 200px; height: 200px;
    top: 5%; left: 5%;
    animation: zenRotate 35s linear infinite;
    opacity: 0.6;
}

.zen-ring-2 {
    width: 300px; height: 300px;
    bottom: 5%; right: 2%;
    border-color: rgba(10,102,68,0.07);
    animation: zenRotate 50s linear infinite reverse;
    opacity: 0.5;
}

@keyframes zenFloat1 {
    0%   { transform: translateY(0px) translateX(0px); }
    33%  { transform: translateY(-25px) translateX(12px); }
    66%  { transform: translateY(15px) translateX(-8px); }
    100% { transform: translateY(0px) translateX(0px); }
}

@keyframes zenFloat2 {
    0%   { transform: translateY(0px) translateX(0px) scale(1); }
    40%  { transform: translateY(20px) translateX(-15px) scale(1.03); }
    75%  { transform: translateY(-10px) translateX(10px) scale(0.98); }
    100% { transform: translateY(0px) translateX(0px) scale(1); }
}

@keyframes zenFloat3 {
    0%   { transform: translateY(0px) rotate(0deg); }
    50%  { transform: translateY(-30px) rotate(5deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes zenRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Ensure content sits above orbs */
.container, .auth-wrapper {
    position: relative;
    z-index: 1;
}


.glass {
    background: var(--surface-light);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-box {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

h1, h2, h3 { font-weight: 600; color: var(--primary); margin-bottom: 1.5rem; }

.form-group { margin-bottom: 1.5rem; }

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    background: #ffffff;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-control[readonly] {
    background: #e2e8f0;
    cursor: not-allowed;
    color: var(--text-secondary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 15px rgba(10, 102, 68, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    width: auto;
}

.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--surface-border);
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover { color: var(--primary); }

.table-container { filter: drop-shadow(0 10px 15px rgba(0,0,0,0.3)); border-radius: var(--radius); overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface-light);
}

th, td {
    padding: 1.25rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--surface-border);
}

th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    background: rgba(190, 215, 61, 0.2);
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-pending { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-approved { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-denied { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

/* Rich text container table rules for QuillJS Output */
.richtext-container table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    background: #fff;
}
.richtext-container th, .richtext-container td {
    border: 1px solid var(--surface-border);
    padding: 0.5rem 0.75rem;
    text-align: left;
}
.richtext-container tr:nth-child(even) {
    background: rgba(0,0,0,0.02);
}

/* Floating Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2.5rem;
    left: 2.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    pointer-events: none; /* Let clicks pass through empty spaces */
}

.app-toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    padding: 1.25rem 1.5rem 1.25rem 1.75rem;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04), 0 0 0 1px rgba(255,255,255,0.6) inset;
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    width: 420px;
    max-width: calc(100vw - 5rem);
    pointer-events: all;
    animation: toastSlideInLeft 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    border: 1px solid rgba(0,0,0,0.06);
    position: relative;
    overflow: hidden;
}

.app-toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
}

.toast-success::before { background: linear-gradient(to bottom, #10b981, #059669); }
.toast-error::before { background: linear-gradient(to bottom, #ef4444, #dc2626); }

@keyframes toastSlideInLeft {
    from { transform: translateX(-120%) scale(0.95); opacity: 0; }
    to { transform: translateX(0) scale(1); opacity: 1; }
}

@keyframes toastSlideOutLeft {
    from { transform: translateX(0) scale(1); opacity: 1; }
    to { transform: translateX(-120%) scale(0.95); opacity: 0; }
}

.toast-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), inset 0 2px 4px rgba(255,255,255,0.5);
}

.toast-content {
    flex: 1;
    padding-top: 0.15rem;
}

.toast-title {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    color: #111827;
    margin-bottom: 0.35rem;
}

.toast-desc {
    font-size: 0.9rem;
    color: #4b5563;
    line-height: 1.5;
}

.toast-close {
    background: #f3f4f6;
    border: none;
    color: #6b7280;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.toast-close:hover {
    color: #111827;
    background: #e5e7eb;
    transform: scale(1.05);
}

/* -------------------------------------
 * MOBILE ZEN INTERFACE (MAX-WIDTH 768px)
 * ------------------------------------- */
.mobile-bottom-nav {
    display: none; /* Hide on desktop */
}

@media (max-width: 768px) {
    /* Ocultar barra de navegación superior (Navbar clásica) */
    .navbar {
        display: none !important;
    }

    /* Redistribuir padding del contenedor maestro */
    .container {
        padding: 1rem 1rem 6rem 1rem !important; /* Espacio extra al fondo para la Mobile Bar */
    }

    /* Reducir bordes y sombras agresivas en celulares, emulando tarjetas nativas iOS */
    .glass {
        border-radius: 16px;
        padding: 1.5rem !important;
        box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
        border: none;
        background: rgba(255, 255, 255, 0.95);
    }
    
    .table-container { filter: none; box-shadow: none; border: 1px solid var(--surface-border); }

    /* Convertir tablas a estilo App-Card (iOS UI) */
    table, thead, tbody, th, td, tr { display: block; }
    thead tr { display: none; }
    
    tr {
        margin-bottom: 1.25rem;
        background: rgba(255, 255, 255, 1);
        border: 1px solid rgba(10, 102, 68, 0.1);
        border-radius: 16px;
        box-shadow: 0 4px 15px -3px rgba(0,0,0,0.05);
        padding: 0.5rem 1rem;
    }
    
    td {
        border-bottom: 1px solid rgba(0,0,0,0.03) !important;
        padding: 0.85rem 0 !important;
        position: relative;
        font-size: 0.9rem;
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    td::before {
        content: attr(data-label);
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-secondary);
        font-weight: 700;
        margin-bottom: 0.1rem;
    }
    
    td:last-child {
        border-bottom: none !important;
    }

    /* Barra Inferior Nativa (Bottom Navigation Bar) */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        padding-bottom: env(safe-area-inset-bottom); /* iPhone X+ notch support */
        z-index: 1000;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
        justify-content: space-around;
        align-items: center;
        height: 65px;
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: var(--text-secondary);
        flex: 1;
        height: 100%;
        transition: color 0.2s ease;
    }

    .mobile-nav-item svg {
        width: 24px;
        height: 24px;
        margin-bottom: 4px;
        stroke-width: 1.5px;
        transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .mobile-nav-item span {
        font-size: 0.65rem;
        font-weight: 600;
        letter-spacing: 0.02em;
    }

    .mobile-nav-item.active {
        color: var(--primary);
    }

    .mobile-nav-item.active svg {
        stroke-width: 2.5px;
        transform: translateY(-2px);
    }

    /* Animación Tap-Highlight en la web */
    .mobile-nav-item:active {
        opacity: 0.6;
    }
    
    body {
        margin: 0;
        /* Un degradado más fino en móvil para coincidir con la app */
        background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    }
}
