/* * Sistema de Diseño - Hortícola Los Colonos (Versión Estándar CSS)
 * Optimizado para Blazor Web App y componentes HTML clásicos.
 * Recuerda usar esta estructura para todos los mantenedores (CRUD) futuros.
 */

:root {
    /* --- PALETA DE COLORES PRINCIPAL (Esmeralda) --- */
    --color-emerald-50: #ecfdf5;
    --color-emerald-100: #d1fae5;
    --color-emerald-200: #a7f3d0;
    --color-emerald-500: #10b981;
    --color-emerald-600: #059669; /* Color primario de marca */
    --color-emerald-700: #047857;
    --color-emerald-800: #065f46;
    --color-emerald-900: #064e3b;
    /* --- PALETA DE COLORES NEUTROS (Pizarrón / Slate) --- */
    --color-slate-50: #f8fafc;
    --color-slate-100: #f1f5f9;
    --color-slate-200: #e2e8f0; /* Bordes suaves */
    --color-slate-300: #cbd5e1;
    --color-slate-400: #94a3b8; /* Textos secundarios / Íconos */
    --color-slate-500: #64748b; /* Textos descriptivos */
    --color-slate-600: #475569;
    --color-slate-700: #334155;
    --color-slate-800: #1e293b; /* Títulos principales */
    --color-slate-900: #0f172a;
    /* --- COLORES DE ESTADO SEMÁNTICOS --- */
    --color-amber-100: #fef3c7;
    --color-amber-500: #f59e0b;
    --color-amber-700: #b45309;
    --color-red-50: #fef2f2;
    --color-red-100: #fee2e2;
    --color-red-500: #ef4444;
    --color-red-600: #dc2626; /* Declarada: faltaba esta variable */
    --color-red-700: #b91c1c;
    --color-blue-50: #eff6ff;
    --color-blue-600: #2563eb;
    /* --- SOMBRAS (Shadows) --- */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-emerald: 0 10px 15px -3px rgba(5, 150, 105, 0.2);
    /* --- RADIOS DE BORDE (Border Radius) --- */
    --radius-sm: 0.375rem;
    --radius-lg: 0.5rem; /* 8px - Botones, inputs */
    --radius-xl: 0.75rem; /* 12px - Elementos de menú */
    --radius-2xl: 1rem; /* 16px - Tarjetas pequeñas */
    --radius-3xl: 1.5rem; /* 24px - Tarjetas principales / Contenedores */
    --radius-full: 9999px; /* Badges circulares */
    /* --- TONOS AMBER (Para estados de advertencia/preparación) --- */
    --color-amber-50: #fffbeb;
    --color-amber-200: #fde68a;
    /* --- TONOS INDIGO (Para fechas y planificación) --- */
    --color-indigo-50: #eef2ff;
    --color-indigo-100: #e0e7ff;
    --color-indigo-600: #4f46e5;
    --color-indigo-700: #4338ca;
}

/* --- UTILIDADES RESPONSIVAS --- */
/* Por defecto 'hidden' oculta el elemento */
.hidden {
    display: none !important;
}

/* 'md:block' muestra el elemento como block desde 768px hacia arriba */
@media (min-width: 768px) {
    .md\:block {
        display: block !important;
    }

    .md\:flex {
        display: flex !important;
    }
}

/* ==========================================================================
   RESET Y BASE
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--color-slate-50);
    color: var(--color-slate-900);
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: transparent;
}

input, select {
    font-family: inherit;
}

/* ==========================================================================
   LAYOUT PRINCIPAL (Aplicación)
   ========================================================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Barra Lateral (Sidebar) */
.sidebar {
    width: 280px; /* w-72 */
    background-color: #ffffff;
    border-right: 1px solid var(--color-slate-200);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    margin-bottom: 2rem;
}

.sidebar-logo-icon {
    width: 3rem;
    height: 3rem;
    background-color: var(--color-emerald-600);
    border-radius: var(--radius-2xl);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-emerald);
}

.nav-section-title {
    font-size: 0.625rem;
    font-weight: 900;
    color: var(--color-slate-400);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    padding: 0 1rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-xl);
    color: var(--color-slate-600);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    text-align: left;
}

    .nav-item:hover {
        background-color: var(--color-emerald-50);
    }

    .nav-item.active {
        background-color: var(--color-emerald-600);
        color: #ffffff;
        box-shadow: var(--shadow-emerald);
    }

/* Área de Contenido Principal */
.main-content {
    flex: 1;
    padding: 2.5rem;
    max-width: 80rem; /* max-w-7xl */
    margin: 0 auto;
    width: 100%;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2.5rem;
}

