/* 
 * MEJORAS COMPLETAS PARA MECANIZACIÓN AGRÍCOLA
 * Diseño responsive y paleta de colores mejorada
 */

:root {
    /* Nueva paleta de colores más atractiva */
    --color-primary: #1A6D3D; /* Verde más vibrante */
    --color-secondary: #2E8B57; /* Verde secundario */
    --color-accent: #FFA500; /* Naranja para acentos */
    --color-warning: #FFC107;
    --color-light: #F5F9F7; /* Verde muy claro para fondos */
    --color-dark: #1E3A28; /* Verde oscuro elegante */
    --color-card-bg: #FFFFFF;
    --color-shadow: rgba(26, 109, 61, 0.15);
    --gradient-primary: linear-gradient(135deg, #1A6D3D 0%, #2E8B57 100%);
    --gradient-light: linear-gradient(135deg, #F5F9F7 0%, #E8F4EF 100%);
}

/* Reset y estilos base mejorados */
body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--color-light);
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

/* ===== HEADER MEJORADO ===== */
header.bg-success {
    background: var(--gradient-primary) !important;
    box-shadow: 0 4px 12px var(--color-shadow);
    position: relative;
    overflow: hidden;
}

header.bg-success::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-accent), #FFD700);
}

.logo-img {
    height: 70px;
    width: auto;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.logo-img:hover {
    transform: scale(1.05);
}

/* Navegación mejorada */
.navbar {
    padding: 0.5rem 0;
}

.navbar-nav .nav-link {
    padding: 0.75rem 1.25rem;
    border-radius: 50px;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.navbar-nav .nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: left 0.3s ease;
}

.navbar-nav .nav-link:hover::before {
    left: 0;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.25);
    font-weight: 600;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-nav .nav-link i {
    font-size: 1.1rem;
    margin-right: 8px;
}

/* ===== CONTENIDO PRINCIPAL ===== */
main.container {
    padding-top: 2rem;
    padding-bottom: 3rem;
    flex: 1;
}

/* Títulos mejorados */
.display-5 {
    color: var(--color-dark);
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.text-success {
    color: var(--color-primary) !important;
}

.lead {
    color: #555;
    font-weight: 400;
}

/* ===== TARJETAS DE MÓDULOS MEJORADAS ===== */
.module-card {
    border: none;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: var(--color-card-bg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    height: 100%;
    position: relative;
}

.module-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--gradient-primary);
    transition: height 0.3s ease;
}

.module-card:hover::after {
    height: 8px;
}

.module-card:hover {
    transform: translateY(-12px);
    box-shadow: 0 20px 40px rgba(26, 109, 61, 0.2);
}

.module-card .card-body {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 1;
}

.module-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    color: var(--color-primary);
    transition: transform 0.3s ease;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.module-card:hover .module-icon {
    transform: scale(1.1) rotate(5deg);
}

.module-card .card-title {
    color: var(--color-dark);
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.module-card .card-subtitle {
    color: var(--color-secondary);
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 1.2rem;
}

.module-card .card-text {
    color: #666;
    margin-bottom: 1.5rem;
    flex-grow: 1;
    font-size: 0.95rem;
}

/* Botones mejorados */
.btn-module, .btn-success {
    background: var(--gradient-primary);
    border: none;
    color: white;
    padding: 14px 32px;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
}

.btn-module::before, .btn-success::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn-module:hover::before, .btn-success:hover::before {
    left: 100%;
}

.btn-module:hover, .btn-success:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px rgba(26, 109, 61, 0.3);
    color: white;
}

.btn-module:active, .btn-success:active {
    transform: translateY(-1px);
}

.btn-light {
    background: white;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-light:hover {
    background: var(--color-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px var(--color-shadow);
}

/* ===== SECCIÓN DE HERRAMIENTAS MEJORADA ===== */
.module-header {
    background: var(--gradient-primary);
    color: white;
    padding: 50px 0;
    border-radius: 20px;
    margin-bottom: 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(26, 109, 61, 0.2);
}

.module-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    animation: float 20s linear infinite;
}

@keyframes float {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-30px, -30px) rotate(360deg); }
}

.back-button {
    position: absolute;
    left: 20px;
    top: 20px;
    z-index: 10;
}

