/* ============================================================
   GANADERÍA PRO - Premium Farm Management Design System
   ============================================================ */

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

:root {
    /* Primary Palette - Emerald Agriculture */
    --primary-50: #ecfdf5;
    --primary-100: #d1fae5;
    --primary-200: #a7f3d0;
    --primary-300: #6ee7b7;
    --primary-400: #34d399;
    --primary-500: #10b981;
    --primary-600: #059669;
    --primary-700: #047857;
    --primary-800: #065f46;
    --primary-900: #064e3b;

    /* Accent */
    --accent-amber: #f59e0b;
    --accent-amber-light: #fef3c7;
    --accent-sky: #0ea5e9;
    --accent-sky-light: #e0f2fe;
    --accent-rose: #f43f5e;
    --accent-rose-light: #ffe4e6;
    --accent-violet: #8b5cf6;
    --accent-violet-light: #ede9fe;

    /* Neutrals */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Glass */
    --glass-bg: rgba(255, 255, 255, 0.80);
    --glass-bg-strong: rgba(255, 255, 255, 0.92);
    --glass-border: rgba(255, 255, 255, 0.45);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --glass-shadow-hover: 0 16px 48px rgba(0, 0, 0, 0.12);

    /* Sizing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Backgrounds and text mapping */
    --bg-body: var(--gray-50);
    --bg-card: #ffffff;
    --text-main: var(--gray-800);
    --text-muted: var(--gray-500);
    --border-color: var(--gray-200);
}

[data-theme="dark"] {
    --bg-body: var(--gray-900);
    --bg-card: var(--gray-800);
    --text-main: var(--gray-100);
    --text-muted: var(--gray-400);
    --border-color: var(--gray-700);

    --gray-50: #0f172a;
    --gray-100: #1e293b;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-800: #f1f5f9;
    --gray-900: #f8fafc;
    
    --glass-bg: rgba(30, 41, 59, 0.85);
    --glass-bg-strong: rgba(15, 23, 42, 0.95);
    --glass-border: rgba(255, 255, 255, 0.1);
}

/* ============= BASE ============= */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-main);
    background: var(--bg-body);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s, color 0.3s;
}

/* ============= LOGIN PAGE ============= */
.login-body {
    background: linear-gradient(135deg, #064e3b 0%, #059669 50%, #10b981 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    position: relative;
    overflow: hidden;
}

.login-body::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(52, 211, 153, 0.3) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    border-radius: 50%;
    animation: pulse-glow 4s ease-in-out infinite;
}

.login-body::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.15) 0%, transparent 70%);
    bottom: -80px;
    left: -80px;
    border-radius: 50%;
    animation: pulse-glow 5s ease-in-out infinite reverse;
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
}

.login-container {
    width: 100%;
    max-width: 460px;
    padding: 20px;
    position: relative;
    z-index: 2;
}

.glass-card {
    background: var(--glass-bg-strong);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    box-shadow: var(--glass-shadow), 0 0 0 1px rgba(255,255,255,0.1);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.glass-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--glass-shadow-hover);
}

.login-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

/* ============= APP LAYOUT ============= */
.app-body {
    background: var(--bg-body);
    min-height: 100vh;
}

/* ============= NAVBAR ============= */
.bg-primary-custom {
    background: linear-gradient(135deg, var(--primary-900) 0%, var(--primary-700) 100%) !important;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.navbar {
    padding: 0.6rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar .nav-link {
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 0.9rem !important;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    position: relative;
}

.navbar .nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
}

.navbar .nav-link.active {
    background: rgba(255, 255, 255, 0.18);
    font-weight: 600;
}

.navbar .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--primary-300);
    border-radius: 10px;
}

.navbar .badge-alerts {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.6rem;
    padding: 2px 5px;
    border-radius: 50%;
    background: var(--accent-rose);
    color: white;
    animation: badge-pop 0.3s ease;
}

@keyframes badge-pop {
    0% { transform: scale(0); }
    80% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ============= FORM CONTROLS ============= */
.input-modern {
    border-radius: var(--radius-md);
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    transition: all var(--transition-fast);
    background: var(--bg-card);
    font-size: 0.9rem;
    color: var(--text-main);
}

.input-modern:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
    border-color: var(--primary-500);
    background: var(--bg-card);
    outline: none;
}

