:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    position: relative;
    text-align: center;
    margin-bottom: 40px;
    padding: 60px 30px;
    background: linear-gradient(135deg, #1e40af 0%, var(--primary-color) 50%, #3b82f6 100%);
    color: white;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(37, 99, 235, 0.3);
    overflow: hidden;
}

.header-decorative-circles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 20s ease-in-out infinite;
}

.circle-1 {
    width: 300px;
    height: 300px;
    top: -150px;
    left: -100px;
    animation-delay: 0s;
}

.circle-2 {
    width: 200px;
    height: 200px;
    top: 50%;
    right: -50px;
    animation-delay: 5s;
}

.circle-3 {
    width: 150px;
    height: 150px;
    bottom: -75px;
    left: 30%;
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(30px, -30px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

.header-content {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 10px 24px;
    border-radius: 50px;
    margin-bottom: 25px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    animation: fadeInDown 0.6s ease-out;
}

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

.badge-icon {
    font-size: 1.5rem;
    animation: bounce 2s ease-in-out infinite;
}

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

.badge-text {
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.header-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    line-height: 1.2;
    animation: fadeInUp 0.8s ease-out;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

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

.title-highlight {
    background: linear-gradient(90deg, #fff, rgba(255, 255, 255, 0.8));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 300;
    font-size: 0.7em;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.title-main {
    font-weight: 900;
    font-size: 1.2em;
    letter-spacing: -2px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.header-subtitle {
    font-size: 1.2rem;
    font-weight: 400;
    opacity: 0.95;
    margin-bottom: 30px;
    line-height: 1.6;
    animation: fadeIn 1s ease-out;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

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

.header-features {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    animation: fadeInUp 1.2s ease-out;
}

.feature-tag {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.feature-tag:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-primary:hover {
    background: #1d4ed8;
}

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

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

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
    border: 2px solid var(--border-color);
    transition: transform 0.3s ease;
}

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

.stat-card h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-weight: 600;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.results {
    display: grid;
    gap: 25px;
}

.lot-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    border-left: 5px solid var(--border-color);
    transition: all 0.3s ease;
}

.lot-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateX(5px);
}

.lot-card.buy {
    border-left-color: var(--success-color);
    background: linear-gradient(to right, rgba(34, 197, 94, 0.05), var(--card-bg));
}

.lot-card.evaluate {
    border-left-color: var(--warning-color);
    background: linear-gradient(to right, rgba(245, 158, 11, 0.05), var(--card-bg));
}

.lot-card.discard {
    border-left-color: var(--danger-color);
    background: linear-gradient(to right, rgba(239, 68, 68, 0.05), var(--card-bg));
}

.lot-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.lot-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.lot-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

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

.badge-evaluate {
    background: var(--warning-color);
    color: white;
}

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

.lot-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 8px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    font-weight: 600;
}

.info-value {
    font-size: 1.2rem;
    font-weight: 700;
}

.info-value.positive {
    color: var(--success-color);
}

.info-value.negative {
    color: var(--danger-color);
}

.lot-justification {
    padding: 15px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 3px solid var(--primary-color);
}

.lot-justification strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 8px;
}

.top-products {
    margin-top: 20px;
}

.top-products h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.product-list {
    list-style: none;
}

.product-item {
    padding: 12px;
    margin-bottom: 10px;
    background: var(--bg-color);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}

.product-item:hover {
    background: var(--border-color);
}

.product-name {
    font-weight: 500;
    flex: 1;
}

.product-roi {
    font-weight: 700;
    color: var(--success-color);
    margin-left: 15px;
}

.product-discarded {
    color: var(--danger-color);
    font-style: italic;
}

/* Estilos para colapsar/expandir productos */
.products-header {
    padding: 10px 0;
    user-select: none;
}

.products-header:hover {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 10px;
    margin: -10px;
}

.btn-collapse {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: var(--shadow);
}

.btn-collapse:hover {
    background: #1d4ed8;
    transform: scale(1.1);
}

.collapse-icon {
    transition: transform 0.3s ease;
    display: inline-block;
}

.product-list {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.5s ease, opacity 0.3s ease, margin-top 0.3s ease;
    opacity: 1;
    margin-top: 15px;
}

.product-list.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.error {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--danger-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: var(--danger-color);
    font-weight: 600;
}

.hidden {
    display: none !important;
}

/* Estilos para la pantalla de login */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary-color), #1e40af);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 90%;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
}

.password-input {
    padding: 12px 15px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.password-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-error {
    color: var(--danger-color);
    font-size: 0.9rem;
    text-align: center;
    font-weight: 600;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
}

footer {
    margin-top: 60px;
    padding: 40px 20px;
    text-align: center;
    background: linear-gradient(to bottom, transparent, var(--bg-color));
    border-top: 3px solid var(--primary-color);
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.footer-main {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
}

.disclaimer {
    font-size: 0.95rem;
    font-style: italic;
    color: var(--text-secondary);
    background: rgba(239, 68, 68, 0.05);
    padding: 12px 20px;
    border-radius: 8px;
    border-left: 3px solid var(--warning-color);
    display: inline-block;
}

.footer-copyright {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-copyright p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.footer-copyright strong {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.1rem;
}

.footer-tagline {
    font-size: 0.85rem !important;
    font-style: italic;
    opacity: 0.8;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

.settings {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.settings h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 20px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-item label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.setting-item input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.setting-item input[type="range"]::-webkit-slider-thumb:hover {
    background: #1d4ed8;
    transform: scale(1.1);
}

.setting-item input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.setting-item input[type="range"]::-moz-range-thumb:hover {
    background: #1d4ed8;
    transform: scale(1.1);
}

.setting-item span {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.setting-item small {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
}

.filter-section {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-section label {
    font-weight: 600;
    color: var(--text-primary);
}

.category-select {
    padding: 10px 15px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
}

.category-select:hover {
    border-color: var(--primary-color);
}

.category-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-count {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
}

@media (max-width: 768px) {
    header {
        padding: 40px 20px;
        border-radius: 16px;
    }

    .header-badge {
        padding: 8px 18px;
        font-size: 0.85rem;
    }

    .badge-icon {
        font-size: 1.2rem;
    }

    .header-title {
        font-size: 2rem;
    }

    .title-highlight {
        font-size: 0.65em;
        letter-spacing: 1px;
    }

    .title-main {
        font-size: 1.1em;
        letter-spacing: -1px;
    }

    .header-subtitle {
        font-size: 1rem;
        padding: 0 10px;
    }

    .header-features {
        gap: 10px;
    }

    .feature-tag {
        font-size: 0.8rem;
        padding: 8px 15px;
    }

    .circle-1 {
        width: 200px;
        height: 200px;
    }

    .circle-2 {
        width: 150px;
        height: 150px;
    }

    .circle-3 {
        width: 100px;
        height: 100px;
    }

    .lot-header {
        flex-direction: column;
    }

    .lot-info {
        grid-template-columns: 1fr;
    }

    .footer-copyright {
        font-size: 0.85rem;
    }
}