/* Grid de herramientas mejorado */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.tool-item {
    background: white;
    border-radius: 16px;
    padding: 25px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid #E8F4EF;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: 260px;
    position: relative;
    overflow: hidden;
}

.tool-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.tool-item:hover::before {
    transform: scaleX(1);
}

.tool-item:hover {
    transform: translateY(-8px);
    border-color: var(--color-primary);
    box-shadow: 0 15px 30px rgba(26, 109, 61, 0.15);
}

.tool-item.active {
    border-color: var(--color-primary);
    background: linear-gradient(135deg, #F0F9F4 0%, #E8F4EF 100%);
    box-shadow: 0 10px 25px rgba(26, 109, 61, 0.2);
}

/* Imágenes de herramientas mejoradas */
.tool-item img {
    width: 160px !important;
    height: 140px !important;
    object-fit: contain;
    object-position: center;
    background: var(--gradient-light);
    border-radius: 12px;
    padding: 15px;
    border: 2px solid #E8F4EF;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.tool-item:hover img {
    transform: scale(1.08);
    border-color: var(--color-primary);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.tool-item.active img {
    border-color: var(--color-primary);
    background: white;
    box-shadow: 0 8px 16px rgba(26, 109, 61, 0.15);
}

.tool-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-dark);
    margin-top: 10px;
    line-height: 1.4;
    padding: 0 10px;
    transition: color 0.3s ease;
    position: relative;
    z-index: 1;
}

.tool-item:hover .tool-name {
    color: var(--color-primary);
}

/* ===== MODAL MEJORADO ===== */
.tool-modal .modal-content {
    border-radius: 20px;
    border: none;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}

.tool-modal .modal-header {
    background: var(--gradient-primary);
    color: white;
    padding: 1.5rem 2rem;
    border-bottom: none;
    position: relative;
}

.tool-modal .modal-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-accent), #FFD700);
}

.tool-modal .modal-title {
    font-weight: 700;
    font-size: 1.5rem;
}

.tool-modal .btn-close {
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    padding: 0.5rem;
    transition: all 0.3s ease;
}

.tool-modal .btn-close:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

.tool-modal .modal-body {
    padding: 2rem;
}

.tool-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 4px solid var(--color-primary);
    box-shadow: 0 8px 20px rgba(26, 109, 61, 0.2);
}

/* Pestañas del modal mejoradas */
.tool-modal .nav-tabs {
    border-bottom: 3px solid #E8F4EF;
    margin-bottom: 1.5rem;
}

.tool-modal .nav-link {
    color: #666;
    border: none;
    border-radius: 8px 8px 0 0;
    padding: 12px 24px;
    font-weight: 600;
    margin-right: 5px;
    transition: all 0.3s ease;
}

.tool-modal .nav-link:hover {
    color: var(--color-primary);
    background: rgba(26, 109, 61, 0.05);
}

.tool-modal .nav-link.active {
    background: var(--color-primary);
    color: white;
    position: relative;
}

.tool-modal .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--color-accent);
}

/* ===== FOOTER MEJORADO ===== */
footer.bg-dark {
    background: var(--color-dark) !important;
    padding: 2.5rem 0;
    margin-top: auto;
    position: relative;
}

footer.bg-dark::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
}

footer p {
    color: rgba(255,255,255,0.9);
    font-size: 1rem;
    margin: 0;
}

/* ===== RESPONSIVE MEJORADO ===== */

/* Laptops grandes (≥1400px) */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .tools-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 30px;
    }
    
    .tool-item img {
        width: 180px !important;
        height: 160px !important;
    }
}

/* Laptops (≥1200px) */
@media (max-width: 1399px) and (min-width: 1200px) {
    .tools-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 25px;
    }
    
    .tool-item img {
        width: 160px !important;
        height: 140px !important;
    }
}

/* Tablets grandes (≥992px) */
@media (max-width: 1199px) and (min-width: 992px) {
    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .tool-item {
        min-height: 240px;
        padding: 20px 15px;
    }
    
    .tool-item img {
        width: 140px !important;
        height: 120px !important;
    }
}

