/**
 * =====================================================
 * ENERLOOP - Estilos Compartidos
 * =====================================================
 * Archivo CSS común para todas las páginas del sitio.
 * Contiene fuentes, colores, componentes y utilidades.
 * =====================================================
 */

/* =====================================================
   FUENTES - Inter (Self-hosted)
   ===================================================== */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/inter-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/inter-500.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/inter-600.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/inter-700.woff2') format('woff2');
}

/* =====================================================
   ESTILOS BASE
   ===================================================== */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =====================================================
   TRANSICIONES DE PÁGINA
   ===================================================== */
.page-transition {
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.page-transition.fade-out {
    opacity: 0;
}

.page-transition.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* =====================================================
   COLORES PERSONALIZADOS ENERLOOP
   Color principal: #067f38 (verde)
   Color hover: #045d28 (verde oscuro)
   ===================================================== */
.text-enerloop-green { color: #067f38; }
.bg-enerloop-green { background-color: #067f38; }
.border-enerloop-green { border-color: #067f38; }
.hover\:bg-enerloop-green-dark:hover { background-color: #045d28; }
.hover\:text-enerloop-green:hover { color: #067f38; }

/* Variantes adicionales */
.text-enerloop-green-light { color: #0a9f48; }
.bg-enerloop-green-light { background-color: #dcfce7; }
.ring-enerloop-green { --tw-ring-color: #067f38; }
.focus\:ring-enerloop-green:focus { --tw-ring-color: #067f38; }

/* =====================================================
   BOTONES
   ===================================================== */
.btn {
    display: inline-block;
    font-weight: 600;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    transition: transform 0.2s ease, background-color 0.2s ease;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
}

.btn:hover {
    transform: scale(1.03);
}

.btn-primary {
    background-color: #067f38;
    color: white;
}

.btn-primary:hover {
    background-color: #045d28;
}

.btn-outline {
    background-color: transparent;
    color: #067f38;
    border: 2px solid #067f38;
}

.btn-outline:hover {
    background-color: #067f38;
    color: white;
}


.btn-sm {
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
}

/* =====================================================
   DROPDOWN MENU (Navegación)
   ===================================================== */
.dropdown-menu {
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s 0.3s;
    top: 100%;
    padding-top: 0.5rem;
}

.dropdown-container:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0s;
}

/* =====================================================
   CONTENIDO DE ARTÍCULOS (Prose Enerloop)
   ===================================================== */
.content-section {
    scroll-margin-top: 100px;
}

.prose-enerloop h2 {
    color: #1f2937;
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 1rem;
    margin-top: 2.5rem;
}

.prose-enerloop h3 {
    color: #374151;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
}

.prose-enerloop h4 {
    color: #4b5563;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    margin-top: 1.25rem;
}

.prose-enerloop p {
    color: #4b5563;
    line-height: 1.75;
    margin-bottom: 1.25rem;
}

.prose-enerloop ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
}

.prose-enerloop ol {
    list-style-type: decimal;
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
}

.prose-enerloop li {
    color: #4b5563;
    line-height: 1.75;
    margin-bottom: 0.5rem;
}

.prose-enerloop strong {
    color: #1f2937;
}

.prose-enerloop a:not(.btn) {
    color: #067f38;
    text-decoration: none;
}

.prose-enerloop a:not(.btn):hover {
    text-decoration: underline;
}

.prose-enerloop blockquote {
    border-left: 4px solid #067f38;
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #6b7280;
}

.prose-enerloop code {
    background-color: #f3f4f6;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.prose-enerloop pre {
    background-color: #1f2937;
    color: #f9fafb;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.prose-enerloop pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
}

/* =====================================================
   TABLA DE CONTENIDOS (Sidebar)
   ===================================================== */
.toc-link {
    color: #4b5563;
    transition: color 0.2s ease;
    text-decoration: none;
}

.toc-link:hover {
    color: #067f38;
}

.toc-link.active {
    color: #067f38;
    font-weight: 600;
}

/* =====================================================
   CARDS DE INFORMACIÓN
   ===================================================== */
.info-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-left: 4px solid #067f38;
}

.info-card-warning {
    background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
    border-left: 4px solid #eab308;
}

.info-card-info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left: 4px solid #3b82f6;
}

/* =====================================================
   TABLAS
   ===================================================== */
.composition-table {
    width: 100%;
    border-collapse: collapse;
}

.composition-table th {
    background-color: #067f38;
    color: white;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
}

.composition-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.composition-table tr:nth-child(even) {
    background-color: #f9fafb;
}

.composition-table tr:hover {
    background-color: #f3f4f6;
}

/* Tabla con bordes */
.table-bordered th,
.table-bordered td {
    border: 1px solid #e5e7eb;
}

/* =====================================================
   BREADCRUMB
   ===================================================== */
.breadcrumb {
    font-size: 0.875rem;
}

.breadcrumb a {
    color: #6b7280;
    transition: color 0.2s ease;
    text-decoration: none;
}

.breadcrumb a:hover {
    color: #067f38;
}

.breadcrumb span {
    color: #9ca3af;
}

/* =====================================================
   IMAGE PLACEHOLDER
   ===================================================== */
.image-placeholder {
    background-color: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 0.875rem;
    text-align: center;
    padding: 0;
    overflow: hidden;
}

.image-placeholder img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* =====================================================
   FORMULARIOS
   ===================================================== */
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: #067f38;
    box-shadow: 0 0 0 3px rgba(6, 127, 56, 0.1);
}

.form-input::placeholder {
    color: #9ca3af;
}

.form-label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-select:focus {
    outline: none;
    border-color: #067f38;
    box-shadow: 0 0 0 3px rgba(6, 127, 56, 0.1);
}

.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-textarea:focus {
    outline: none;
    border-color: #067f38;
    box-shadow: 0 0 0 3px rgba(6, 127, 56, 0.1);
}

/* =====================================================
   BADGES / ETIQUETAS
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-green {
    background-color: #dcfce7;
    color: #166534;
}

.badge-blue {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-yellow {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-gray {
    background-color: #f3f4f6;
    color: #374151;
}

/* =====================================================
   CARDS GENÉRICAS
   ===================================================== */
.card {
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.card-hover:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
    transition: all 0.2s ease;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background-color: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

/* =====================================================
   HERO SECTIONS
   ===================================================== */
.hero-gradient {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.3) 100%);
}

/* =====================================================
   ANIMACIONES
   ===================================================== */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-slide-up {
    animation: slideUp 0.5s ease-out;
}

.animate-slide-in {
    animation: slideIn 0.5s ease-out;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* =====================================================
   UTILIDADES ADICIONALES
   ===================================================== */
.text-balance {
    text-wrap: balance;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Scrollbar personalizado */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* =====================================================
   CALCULADORA STYLES
   ===================================================== */
.calculator-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
    border: 2px solid #dcfce7;
}

.calculator-result {
    background: linear-gradient(135deg, #067f38 0%, #045d28 100%);
    color: white;
}

.calculator-input {
    border: 2px solid #e5e7eb;
    transition: border-color 0.2s ease;
}

.calculator-input:focus {
    border-color: #067f38;
    outline: none;
}

/* Cajas de cálculo y resultados */
.calc-box {
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875rem;
}

.result-box {
    background: linear-gradient(135deg, #067f38 0%, #045d28 100%);
    border-radius: 0.75rem;
    padding: 1.5rem;
    color: white;
}

.result-box h3,
.result-box h4 {
    color: white;
    margin-top: 0;
}

/* Números de paso */
.step-number {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: #067f38;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* =====================================================
   BADGES SECTORIALES
   ===================================================== */
.badge-sector {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.badge-sector-porcino {
    background-color: rgba(236, 72, 153, 0.2);
    color: #f472b6;
}

.badge-sector-avicola {
    background-color: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.badge-sector-palmero {
    background-color: rgba(251, 146, 60, 0.2);
    color: #fb923c;
}

.badge-sector-azucarero {
    background-color: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

/* =====================================================
   ALIAS DE TABLAS (para consistencia)
   ===================================================== */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th {
    background-color: #067f38;
    color: white;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
}

.comparison-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.comparison-table tr:nth-child(even) {
    background-color: #f9fafb;
}

.comparison-table tr:hover {
    background-color: #f3f4f6;
}

/* Fila destacada en tablas */
.highlight-row {
    background-color: #dcfce7 !important;
}

/* =====================================================
   CARDS DE ADVERTENCIA/ALERTA
   ===================================================== */
.warning-card {
    background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
    border-left: 4px solid #eab308;
    border-radius: 0.5rem;
    padding: 1rem 1.5rem;
}

.error-card {
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    border-left: 4px solid #ef4444;
    border-radius: 0.5rem;
    padding: 1rem 1.5rem;
}

/* =====================================================
   SECCIÓN DIY / HAZLO TÚ MISMO
   ===================================================== */
.diy-section {
    background-color: #f9fafb;
    border: 2px dashed #d1d5db;
    border-radius: 0.75rem;
    padding: 1.5rem;
}

/* =====================================================
   RESPONSIVE UTILITIES
   ===================================================== */
@media (max-width: 768px) {
    .prose-enerloop h2 {
        font-size: 1.5rem;
    }

    .prose-enerloop h3 {
        font-size: 1.125rem;
    }

    .btn {
        padding: 0.625rem 1.5rem;
    }
}

/* =====================================================
   PRINT STYLES
   ===================================================== */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
    }

    a {
        text-decoration: underline;
    }

    .btn {
        border: 1px solid #000;
    }
}
