/* ============================================================
   ESTILOS CRM - GRISES ELEGANTES
   ============================================================ */

/* RESET Y BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fa;
    color: #2d3748;
    line-height: 1.6;
}

/* VARIABLES DE COLOR (para referencia) */
:root {
    --bg-principal: #f8f9fa;
    --bg-secundario: #ffffff;
    --sidebar-bg: #2c3e50;
    --texto-principal: #2d3748;
    --texto-secundario: #718096;
    --borde: #e2e8f0;
    --btn-primario: #4a5568;
    --btn-primario-hover: #2d3748;
    --btn-exito: #48bb78;
    --btn-peligro: #f56565;
    --link: #4299e1;
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */

.crm-container {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    background-color: #000000;
    color: #ffffff;
    padding: 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    padding: 20px;
    background-color: #000000;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 10px 0;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 15px;
}

.sidebar-menu a:hover {
    background-color: #34495e;
    padding-left: 25px;
}

.sidebar-menu a.active {
    background-color: #4a5568;
    border-left: 4px solid #4299e1;
    padding-left: 16px;
}

.sidebar-menu-icon {
    margin-right: 12px;
    font-size: 18px;
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}

/* HEADER */
.header {
    background-color: #ffffff;
    padding: 20px 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h1 {
    font-size: 24px;
    font-weight: 600;
    color: #2d3748;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #4a5568;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.user-name {
    font-size: 14px;
    color: #2d3748;
}

/* CONTENT AREA */
.content {
    padding: 30px;
}

/* ============================================================
   COMPONENTES
   ============================================================ */

/* CARDS */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.card-title {
    font-size: 14px;
    color: #718096;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-value {
    font-size: 32px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 4px;
}

.card-footer {
    font-size: 13px;
    color: #718096;
    margin-top: 12px;
}

.card-success {
    border-left: 4px solid #48bb78;
}

.card-warning {
    border-left: 4px solid #ed8936;
}

.card-danger {
    border-left: 4px solid #f56565;
}

.card-info {
    border-left: 4px solid #4299e1;
}

/* SECTION */
.section {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}

/* BOTONES */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background-color: #4a5568;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #2d3748;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-success {
    background-color: #48bb78;
    color: #ffffff;
}

.btn-success:hover {
    background-color: #38a169;
}

.btn-danger {
    background-color: #f56565;
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #e53e3e;
}

.btn-secondary {
    background-color: #e2e8f0;
    color: #2d3748;
}

.btn-secondary:hover {
    background-color: #cbd5e0;
}

.buttons-demo {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* INPUTS Y FORMULARIOS */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 8px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-family: inherit;
    color: #2d3748;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* TABLAS */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background-color: #f8f9fa;
}

.table th {
    padding: 12px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #2d3748;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
}

.table td {
    padding: 12px;
    font-size: 14px;
    color: #2d3748;
    border-bottom: 1px solid #e2e8f0;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* BADGES */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background-color: #c6f6d5;
    color: #22543d;
}

.badge-warning {
    background-color: #feebc8;
    color: #7c2d12;
}

.badge-danger {
    background-color: #fed7d7;
    color: #742a2a;
}

.badge-info {
    background-color: #bee3f8;
    color: #2c5282;
}

/* ALERTAS */
.alert {
    padding: 14px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background-color: #c6f6d5;
    color: #22543d;
    border-left: 4px solid #48bb78;
}

.alert-warning {
    background-color: #feebc8;
    color: #7c2d12;
    border-left: 4px solid #ed8936;
}

.alert-danger {
    background-color: #fed7d7;
    color: #742a2a;
    border-left: 4px solid #f56565;
}

.alert-info {
    background-color: #bee3f8;
    color: #2c5282;
    border-left: 4px solid #4299e1;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* MOBILE MENU TOGGLE */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: #2d3748;
    cursor: pointer;
}

/* TABLET Y MÓVIL */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 80vw;
        max-width: 320px;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-toggle {
        display: block;
        font-size: 30px;
    }

    .header {
        padding: 20px;
        min-height: 70px;
    }

    .header-left h1 {
        font-size: 22px;
    }

    .content {
        padding: 20px 15px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .buttons-demo {
        flex-direction: column;
    }

    .btn:not(.mobile-menu-toggle) {
        width: 100%;
    }
}

/* OVERLAY PARA MÓVIL */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 999;
}

.overlay.active {
    display: block;
}

@media (max-width: 768px) {
    .overlay.active {
        display: block;
    }
}

/* ============================================================
   FORMULARIO PEDIDOS
   ============================================================ */

.form-section {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 24px;
}

.form-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}

.autocomplete-wrapper {
    position: relative;
}

.autocomplete-sugerencias {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.autocomplete-item {
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
    color: #2d3748;
}

.autocomplete-item:hover {
    background-color: #f8f9fa;
}

.cliente-info-box {
    display: none;
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    font-size: 14px;
    color: #4a5568;
}

.resumen-box {
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 20px;
}

.resumen-fila {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

.resumen-fila span:first-child {
    color: #718096;
}

.resumen-fila span:last-child {
    font-weight: 600;
    color: #2d3748;
}

.resumen-total {
    display: flex;
    justify-content: space-between;
    border-top: 2px solid #2d3748;
    padding-top: 12px;
    margin-top: 8px;
    font-size: 16px;
    font-weight: 700;
    color: #2d3748;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #2d3748;
    cursor: pointer;
    margin-bottom: 12px;
}

.checkbox-label input[type="checkbox"] {
    width: 17px;
    height: 17px;
    cursor: pointer;
}

.botones-pedido {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .botones-pedido {
        flex-direction: column;
    }
    .botones-pedido .btn {
        width: 100%;
        text-align: center;
    }
}