/* Tablets (≥768px) */
@media (max-width: 991px) and (min-width: 768px) {
    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
    
    .tool-item {
        min-height: 220px;
        padding: 18px 12px;
    }
    
    .tool-item img {
        width: 130px !important;
        height: 110px !important;
        padding: 12px;
    }
    
    .module-card .card-body {
        padding: 1.5rem;
    }
    
    .module-header {
        padding: 40px 0;
    }
}

/* Tablets pequeñas y móviles grandes (≥576px) */
@media (max-width: 767px) and (min-width: 576px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .tool-item {
        min-height: 200px;
        padding: 15px 10px;
    }
    
    .tool-item img {
        width: 120px !important;
        height: 100px !important;
        padding: 10px;
        margin-bottom: 15px;
    }
    
    .module-card {
        margin-bottom: 1.5rem;
    }
    
    .module-header {
        padding: 30px 15px;
        margin-bottom: 30px;
    }
    
    .display-5 {
        font-size: 2rem;
    }
    
    .logo-img {
        height: 50px;
    }
}

/* Móviles (<576px) */
@media (max-width: 575px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .tool-item {
        min-height: 180px;
        padding: 12px 8px;
    }
    
    .tool-item img {
        width: 100px !important;
        height: 90px !important;
        padding: 8px;
        margin-bottom: 12px;
    }
    
    .tool-name {
        font-size: 0.9rem;
        padding: 0 5px;
    }
    
    .module-card {
        margin-bottom: 1rem;
    }
    
    .module-header {
        padding: 25px 10px;
        margin-bottom: 25px;
        border-radius: 15px;
    }
    
    .display-5 {
        font-size: 1.75rem;
    }
    
    .logo-img {
        height: 40px;
    }
    
    .navbar-nav .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .btn-module, .btn-success {
        padding: 12px 24px;
        font-size: 0.9rem;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .tool-modal .modal-body {
        padding: 1rem;
    }
    
    .tool-image {
        height: 200px;
    }
}

/* Móviles muy pequeños (<400px) */
@media (max-width: 399px) {
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .tool-item {
        min-height: 160px;
        padding: 15px;
        max-width: 280px;
        margin: 0 auto;
    }
    
    .tool-item img {
        width: 140px !important;
        height: 120px !important;
        padding: 10px;
    }
    
    .module-header {
        padding: 20px 10px;
    }
    
    .display-5 {
        font-size: 1.5rem;
    }
    
    .back-button {
        position: relative;
        left: 0;
        top: 0;
        margin-bottom: 15px;
        display: inline-block;
    }
}

/* ===== ANIMACIONES ADICIONALES ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 0.6s ease forwards;
}

.module-detail.active {
    animation: fadeInUp 0.5s ease forwards;
}

/* Efecto de scroll suave */
html {
    scroll-behavior: smooth;
}

/* Mejoras de accesibilidad */
.btn:focus, .nav-link:focus, .form-control:focus {
    box-shadow: 0 0 0 0.25rem rgba(26, 109, 61, 0.25);
    border-color: var(--color-primary);
}

/* Sombras suaves para profundidad */
.shadow-soft {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.shadow-medium {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.shadow-hard {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

/* Gradientes para fondos */
.bg-gradient-primary {
    background: var(--gradient-primary);
}

.bg-gradient-light {
    background: var(--gradient-light);
}

/* Badges mejorados */
.badge {
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 0.5rem 1rem;
    border-radius: 50px;
}

.bg-warning {
    background: linear-gradient(135deg, #FFA500, #FFC107) !important;
    color: white !important;
}

/* Mejoras para texto */
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Ajustes para mantener consistencia */
.row.g-4 {
    margin-right: 0;
    margin-left: 0;
}

.row.g-4 > [class*='col-'] {
    padding-right: calc(var(--bs-gutter-x) * .5);
    padding-left: calc(var(--bs-gutter-x) * .5);
    margin-bottom: 1.5rem;
}

/* Ajuste para imágenes en modal en móviles */
@media (max-width: 768px) {
    .specs-grid {
        grid-template-columns: 1fr !important;
    }
    
    .usage-steps li {
        padding-left: 35px;
    }
}

/* Estilos para mejorar legibilidad */
p, li {
    color: #555;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--color-dark);
}

/* Mejoras de contraste para accesibilidad */
.btn-success:focus {
    background: var(--color-primary);
    color: white;
}

.nav-link.active {
    color: white !important;
}