:root {
    --primary-color: #2e7d32;
    --secondary-color: #4caf50;
    --accent-color: #81c784;
    --light-color: #e8f5e9;
    --dark-color: #1b5e20;
    --error-color: #f44336;
    --success-color: #66bb6a;
    --text-dark: #212121;
    --text-light: #ffffff;
    --border-radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--light-color);
    color: var(--text-dark);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background-color: var(--primary-color);
    color: var(--text-light);
    padding: 20px 0;
    text-align: center;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.app-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

@media (min-width: 768px) {
    .app-container {
        grid-template-columns: 1fr 1fr;
    }
}

.input-section, .result-section {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
}

input, select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: var(--transition);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin: 5px;
    color: var(--text-light);
}

.btn i {
    margin-right: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--dark-color);
}

.btn-secondary {
    background-color: var(--secondary-color);
}

.btn-secondary:hover {
    background-color: var(--primary-color);
}

.btn-danger {
    background-color: var(--error-color);
}

.btn-danger:hover {
    background-color: #d32f2f;
}

.btn-disabled {
    background-color: #9e9e9e;
    cursor: not-allowed;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 30px;
    gap: 10px;
}

.image-preview {
    margin-top: 10px;
    border: 2px dashed var(--accent-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-placeholder {
    color: #757575;
    text-align: center;
}

.result-card {
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 20px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    font-weight: 600;
    color: var(--dark-color);
}

.chart-container {
    width: 100%;
    max-width: 300px;
    margin: 30px auto;
    position: relative;
}

.error-message {
    color: var(--error-color);
    margin-top: 5px;
    font-size: 14px;
    display: none;
}

.pdf-container {
    display: none;
}

#imagenCarga {
    display: none;
}

footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px 0;
    color: var(--text-dark);
    font-size: 14px;
}

/* Estilos para la vista previa de PDF */
.pdf-preview {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 100;
    overflow-y: auto;
    padding: 20px;
}

.pdf-content {
    background-color: white;
    max-width: 794px; /* A4 width in pixels at 96 dpi */
    min-height: 1123px; /* A4 height in pixels at 96 dpi */
    margin: 0 auto;
    padding: 40px;
    box-shadow: var(--shadow);
    position: relative;
}

.pdf-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    color: white;
    cursor: pointer;
    background-color: var(--dark-color);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.input-unit {
    display: flex;
}

.input-unit input {
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.input-unit span {
    min-width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--secondary-color);
    color: var(--text-light);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

/* Estilo para carga de imagen con efecto drag & drop */
.image-upload {
    position: relative;
}

.image-upload-label {
    display: block;
    height: 200px;
    border: 2px dashed var(--accent-color);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
}

.image-upload-label:hover {
    background-color: rgba(129, 199, 132, 0.1);
}

.image-upload-label i {
    font-size: 48px;
    color: var(--accent-color);
    margin-bottom: 10px;
}

.image-upload-text {
    color: #757575;
}

.spinner {
    display: none;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(76, 175, 80, 0.3);
    border-radius: 50%;
    border-top: 4px solid var(--primary-color);
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.tooltip {
    position: relative;
    display: inline-block;
    margin-left: 8px;
    color: var(--primary-color);
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: var(--dark-color);
    color: var(--text-light);
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 14px;
    font-weight: normal;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

/* Estilos para el modo oscuro del sistema */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #1c2620;
        --text-dark: #e0e0e0;
    }

    body {
        background-color: #121b16;
    }

    .input-section, .result-section, .pdf-content {
        background-color: #1a231e;
        color: var(--text-light);
    }

    input, select {
        background-color: #2a332e;
        color: var(--text-light);
        border-color: #3a433e;
    }

    .result-card {
        background-color: #1a231e;
    }

    .result-item {
        border-bottom-color: #3a433e;
    }
}

/* Animación para resaltar resultados */
@keyframes highlight {
    0% { background-color: rgba(76, 175, 80, 0.2); }
    100% { background-color: transparent; }
}

.highlight {
    animation: highlight 2s ease-out;
}

/* Estilos responsivos adicionales */
@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        margin: 5px 0;
    }
}

/* Estilos para el botón de compartir y su modal */
.modal-compartir {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-compartir.active {
    display: flex;
}

.modal-contenido {
    background: white;
    padding: 20px;
    border-radius: 10px;
    max-width: 300px;
    width: 90%;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.redes-sociales {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 15px 0;
}

.red-social {
    padding: 10px;
    border-radius: 5px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
}

.red-social:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.whatsapp { background: #25d366; }
.facebook { background: #1877f2; }
.twitter { background: #1da1f2; }
.copy-link { background: var(--primary-color); }

.btn-cerrar {
    margin-top: 10px;
    padding: 8px 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cerrar:hover {
    background: var(--primary-dark-color);
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 15px 25px;
    border-radius: 25px;
    font-weight: 600;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