.form-label {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.form-select.input-modern {
    cursor: pointer;
}

/* ============= BUTTONS ============= */
.btn-modern {
    border-radius: var(--radius-md);
    padding: 10px 20px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary.btn-modern,
.btn-modern.btn-primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: white;
}

.btn-primary.btn-modern:hover {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-800));
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}

.btn-outline-primary {
    border-color: var(--primary-500);
    color: var(--primary-600);
}

.btn-outline-primary:hover {
    background: var(--primary-50);
    border-color: var(--primary-600);
    color: var(--primary-700);
}

.btn-outline-danger:hover {
    transform: translateY(-1px);
}

/* ============= CARDS ============= */
.card-dashboard {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: all var(--transition-normal);
    background: var(--bg-card);
    overflow: hidden;
}

.card-dashboard:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* KPI Stat Cards */
.stat-card {
    border: none;
    border-radius: var(--radius-lg);
    padding: 24px;
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
}

.stat-card.stat-green::before { background: var(--primary-500); }
.stat-card.stat-blue::before { background: var(--accent-sky); }
.stat-card.stat-amber::before { background: var(--accent-amber); }
.stat-card.stat-rose::before { background: var(--accent-rose); }
.stat-card.stat-violet::before { background: var(--accent-violet); }

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-card .stat-icon.icon-green { background: var(--primary-50); color: var(--primary-600); }
.stat-card .stat-icon.icon-blue { background: var(--accent-sky-light); color: var(--accent-sky); }
.stat-card .stat-icon.icon-amber { background: var(--accent-amber-light); color: var(--accent-amber); }
.stat-card .stat-icon.icon-rose { background: var(--accent-rose-light); color: var(--accent-rose); }
.stat-card .stat-icon.icon-violet { background: var(--accent-violet-light); color: var(--accent-violet); }

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
    letter-spacing: -0.03em;
}

.stat-card .stat-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card .stat-sub {
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-top: 4px;
}

/* ============= TABLES ============= */
.table {
    font-size: 0.9rem;
}

.table thead th {
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    border-bottom: 2px solid var(--gray-200);
    padding: 12px 16px;
}

.table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-100);
}

.table-hover tbody tr:hover {
    background-color: var(--primary-50);
}

.table .badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 20px;
    letter-spacing: 0.02em;
}

/* ============= ALERTS ============= */
.alert-card {
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
    border: none;
    font-size: 0.88rem;
    animation: slideInRight 0.3s ease;
}

.alert-card.alert-warning { background: var(--accent-amber-light); border-left: 4px solid var(--accent-amber); }
.alert-card.alert-danger { background: var(--accent-rose-light); border-left: 4px solid var(--accent-rose); }
.alert-card.alert-info { background: var(--accent-sky-light); border-left: 4px solid var(--accent-sky); }

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ============= CHARTS SECTION ============= */
.chart-container {
    position: relative;
    border: none;
    border-radius: var(--radius-lg);
    background: white;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.chart-wrapper {
    position: relative;
    height: 250px;
    width: 100%;
}

.chart-container h6 {
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

/* ============= PAGE HEADERS ============= */
h2 {
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.02em;
    font-size: 1.6rem;
}

h2 i {
    color: var(--primary-500);
}

.text-muted {
    color: var(--gray-500) !important;
}

/* ============= FICHA INDIVIDUAL ============= */
.ficha-header {
    background: linear-gradient(135deg, var(--primary-800), var(--primary-600));
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 32px;
    color: white;
}

.ficha-header .ficha-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border: 3px solid rgba(255,255,255,0.3);
}

.ficha-tabs .nav-link {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-500);
    border: none;
    padding: 10px 16px;
    border-bottom: 3px solid transparent;
    transition: all var(--transition-fast);
}

.ficha-tabs .nav-link.active {
    color: var(--primary-700);
    border-bottom-color: var(--primary-500);
    background: transparent;
}

/* ============= RESPONSIVE ============= */
@media (max-width: 768px) {
    .glass-card {
        padding: 32px 24px;
    }
    
    .stat-card .stat-value {
        font-size: 1.4rem;
    }

    h2 {
        font-size: 1.3rem;
    }

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

/* ============= UTILITY ============= */
.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-400);
    margin-bottom: 16px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
