/* ============================================
   DESIGN OVERRIDES - Clean & Modern
   Mejoras visuales para toda la aplicación
   ============================================ */

/* =========================================
   GLOBAL IMPROVEMENTS
   ========================================= */

/* Smoother transitions everywhere */
*, *::before, *::after {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Better focus states */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Selection color */
::selection {
    background: rgba(var(--primary-rgb), 0.3);
    color: var(--text-primary);
}

/* =========================================
   BUTTONS - REFINED
   ========================================= */

.btn {
    position: relative;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:active {
    transform: scale(0.98) !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 
        0 4px 14px -4px rgba(var(--primary-rgb), 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 20px -6px rgba(var(--primary-rgb), 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 14px -4px rgba(239, 68, 68, 0.5);
}

.btn-danger:hover {
    box-shadow: 0 8px 20px -6px rgba(239, 68, 68, 0.6);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 14px -4px rgba(16, 185, 129, 0.5);
}

/* =========================================
   CARDS - CLEANER DESIGN
   ========================================= */

.card {
    background: linear-gradient(180deg, 
        rgba(30, 30, 35, 0.9) 0%, 
        rgba(22, 22, 28, 0.95) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 4px 20px -8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 12px 40px -12px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(var(--primary-rgb), 0.05);
}

.card-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card-title {
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* =========================================
   METRIC CARDS
   ========================================= */

.metric-card {
    background: linear-gradient(145deg, 
        rgba(28, 28, 35, 0.9) 0%, 
        rgba(20, 20, 26, 0.95) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.5rem;
    transition: all 0.3s ease;
}

.metric-card:hover {
    border-color: rgba(var(--primary-rgb), 0.2);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.4);
}

.metric-card .metric-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.metric-card .metric-label i {
    color: var(--primary);
    font-size: 0.9rem;
}

.metric-card .metric-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

/* =========================================
   FORMS - POLISHED
   ========================================= */

.form-input,
.form-select,
.input-wrapper input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: var(--text-primary);
    transition: all 0.25s ease;
}

.form-input:hover,
.form-select:hover,
.input-wrapper:hover input,
input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
textarea:hover,
select:hover {
    border-color: rgba(255, 255, 255, 0.15) !important;
    background: rgba(255, 255, 255, 0.04) !important;
}

.form-input:focus,
.form-select:focus,
.input-wrapper input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    border-color: var(--primary) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1) !important;
    outline: none;
}

/* =========================================
   SELECT ELEMENTS - CUSTOM STYLING
   ========================================= */

/* Base select styling */
select {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 1rem center !important;
    background-size: 12px !important;
    padding-right: 2.5rem !important;
    cursor: pointer !important;
}

select::-ms-expand {
    display: none !important;
}

/* Select options styling - Dark theme */
select option {
    background: rgba(24, 24, 30, 0.98) !important;
    color: var(--text-primary) !important;
    padding: 0.75rem 1rem !important;
    border: none !important;
}

/* Select dropdown background (for browsers that support it) */
select:focus option:checked {
    background: rgba(var(--primary-rgb), 0.2) !important;
    color: var(--primary) !important;
}

/* Custom select wrapper for better control */
.select-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--text-secondary);
    pointer-events: none;
    transition: all 0.25s ease;
}

.select-wrapper:focus-within::after {
    border-top-color: var(--primary);
    transform: translateY(-50%) rotate(180deg);
}

.select-wrapper select {
    padding-right: 2.5rem;
}

/* Improved select hover and focus states */
select:hover {
    border-color: rgba(255, 255, 255, 0.2) !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
}

select:focus {
    border-color: var(--primary) !important;
    background-color: rgba(255, 255, 255, 0.06) !important;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15) !important;
}

/* Disabled select */
select:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    background-color: rgba(255, 255, 255, 0.02) !important;
}

/* Select in form groups */
.form-group select {
    width: 100%;
    min-height: 44px;
}

/* Multiple select styling */
select[multiple] {
    min-height: 120px;
    padding: 0.75rem !important;
    background-image: none !important;
}

select[multiple] option {
    padding: 0.5rem 0.75rem !important;
    margin: 0.25rem 0 !important;
    border-radius: var(--radius-md) !important;
    cursor: pointer !important;
}

select[multiple] option:hover {
    background: rgba(var(--primary-rgb), 0.15) !important;
}

select[multiple] option:checked {
    background: rgba(var(--primary-rgb), 0.25) !important;
    color: var(--primary) !important;
    font-weight: 600 !important;
}

/* Select size variants */
select.select-sm {
    padding: 0.5rem 2rem 0.5rem 0.75rem !important;
    font-size: 0.875rem !important;
    min-height: 36px !important;
}

select.select-lg {
    padding: 1rem 3rem 1rem 1.25rem !important;
    font-size: 1.125rem !important;
    min-height: 52px !important;
}

/* Select with icons */
.select-with-icon {
    padding-left: 2.5rem !important;
}

/* Custom scrollbar for select dropdowns (when multiple) */
select[multiple]::-webkit-scrollbar {
    width: 8px;
}

select[multiple]::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
}

select[multiple]::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

select[multiple]::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Force dark background for select dropdowns in all browsers */
select {
    background-color: rgba(24, 24, 30, 0.98) !important;
    color: var(--text-primary) !important;
}

/* Override browser default white background for options */
select option {
    background-color: rgba(24, 24, 30, 0.98) !important;
    color: var(--text-primary) !important;
}

/* Selected option styling */
select option:checked,
select option[selected] {
    background: rgba(var(--primary-rgb), 0.25) !important;
    color: var(--primary) !important;
    font-weight: 600 !important;
}

/* Hover state for options (limited browser support) */
select option:hover {
    background: rgba(var(--primary-rgb), 0.15) !important;
}

