* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Arial, sans-serif;
    transition: background-color var(--transition-speed),
                color var(--transition-speed),
                border-color var(--transition-speed),
                box-shadow var(--transition-speed);
}

:root {
    --transition-speed: 0.3s;
    --bg-dark: #f0f2f5;
    --bg-darker: #ffffff;
    --text-light: #1a1b1e;
    --text-gray: #4b5563;
    --primary-blue: #3b82f6;
    --accent-dark: #2563eb;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --overlay-color: rgba(255, 255, 255, 0.35);
    --success-green: #10b981;
    --warning-orange: #f59e0b;
    --danger-red: #ef4444;
    --varibox-color: #8b5cf6;
    --tangko-color: #ec4899;
    --ibc-color: #14b8a6;
}

/* Degradado para el fondo de la página */
body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e5e9f2 100%);
    min-height: 100vh;
}

/* Header styles */
header {
    background-color: var(--bg-darker);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-image {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.logo {
    color: var(--text-light);
    font-weight: bold;
    font-size: 1.2rem;
}

.search-bar {
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 400px;
    margin: 0 2rem;
}

.search-bar input {
    padding: 0.8rem;
    border: none;
    border-radius: 20px;
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.search-bar input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logout-button {
    background-color: transparent;
    border: 1px solid var(--primary-blue);
    color: var(--primary-blue);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.logout-button:hover {
    background-color: var(--primary-blue);
    color: white;
}

#userName {
    font-weight: 500;
    color: var(--text-light);
}

/* Main container styles */
.admin-container {
    max-width: 1400px;
    margin: 1rem auto;
    padding: 0 1rem 70px 1rem;
}

/* Section styles */
.admin-section {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    padding: 2rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

.admin-section.compact-section {
    padding: 1rem;
}

.admin-section:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-light);
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-blue);
}

.section-title i {
    color: var(--primary-blue);
}

/* Barra de Control Compacta */
.control-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: space-between;
}

/* Estadísticas Compactas */
.stats-compact {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.stat-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 10px 15px;
    border-radius: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-left: 3px solid var(--primary-blue);
    transition: all 0.3s ease;
}

.stat-mini:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.stat-mini i {
    color: var(--primary-blue);
    font-size: 1.2rem;
}

.stat-mini.flomay {
    border-left-color: var(--success-green);
}

.stat-mini.flomay i {
    color: var(--success-green);
}

.stat-mini.cliente {
    border-left-color: var(--warning-orange);
}

.stat-mini.cliente i {
    color: var(--warning-orange);
}

.stat-mini.varibox {
    border-left-color: var(--varibox-color);
}

.stat-mini.varibox i {
    color: var(--varibox-color);
}

.stat-mini.tangko {
    border-left-color: var(--tangko-color);
}

.stat-mini.tangko i {
    color: var(--tangko-color);
}

.stat-mini.ibc {
    border-left-color: var(--ibc-color);
}

.stat-mini.ibc i {
    color: var(--ibc-color);
}

.stat-mini span {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-light);
}

/* Filtros Compactos */
.filters-compact {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn-mini {
    background: white;
    border: 2px solid #e5e7eb;
    color: var(--text-gray);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.filter-btn-mini:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
    transform: scale(1.1);
}

.filter-btn-mini.active {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

.filter-btn-mini i {
    font-size: 1rem;
}

/* Botón Crear */
.btn-add {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.2);
}

.btn-add:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.3);
}

/* Botones de Exportación */
.btn-export {
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    color: white;
}

.btn-export.excel {
    background: #217346;
    box-shadow: 0 4px 8px rgba(33, 115, 70, 0.2);
}

.btn-export.excel:hover {
    background: #1a5c37;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(33, 115, 70, 0.3);
}

.btn-export.word {
    background: #2b579a;
    box-shadow: 0 4px 8px rgba(43, 87, 154, 0.2);
}

.btn-export.word:hover {
    background: #1e3f6f;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(43, 87, 154, 0.3);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #f3f4f6;
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-dark));
    color: white;
    border-radius: 15px 15px 0 0;
}

