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

:root {
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.9);
    --bg-glass-hover: rgba(255, 255, 255, 1);
    
    --primary: #277943;
    --primary-hover: #1f6135;
    --secondary: #bd8e50;
    
    --text-primary: #1e293b;
    --text-secondary: #475569;
    
    --border: rgba(0, 0, 0, 0.1);
    
    --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 -1px rgba(0, 0, 0, 0.06);
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    background-image: 
        radial-gradient(at 0% 0%, rgba(39, 121, 67, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(189, 142, 80, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    color: white;
}
.sidebar-logo-text h2 {
    font-size: 1.2rem;
    line-height: 1.2;
}
.sidebar-logo-text p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    background: rgba(0, 0, 0, 0.03);
    color: var(--primary);
}

.nav-link.active {
    border-left: 3px solid var(--primary);
    background: linear-gradient(90deg, rgba(39, 121, 67, 0.05) 0%, transparent 100%);
}

.main-content {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.topbar-title h1 {
    font-size: 1.5rem;
}

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeIn 0.5s ease forwards;
    opacity: 0;
}

.glass-card:nth-child(1) { animation-delay: 0.1s; }
.glass-card:nth-child(2) { animation-delay: 0.2s; }
.glass-card:nth-child(3) { animation-delay: 0.3s; }
.glass-card:nth-child(4) { animation-delay: 0.4s; }

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px 0 rgba(0, 0, 0, 0.1);
    background: var(--bg-glass-hover);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(39, 121, 67, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.5rem;
}

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

.card-value {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    margin-bottom: 0.5rem;
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Utility classes */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Fix para la legibilidad de las opciones en los selects */
.form-control option {
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-family: inherit;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

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

.data-table th {
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges & Alerts */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary { background: var(--primary); color: white; }
.badge-secondary { background: var(--secondary); color: white; }

.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--secondary);
    color: var(--secondary);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--secondary);
    color: var(--secondary);
}

.empty-state {
    padding: 3rem;
    color: var(--text-secondary);
    font-style: italic;
}

.watermark-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-image: url('../img/logo.png'); background-repeat: no-repeat; background-position: center; background-size: 50%; opacity: 0.03; z-index: 0; pointer-events: none; }


/* Pagination */
.pagination { display: flex; list-style: none; padding: 0; margin: 1rem 0; gap: 0.25rem; flex-wrap: wrap; }
.page-item { margin: 0; }
.page-link { display: block; padding: 0.5rem 0.75rem; color: var(--text-primary); background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); text-decoration: none; transition: all 0.2s ease; }
.page-item.active .page-link { background: var(--primary); color: white; border-color: var(--primary); }
.page-item.disabled .page-link { color: var(--text-secondary); background: rgba(0,0,0,0.02); cursor: not-allowed; }
.page-link:hover:not(.disabled) { background: rgba(39, 121, 67, 0.1); color: var(--primary); }
.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.text-muted { color: var(--text-secondary); }
.small { font-size: 0.875rem; }
.fw-semibold { font-weight: 600; }

.justify-items-center { justify-items: center; }
.flex-fill { flex: 1 1 auto; }
@media (min-width: 576px) { .d-sm-flex { display: flex; } .d-sm-none { display: none; } .flex-sm-fill { flex: 1 1 auto; } .align-items-sm-center { align-items: center; } .justify-content-sm-between { justify-content: space-between; } }

/* Responsive adjustments */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 2000;
        transition: left 0.3s ease;
    }

    .sidebar.show {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1999;
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-content {
        padding: 1rem;
    }

    .topbar {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .topbar-right-panel {
        width: 100%;
        justify-content: space-between;
    }

    .data-table-container {
        overflow-x: auto;
    }
}


@media (max-width: 768px) {
    .menu-toggle {
        display: block !important;
    }
    .breadcrumbs-nav {
        display: none;
    }
    .sidebar {
        padding-top: 1rem;
    }
    .topbar-title {
        margin-bottom: 0.5rem;
    }
}


@media (max-width: 768px) {
    .glass-card {
        overflow-x: auto;
    }
}


@media (max-width: 768px) {
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns: 1fr 2fr"],
    div[style*="grid-template-columns: 1fr 3fr"],
    div[style*="grid-template-columns: 1fr 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    
    .data-table-container, .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .topbar {
        padding: 1rem;
    }
    
    
    
    .data-table th, .data-table td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
}



@media (max-width: 768px) {
    .data-table {
        min-width: 600px;
    }
    .data-table th, .data-table td {
        white-space: nowrap;
    }
    
    /* Pagination fixes */
    .d-flex.justify-content-between.align-items-center {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start !important;
    }
    .d-flex.align-items-center {
        flex-wrap: wrap;
        gap: 10px;
    }
    .pagination {
        justify-content: center;
        width: 100%;
    }
    
    /* Buttons in table actions */
    td > .btn {
        margin-bottom: 5px;
        display: inline-block;
        width: auto;
    }
}


@media (max-width: 768px) {
    div[style*="justify-content: space-between; align-items: center"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px !important;
    }
    
    .data-table-container, .table-responsive, div[style*="overflow-x: auto"] {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
    }
    
    .data-table {
        min-width: 800px !important;
    }
    
    .data-table th, .data-table td {
        white-space: nowrap !important;
    }
}


@media (max-width: 768px) {
    .pagination {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
    }
    .page-item .page-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }
    
    nav > div.d-flex.justify-content-between {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        width: 100%;
        text-align: center;
    }
    nav > div.d-flex.justify-content-between > div {
        margin-top: 10px;
    }
    
    .data-table-container, div[style*="overflow-x: auto"] {
        padding-bottom: 10px;
    }
}

