/* ==========================================================================
   THEME: VIBRANT MODERN v5.1 (Full Width)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    /* Gradientes Vibrantes */
    --gph-grad-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gph-grad-success: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --gph-grad-card:    linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    
    /* Colores Sólidos */
    --gph-accent: #764ba2;
    --gph-success-solid: #2ecc71;
    --gph-danger: #e74c3c;
    --gph-text-dark: #2d3436;
    --gph-text-light: #636e72;
    --gph-bg-main: #f0f2f5;
    
    /* UI */
    --gph-radius: 16px;
    --gph-shadow: 0 10px 30px rgba(0,0,0,0.08);
    --gph-shadow-hover: 0 20px 40px rgba(118, 75, 162, 0.2);
    --gph-border: #e2e8f0;
}

#gph-app-container {
    font-family: 'Poppins', sans-serif;
    background: var(--gph-bg-main);
    padding: 30px;
    border-radius: var(--gph-radius);
    width: 100%;
    margin: 20px auto;
    color: var(--gph-text-dark);
    box-sizing: border-box;
}

#gph-app-container * { box-sizing: border-box; }

/* --- HEADER --- */
.gph-header {
    background: #fff;
    border-radius: var(--gph-radius);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--gph-shadow);
    margin-bottom: 30px;
}

.gph-brand h1 {
    margin: 0;
    font-weight: 700;
    background: var(--gph-grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2rem;
    letter-spacing: -1px;
}

.gph-tag {
    background: #e0e7ff;
    color: var(--gph-accent);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 10px;
    vertical-align: middle;
    display: inline-block;
}

.gph-stat-card { text-align: right; }
.gph-stat-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; color: var(--gph-text-light); }
.gph-stat-value { font-size: 2.2rem; font-weight: 700; color: var(--gph-accent); line-height: 1; }

/* --- LAYOUT STACK (Arriba Abajo) --- */
.gph-layout-stack {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* --- SECCIÓN SUPERIOR: FORMULARIO --- */
.gph-card {
    background: #fff;
    border-radius: var(--gph-radius);
    box-shadow: var(--gph-shadow);
    overflow: hidden;
    border: 1px solid #fff;
}

.gph-card-header { padding: 20px 30px; color: #fff; }
.gradient-header { background: var(--gph-grad-primary); }
.gradient-green { background: var(--gph-grad-success); color: #064e3b !important; }

.gph-card-header h3 { margin: 0; font-size: 1.2rem; font-weight: 600; display: flex; align-items: center; gap: 10px; }

.gph-form-body { padding: 30px; }

/* Grid de formulario desktop */
.gph-row-desktop {
    display: flex;
    gap: 20px;
    align-items: flex-end; /* Alinear botones abajo */
    margin-bottom: 20px;
}
.gph-row-desktop:last-child { margin-bottom: 0; }

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.flex-3 { flex: 3; }

@media(max-width: 900px) {
    .gph-row-desktop { flex-direction: column; align-items: stretch; gap: 15px; }
}

/* Inputs Modernos */
.gph-form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--gph-text-light);
}

.gph-label-required::after { content: " *"; color: var(--gph-danger); }

.gph-input, .gph-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #edf2f7;
    border-radius: 12px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    transition: all 0.3s;
    background: #f8fafc;
}

.gph-input:focus, .gph-select:focus {
    border-color: var(--gph-accent);
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 4px rgba(118, 75, 162, 0.1);
}