.modal-header h2 {
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-form {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: var(--text-light);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.form-group label i {
    color: var(--primary-blue);
}

.form-group input,
.form-group select {
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: white;
    color: var(--text-light);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 15px;
    border-top: 2px solid #f3f4f6;
}

.btn-cancel,
.btn-save {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-cancel {
    background: #f3f4f6;
    color: var(--text-gray);
}

.btn-cancel:hover {
    background: #e5e7eb;
}

.btn-save {
    background: var(--primary-blue);
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-save:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

/* Select de Cliente */
.select-cliente {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    color: var(--text-light);
}

.select-cliente:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Vista Previa Cliente */
.info-preview {
    background: #f8fafc;
    border-left: 4px solid var(--primary-blue);
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.info-preview h4 {
    color: var(--text-light);
    margin-bottom: 10px;
    font-size: 1rem;
}

.info-preview p {
    color: var(--text-gray);
    margin: 8px 0;
    font-size: 0.95rem;
}

.info-preview span {
    color: var(--text-light);
    font-weight: 600;
}

/* Contenedores */
#contenedoresContainer {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tipo-grupo {
    margin-bottom: 30px;
}

.tipo-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-dark));
    color: white;
    border-radius: 10px;
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 1.1rem;
}

.tipo-header.varibox {
    background: linear-gradient(135deg, var(--varibox-color), #7c3aed);
}

.tipo-header.tangko {
    background: linear-gradient(135deg, var(--tangko-color), #db2777);
}

.tipo-header.ibc {
    background: linear-gradient(135deg, var(--ibc-color), #0d9488);
}

.tipo-header i {
    font-size: 1.3rem;
}

.contenedores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.contenedor-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--primary-blue);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.contenedor-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: rgba(59, 130, 246, 0.05);
    border-radius: 0 0 0 100%;
}

.contenedor-card.en-flomay {
    border-left-color: var(--success-green);
}

.contenedor-card.en-cliente {
    border-left-color: var(--warning-orange);
}

.contenedor-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.contenedor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f3f4f6;
}

.contenedor-numero {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.contenedor-numero i {
    color: var(--primary-blue);
}

.contenedor-estado {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.estado-flomay {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-green);
}

.estado-cliente {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-orange);
}

.contenedor-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-gray);
    font-size: 0.95rem;
}

.info-item i {
    width: 20px;
    color: var(--primary-blue);
}

.info-item strong {
    color: var(--text-light);
}

.tiempo-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 8px;
}

.tiempo-reciente {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-green);
}

.tiempo-medio {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-orange);
}

.tiempo-antiguo {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-red);
}

.producto-badge {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-blue);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.contenedor-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #f3f4f6;
}

.btn-action {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.btn-edit {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-blue);
}

.btn-edit:hover {
    background: var(--primary-blue);
    color: white;
}

.btn-delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-red);
}

.btn-delete:hover {
    background: var(--danger-red);
    color: white;
}

/* Navigation bar styles */
.navigation-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
    padding: 5px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.nav-item {
    color: var(--text-gray);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.9em;
    transition: color 0.3s ease;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary-blue);
}

.nav-item i {
    font-size: 1.5em;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-gray);
}

.empty-state i {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

/* Responsive styles */
@media (max-width: 768px) {
    header {
        padding: 0.5rem 1rem;
        height: auto;
        flex-direction: column;
        gap: 0.5rem;
    }

    .logo-container {
        width: 100%;
        justify-content: center;
    }

    .logo-image {
        height: 30px;
    }

    .logo {
        font-size: 1rem;
    }

    .search-bar {
        width: 100%;
        margin: 0.5rem 0;
    }

    .admin-section {
        padding: 1rem;
    }

    .section-title {
        font-size: 1.2rem;
    }

    .control-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-compact {
        justify-content: center;
    }

    .filters-compact {
        justify-content: center;
    }

    .btn-add {
        justify-content: center;
    }

    .btn-export {
        width: 100%;
        justify-content: center;
    }

    .form-grid-2 {
        grid-template-columns: 1fr;
    }

    .contenedores-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
    }
}

@media (max-width: 480px) {
    .admin-container {
        margin: 0.5rem auto;
        padding: 0 0.5rem 70px 0.5rem;
    }

    .stats-compact {
        gap: 8px;
    }

    .stat-mini {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .stat-mini i {
        font-size: 1rem;
    }

    .contenedor-card {
        padding: 15px;
    }

    .contenedor-numero {
        font-size: 1.2rem;
    }

    .modal-form {
        padding: 20px 15px;
    }
}

/* Fix para el scroll en iOS */
@supports (-webkit-touch-callout: none) {
    body {
        min-height: -webkit-fill-available;
    }
    
    .navigation-bar {
        padding-bottom: max(5px, env(safe-area-inset-bottom));
    }
}