/* Firefox specific fixes */
@-moz-document url-prefix() {
    select {
        background-color: rgba(24, 24, 30, 0.98) !important;
        color: var(--text-primary) !important;
    }
    
    select option {
        background-color: rgba(24, 24, 30, 0.98) !important;
        color: var(--text-primary) !important;
    }
}

/* Nota: no usar select::-webkit-select-option, no es un pseudo-elemento válido */

/* Additional improvements for better visual consistency */
select {
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* Select with error state */
select.error,
select.has-error {
    border-color: var(--danger) !important;
    background-color: rgba(239, 68, 68, 0.05) !important;
}

select.error:focus,
select.has-error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

/* Select with success state */
select.success,
select.has-success {
    border-color: var(--success) !important;
}

select.success:focus,
select.has-success:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}

/* Select placeholder styling (for empty selects) */
select:invalid {
    color: var(--text-muted);
}

/* Better spacing for select in forms */
.form-group select,
.form-grid select {
    margin-bottom: 0;
}

/* Select with icon on the left */
.select-with-icon-left {
    padding-left: 2.5rem !important;
    background-position: left 0.75rem center, right 1rem center !important;
    background-size: 16px, 12px !important;
}

.input-wrapper {
    position: relative;
    transition: all 0.25s ease;
}

.input-wrapper .icon {
    color: var(--text-muted);
    transition: color 0.25s ease;
}

.input-wrapper:focus-within .icon {
    color: var(--primary);
}

/* =========================================
   SIDEBAR - CLEANER
   ========================================= */

.app-sidebar {
    background: linear-gradient(180deg, 
        rgba(18, 18, 22, 0.98) 0%, 
        rgba(12, 12, 16, 0.99) 100%
    );
    border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-link {
    border-radius: var(--radius-lg);
    margin: 2px 0;
    transition: all 0.25s ease;
    position: relative;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 50%;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
}

/* =========================================
   TABLES - MINIMAL
   ========================================= */

.data-table {
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.data-table tbody tr {
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.data-table tbody td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

/* =========================================
   ALERTS - REFINED
   ========================================= */

.alert {
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border: 1px solid;
}

.alert.success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.alert.danger,
.alert.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.alert.warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.alert.info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

/* =========================================
   BADGES - CONSISTENT
   ========================================= */

.badge,
.status-badge,
.pill {
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: var(--radius-md);
}

/* =========================================
   MODALS - ELEGANT
   ========================================= */

.modal-overlay {
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    background: linear-gradient(180deg, 
        rgba(28, 28, 35, 0.98) 0%, 
        rgba(18, 18, 24, 0.99) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 
        0 25px 80px -20px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-2xl);
}

.modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* =========================================
   PRODUCT CARDS - CLEAN
   ========================================= */

.product-card {
    background: linear-gradient(180deg, 
        rgba(26, 26, 32, 0.95) 0%, 
        rgba(20, 20, 26, 0.98) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover {
    transform: translateY(-6px);
    border-color: rgba(var(--primary-rgb), 0.3);
    box-shadow: 
        0 20px 50px -15px rgba(0, 0, 0, 0.5),
        0 0 30px -10px rgba(var(--primary-rgb), 0.2);
}

.product-card .product-image {
    position: relative;
    overflow: hidden;
}

.product-card .product-image img {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover .product-image img {
    transform: scale(1.08);
}

.product-card .product-title {
    font-weight: 700;
    line-height: 1.4;
}

.product-card .product-price {
    font-weight: 800;
    color: var(--primary);
}

/* =========================================
   AUTH PAGES - styles moved to auth layout
   (legacy overrides removed - new design in views/layouts/auth.php)
   ========================================= */

/* =========================================
   PROGRESS BARS
   ========================================= */

.progress-bar-container,
.progress-bar {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    overflow: hidden;
}

.progress-bar-fill,
.progress-fill {
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 100px;
    position: relative;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   HERO SECTIONS
   ========================================= */

.panel-hero,
.shop-hero,
.hero-section {
    position: relative;
    border-radius: var(--radius-2xl);
    overflow: hidden;
}

.panel-hero::before,
.shop-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(var(--primary-rgb), 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.panel-title,
.hero-title {
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* =========================================
   DROPDOWN MENUS
   ========================================= */

.dropdown-menu,
.action-menu {
    background: rgba(24, 24, 30, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    box-shadow: 
        0 20px 50px -15px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
}

.dropdown-item,
.action-item {
    transition: background 0.2s ease;
}

.dropdown-item:hover,
.action-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* =========================================
   TOASTS
   ========================================= */

.toast {
    background: rgba(24, 24, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.warning {
    border-left: 4px solid #f59e0b;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}

/* =========================================
   SPECIAL EFFECTS
   ========================================= */

/* Subtle glow on primary elements */
.primary-glow {
    position: relative;
}

.primary-glow::after {
    content: '';
    position: absolute;
    inset: -1px;
    background: var(--primary);
    filter: blur(20px);
    opacity: 0.15;
    z-index: -1;
    border-radius: inherit;
}

/* Glass effect */
.glass {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* =========================================
   RESPONSIVE POLISH
   ========================================= */

@media (max-width: 768px) {
    .metric-card {
        padding: 1rem 1.25rem;
    }
    
    .metric-card .metric-value {
        font-size: 1.5rem;
    }
    
    .card {
        border-radius: var(--radius-xl);
    }
    
    .product-card:hover {
        transform: translateY(-3px);
    }
}

/* =========================================
   PRINT STYLES
   ========================================= */

@media print {
    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    .sidebar,
    .app-sidebar,
    .topbar {
        display: none !important;
    }
}