.input-error { border-color: var(--gph-danger) !important; background: #fff5f5; }
.shake-anim { animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake { 10%, 90% { transform: translate3d(-1px, 0, 0); } 20%, 80% { transform: translate3d(2px, 0, 0); } 30%, 50%, 70% { transform: translate3d(-4px, 0, 0); } 40%, 60% { transform: translate3d(4px, 0, 0); } }

/* Botones */
.gph-btn {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.gph-btn-primary { background: var(--gph-grad-primary); color: #fff; box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3); }
.gph-btn-success { background: var(--gph-grad-success); color: #064e3b; box-shadow: 0 10px 20px rgba(67, 233, 123, 0.3); }
.gph-btn-whatsapp { background: #25D366; color: #fff; box-shadow: 0 10px 20px rgba(37, 211, 102, 0.3); }

.gph-btn:hover { transform: translateY(-3px); box-shadow: 0 15px 25px rgba(0,0,0,0.15); }
.gph-btn:active { transform: translateY(-1px); }

.pulse-on-hover:hover { animation: pulse 1s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(118, 75, 162, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(118, 75, 162, 0); } 100% { box-shadow: 0 0 0 0 rgba(118, 75, 162, 0); } }

/* --- SECCIÓN INTERMEDIA: REPORTES --- */
.gph-report-bar {
    background: #fff;
    padding: 15px 30px;
    border-radius: var(--gph-radius);
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--gph-shadow);
}
.gph-label-inline { font-weight: 600; color: var(--gph-text-light); }
.gph-input-inline { padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 8px; font-family: 'Poppins'; }
.gph-btn-icon { background: var(--gph-accent); color: #fff; border: none; padding: 8px 15px; border-radius: 8px; cursor: pointer; font-weight: 500; }

#gph-report-container {
    background: #fff;
    padding: 30px;
    border-radius: var(--gph-radius);
    margin-top: 20px;
    box-shadow: var(--gph-shadow);
    border: 1px solid #e2e8f0;
}

/* Tablas Reporte */
.gph-table { width: 100%; border-collapse: separate; border-spacing: 0 10px; }
.gph-table th { text-align: left; padding: 10px 15px; color: var(--gph-text-light); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; }
.gph-table td { background: #f8f9fa; padding: 15px; border-top: 1px solid #fff; border-bottom: 1px solid #fff; }
.gph-table tr td:first-child { border-top-left-radius: 10px; border-bottom-left-radius: 10px; }
.gph-table tr td:last-child { border-top-right-radius: 10px; border-bottom-right-radius: 10px; }

.gph-badge-sale { background: #fee2e2; color: #dc2626; padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; }
.gph-badge-return { background: #d1fae5; color: #059669; padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; }

.gph-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.gph-close-btn-mini { background: #f1f5f9; border: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-weight: 500; }
.gph-report-footer { margin-top: 15px; text-align: right; }
.gph-btn-link { background: none; border: none; color: var(--gph-accent); cursor: pointer; text-decoration: underline; font-weight: 600; }

/* --- SECCIÓN INFERIOR: TARJETAS --- */
.gph-bottom-section { margin-top: 10px; }
.gph-search-input { padding: 10px 20px; border-radius: 25px; border: 1px solid #e2e8f0; width: 300px; outline: none; }

.gph-cards-grid-full {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

/* Tarjeta Activa */
.gph-card-active {
    background: var(--gph-grad-card);
    border-radius: 20px;
    padding: 25px;
    box-shadow: var(--gph-shadow);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid #fff;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    animation: fadeUp 0.6s ease backwards;
}

@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.gph-card-active:hover { transform: translateY(-10px) scale(1.02); box-shadow: var(--gph-shadow-hover); border-color: #d6bcfa; }
.gph-card-active.selected { border: 2px solid var(--gph-success-solid); transform: scale(0.98); }

.gph-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 15px; }
.gph-tool-name { font-weight: 700; font-size: 1.1rem; color: var(--gph-text-dark); line-height: 1.2; }
.gph-qty-badge { background: var(--gph-danger); color: #fff; padding: 4px 10px; border-radius: 12px; font-weight: 700; font-size: 0.85rem; box-shadow: 0 4px 10px rgba(231, 76, 60, 0.3); }

.gph-card-mid { font-size: 0.9rem; color: var(--gph-text-light); }
.gph-row-info { margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }

/* Overlay "Devolver" */
.gph-card-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(46, 204, 113, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    backdrop-filter: blur(4px);
}
.gph-card-active:hover .gph-card-overlay { opacity: 0.05; } /* Hover sutil */
.gph-card-active.selected .gph-card-overlay { opacity: 1; }

/* --- MODALES --- */
.gph-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(45, 52, 54, 0.6);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
}

.gph-modal-box {
    background: #fff;
    width: 90%;
    max-width: 500px;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    overflow: hidden;
    animation: zoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes zoomIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.gph-modal-header {
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}
.gph-modal-header h3 { margin: 0; color: var(--gph-text-dark); }
.gph-modal-close, .gph-modal-close-return { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #94a3b8; }

.gph-modal-body { padding: 30px; }
#gph-modal-info { font-size: 1.1rem; text-align: center; margin-bottom: 25px; line-height: 1.6; color: var(--gph-text-light); }

/* Botones Grandes Modal */
.gph-modal-actions-grid { display: grid; gap: 15px; }
.gph-btn-big {
    padding: 20px;
    border-radius: 16px;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    line-height: 1.4;
}
.gph-btn-big:hover { transform: scale(1.02); }

/* MENSAJES */
#gph-system-message {
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
    margin-bottom: 30px;
    display: none;
}
.success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* Autocomplete jQuery UI */
.ui-autocomplete {
    background: #fff !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
    border: 1px solid #e2e8f0 !important;
    padding: 10px !important;
    z-index: 10001 !important;
}
.ui-menu-item-wrapper {
    padding: 10px 15px !important;
    border-radius: 8px !important;
    font-family: 'Poppins' !important;
    font-size: 0.95rem !important;
}
.ui-state-active { background: var(--gph-grad-primary) !important; color: #fff !important; border: none !important; }