/* ==========================================================================
   SISTEMA DE DISEÑO ESTILIZADO - ESCUELA AGROTÉCNICA ELDORADO (AGROTECH)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

:root {
    /* Paleta Principal Agrotech */
    --primary: #1b4332;
    --primary-light: #2d6a4f;
    --accent: #40916c;
    --accent-glow: #52b788;
    --mint-bg: #d8f3dc;
    --mint-soft: #f0fdf4;
    
    /* Estados */
    --success: #059669;
    --success-bg: #d1fae5;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;

    /* Neutros */
    --bg-body: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --input-focus: #2d6a4f;

    /* Sombras y Glassmorphism */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 25px -5px rgb(27 67 50 / 0.1), 0 8px 10px -6px rgb(27 67 50 / 0.05);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, .brand-font {
    font-family: 'Outfit', sans-serif;
}

/* --- Layout Header & Footer --- */
.header-nav {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: white;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-subtitle {
    font-size: 0.75rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.nav-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: var(--accent-glow);
}

/* --- Container Principal --- */
.main-content {
    flex: 1;
    max-width: 1100px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* --- Banner de Bienvenida Hero --- */
.hero-banner {
    background: linear-gradient(135deg, rgba(27, 67, 50, 0.95), rgba(45, 106, 79, 0.9)), url('https://images.unsplash.com/photo-1500937386664-56d1dfef3854?auto=format&fit=crop&w=1200&q=80') center/cover;
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    color: white;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.hero-banner::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(82, 183, 136, 0.25) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.hero-sub {
    font-size: 1.05rem;
    opacity: 0.9;
    max-width: 700px;
}

/* --- Tarjetas (Cards) --- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 2rem;
}

.card-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--mint-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    color: var(--primary);
    font-size: 1.35rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Formulario & Inputs --- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
}

.form-label span.req {
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: #ffffff;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.15);
}

.form-help {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* --- Indicador de Edad Dinámico --- */
.age-feedback-box {
    margin-top: 0.5rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    display: none;
}

.age-feedback-box.apto {
    display: block;
    background-color: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success);
}

.age-feedback-box.no-apto {
    display: block;
    background-color: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* --- Botones --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(27, 67, 50, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(27, 67, 50, 0.35);
}

.btn-secondary {
    background: #e2e8f0;
    color: #334155;
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-block {
    width: 100%;
}

/* --- Alert Messages --- */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-sm);
}

.alert-success { background: var(--success-bg); color: #065f46; border-left: 4px solid var(--success); }
.alert-warning { background: var(--warning-bg); color: #92400e; border-left: 4px solid var(--warning); }
.alert-danger  { background: var(--danger-bg);  color: #991b1b; border-left: 4px solid var(--danger); }
.alert-info    { background: #e0f2fe; color: #075985; border-left: 4px solid #0284c7; }

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 0.35em 0.75em;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-confirmado {
    background-color: var(--success-bg);
    color: #047857;
    border: 1px solid #a7f3d0;
}

.badge-espera {
    background-color: var(--warning-bg);
    color: #b45309;
    border: 1px solid #fde68a;
}

/* --- Tablas para Admin --- */
.table-responsive {
    overflow-x: auto;
}

/* Contenedor ancho para vistas densas (panel admin) */
.main-content-wide {
    max-width: 1600px;
}

/* Tabla densa: todo visible de un vistazo */
.table-dense {
    font-size: 0.78rem;
}

.table-dense th,
.table-dense td {
    padding: 5px 6px;
    white-space: nowrap;
    vertical-align: top;
}

.table-dense th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.table-dense td.wrap {
    white-space: normal;
    min-width: 130px;
    max-width: 230px;
}

.table-dense .turno {
    white-space: normal;
    max-width: 190px;
    font-size: 0.72rem;
}

.btn-icon {
    padding: 4px 7px;
    font-size: 0.85rem;
    line-height: 1;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.table th, .table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: #f1f5f9;
    color: var(--text-main);
    font-weight: 700;
}

.table tbody tr:hover {
    background-color: var(--mint-soft);
}

/* --- Cards de Métricas --- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.metric-number {
    font-size: 2rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

/* --- Footer --- */
.footer {
    background: var(--primary);
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    padding: 1.5rem;
    font-size: 0.85rem;
    margin-top: auto;
}

.footer a {
    color: white;
    text-decoration: underline;
}

/* Print Style */
@media print {
    .header-nav, .footer, .btn-no-print {
        display: none !important;
    }
    .card {
        box-shadow: none;
        border: none;
    }
}

/* ==========================================================================
   RESPONSIVE DESIGN & MOBILE OPTIMIZATIONS (TABLETS & SMARTPHONES)
   ========================================================================== */

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 0.85rem;
        text-align: center;
    }

    .brand-logo {
        flex-direction: column;
        gap: 6px;
    }

    .header-logo-img {
        height: 42px !important;
    }

    .brand-title {
        font-size: 1.1rem;
    }

    .brand-subtitle {
        font-size: 0.7rem;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .nav-link, .nav-btn {
        font-size: 0.85rem;
        padding: 0.45rem 0.75rem;
    }

    .main-content {
        margin: 1rem auto;
        padding: 0 0.75rem;
    }

    .hero-banner {
        padding: 1.5rem 1rem;
        border-radius: var(--radius-md);
        text-align: center;
    }

    .hero-title {
        font-size: 1.4rem;
    }

    .hero-sub {
        font-size: 0.9rem;
    }

    .card {
        padding: 1.25rem 1rem;
        border-radius: var(--radius-sm);
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .card-title {
        font-size: 1.15rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .form-control {
        min-height: 44px; /* Mobile touch target size */
        font-size: 1rem; /* Evita zoom automático molesto en iPhones/iOS */
    }

    .btn {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .metric-card {
        padding: 1rem;
    }

    .metric-number {
        font-size: 1.5rem;
    }

    .metric-label {
        font-size: 0.75rem;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table th, .table td {
        padding: 0.6rem 0.5rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .header-logo-img {
        height: 38px !important;
    }
}