.page-title {
    font-size: 1.875rem;
    font-weight: 900;
    color: var(--color-slate-800);
    letter-spacing: -0.025em;
    margin: 0;
    text-transform: capitalize;
}

.page-subtitle {
    color: var(--color-slate-400);
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 0.25rem;
}

/* ==========================================================================
   COMPONENTES (Tarjetas, Botones, Inputs)
   ========================================================================== */

/* Tarjetas (Cards) */
.card {
    background-color: #ffffff;
    border-radius: var(--radius-3xl);
    border: 1px solid var(--color-slate-200);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.2s ease;
}

    .card:hover {
        box-shadow: var(--shadow-md);
    }

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-slate-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(248, 250, 252, 0.5); /* slate-50/50 */
}

.card-body {
    padding: 1.5rem;
}

/* Grillas */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 700;
    border-radius: var(--radius-xl);
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--color-emerald-600);
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

    .btn-primary:hover {
        background-color: var(--color-emerald-700);
    }

.btn-outline {
    background-color: #ffffff;
    border: 1px solid var(--color-slate-200);
    color: var(--color-slate-600);
}

    .btn-outline:hover {
        background-color: var(--color-slate-50);
    }

.btn-icon {
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    color: var(--color-slate-400);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .btn-icon:hover {
        background-color: var(--color-slate-100);
        color: var(--color-slate-700);
    }

    .btn-icon.danger:hover {
        color: var(--color-red-600);
        background-color: var(--color-red-50);
    }

    .btn-icon.edit:hover {
        color: var(--color-blue-600);
        background-color: var(--color-blue-50);
    }

/* Inputs y Buscadores */
.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-control {
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    outline: none;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
}

    .input-control:focus {
        border-color: var(--color-emerald-500);
        box-shadow: 0 0 0 2px var(--color-emerald-100);
    }

.input-search {
    padding-left: 2.25rem;
}

.input-icon-left {
    position: absolute;
    left: 0.75rem;
    color: var(--color-slate-400);
    pointer-events: none;
}

/* ==========================================================================
   MANTENEDORES (CRUD) - TABLAS
   ========================================================================== */

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

    .data-table th {
        background-color: var(--color-slate-50);
        color: var(--color-slate-400);
        font-size: 0.625rem; /* 10px */
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        padding: 1rem 1.5rem;
    }

    .data-table td {
        padding: 1rem 1.5rem;
        border-bottom: 1px solid var(--color-slate-100);
        font-size: 0.875rem; /* 14px */
        color: var(--color-slate-700);
        vertical-align: middle;
    }

    .data-table tr {
        transition: background-color 0.15s ease;
    }

        .data-table tr:hover td {
            background-color: var(--color-slate-50);
        }

/* Elementos dentro de las tablas */
.td-title {
    font-weight: 700;
    color: var(--color-slate-800);
    display: block;
}

.td-subtitle {
    font-size: 0.75rem;
    color: var(--color-slate-500);
    display: block;
    margin-top: 0.125rem;
}

/* ==========================================================================
   BADGES (Estados)
   ========================================================================== */

.badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-activo {
    background-color: var(--color-emerald-50);
    color: var(--color-emerald-600);
    border: 1px solid var(--color-emerald-100);
}

.badge-inactivo {
    background-color: var(--color-slate-100);
    color: var(--color-slate-500);
    border: 1px solid var(--color-slate-200);
}

.badge-pendiente {
    background-color: var(--color-amber-100);
    color: var(--color-amber-700);
}

.badge-aprobado {
    background-color: var(--color-emerald-100);
    color: var(--color-emerald-700);
}

.badge-rechazado {
    background-color: var(--color-red-100);
    color: var(--color-red-700);
}

/* ==========================================================================
   UTILIDADES (Helpers para Blazor)
   ========================================================================== */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-end {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

/* ==========================================================================
   RESPONSIVE (MÓVIL Y TABLET)
   ========================================================================== */

.mobile-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: #ffffff;
    border-bottom: 1px solid var(--color-slate-200);
    position: sticky;
    top: 0;
    z-index: 40;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.5);
    z-index: 40;
    backdrop-filter: blur(2px);
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .mobile-header {
        display: flex;
    }

    .sidebar-overlay {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        z-index: 50;
        transition: left 0.3s ease;
        box-shadow: var(--shadow-lg);
    }

        .sidebar.open {
            left: 0;
        }

    .main-content {
        padding: 1.25rem;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .grid-cards {
        grid-template-columns: 1fr;
    }
}
