:root {
    --color-primary: #FF6B6B;
    --color-secondary: #4ECDC4;
    --color-tertiary: #45B7D1;
    --color-accent: #FFD166;
    --color-text: #2D3436;
    --color-light: #F7F9FA;
    --color-dark: #2D3436;
    --color-success: #06D6A0;
    --color-warning: #FFD166;
    --color-danger: #EF476F;
    --color-modal-bg: rgba(0, 0, 0, 0.5);
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --card-radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #F5F7FA;
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

header {
    margin-bottom: 10px;
    padding: 15px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-tertiary) 100%);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    color: white;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.header-text {
    flex: 1;
    min-width: 200px;
}

.logo {
    width: 150px;
    height: auto;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1 {
    font-size: 1.8rem;
    color: white;
    margin-bottom: 5px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.price-tag {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 5px 10px;
    border-radius: 20px;
    display: inline-block;
    font-weight: bold;
}

h2 {
    font-size: 1.4rem;
    color: var(--color-dark);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

h2 .icon {
    font-size: 1.2em;
}

main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    flex: 1;
}

.card {
    background-color: white;
    padding: 20px;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 0;
}

.form-group {
    margin-bottom: 15px;
}

.form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 150px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--color-dark);
    font-size: 14px;
}

input, textarea, select {
    width: 100%;
    padding: 12px;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    font-size: 15px;
    background-color: white;
    transition: all 0.3s ease;
    -webkit-appearance: none;
}

input:focus, textarea:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.2);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 120px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background-color: #FF5252;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(239, 71, 111, 0.3);
}

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

.btn-secondary:hover {
    background-color: #3DBEB6;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(78, 205, 196, 0.3);
}

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

.btn-tertiary:hover {
    background-color: #3CA8C4;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(69, 183, 209, 0.3);
}

.resumen-box {
    padding: 15px;
    background-color: rgba(69, 183, 209, 0.1);
    border-radius: 8px;
    margin-top: 10px;
    color: var(--color-dark);
    font-size: 15px;
    border-left: 4px solid var(--color-tertiary);
}

.resumen-box p {
    margin-bottom: 8px;
}

.pendiente {
    color: var(--color-danger);
    font-weight: bold;
}

.completo {
    color: var(--color-success);
    font-weight: bold;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.filtros {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.filtros .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 200px;
}

.table-container {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    border: 1px solid #E0E0E0;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
    min-width: 600px;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #E0E0E0;
    font-size: 14px;
}

th {
    background-color: var(--color-secondary);
    color: white;
    position: sticky;
    top: 0;
    font-weight: 600;
}

tr:nth-child(even) {
    background-color: rgba(69, 183, 209, 0.05);
}

tr:hover {
    background-color: rgba(255, 107, 107, 0.05);
}

.acciones-cell {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.acciones-cell .btn {
    padding: 8px 12px;
    font-size: 13px;
    min-width: auto;
    flex: none;
}

.no-data {
    text-align: center;
    padding: 20px;
    color: var(--color-text);
    font-style: italic;
}

footer {
    text-align: center;
    margin-top: auto;
    padding: 15px;
    background: linear-gradient(135deg, var(--color-tertiary) 0%, var(--color-primary) 100%);
    border-radius: var(--card-radius);
    color: white;
    font-size: 14px;
    box-shadow: var(--card-shadow);
}

/* Estilos para el modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-modal-bg);
    overflow: auto;
    touch-action: manipulation;
}

.modal-content {
    background-color: var(--color-light);
    margin: 5% auto;
    padding: 25px;
    border-radius: var(--card-radius);
    width: 95%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: modalFadeIn 0.3s ease-out;
}

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

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: var(--color-dark);
    cursor: pointer;
    padding: 5px;
    transition: all 0.3s ease;
}

.close-modal:hover {
    color: var(--color-primary);
    transform: rotate(90deg);
}

/* Alertas */
.alerta {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
    max-width: 90%;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

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

.alerta.error {
    background-color: var(--color-danger);
    color: white;
}

.alerta.warning {
    background-color: var(--color-warning);
    color: var(--color-dark);
}

/* Media Queries para móviles */
@media (max-width: 480px) {
    .container {
        padding: 10px;
        gap: 15px;
    }

    header {
        padding: 15px 10px;
    }

    .logo {
        width: 100px;
    }

    h1 {
        font-size: 1.4rem;
    }

    h2 {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }

    .card {
        padding: 15px;
    }

    .form-group {
        margin-bottom: 12px;
    }

    input, textarea, select {
        padding: 10px;
        font-size: 14px;
    }

    .btn {
        padding: 10px 15px;
        font-size: 14px;
        min-width: 100%;
    }

    .form-actions {
        flex-direction: column;
    }

    .modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
    }

    .filtros .form-group {
        min-width: 100%;
    }

    th, td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .resumen-box {
        padding: 12px;
        font-size: 14px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .logo {
        width: 120px;
    }

    .btn {
        min-width: 140px;
    }

    .modal-content {
        width: 90%;
    }

    main {
        grid-template-columns: 1fr 1fr;
    }

    .ventas-section {
        grid-column: span 2;
    }
}

@media (min-width: 769px) {
    main {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
    }

    .form-section {
        grid-column: 1;
        grid-row: 1;
    }

    .resumen-section {
        grid-column: 2;
        grid-row: 1;
    }

    .ventas-section {
        grid-column: span 2;
        grid-row: 2;
    }
}
