/**
 * MATERIAL UI THEME - CONDUASSIST ECOMMERCE
 * Sistema de temas personalizado con integración de customColors
 * Compatible con Material Design 3
 */

/* ===== MATERIAL DESIGN 3 TOKENS ===== */
:root {
    /* Surface & Background */
    --md-sys-color-surface: var(--light);
    --md-sys-color-on-surface: var(--dark);
    --md-sys-color-background: #fffbfe;
    --md-sys-color-outline: rgba(var(--dark-rgb), 0.12);
    
    /* Elevations */
    --md-sys-elevation-1: 0px 1px 2px rgba(0,0,0,0.3), 0px 1px 3px 1px rgba(0,0,0,0.15);
    --md-sys-elevation-2: 0px 1px 2px rgba(0,0,0,0.3), 0px 2px 6px 2px rgba(0,0,0,0.15);
    --md-sys-elevation-3: 0px 1px 3px rgba(0,0,0,0.3), 0px 4px 8px 3px rgba(0,0,0,0.15);
    
    /* Shapes */
    --md-shape-small: 8px;
    --md-shape-medium: 12px;
    --md-shape-large: 16px;
    --md-shape-full: 9999px;
}

/* ===== COMPONENTES MATERIAL - PERSONALIZACIÓN ===== */

/* Buttons */
md-filled-button, .mdc-button--raised {
    --md-filled-button-container-color: var(--primary);
    --md-filled-button-label-text-color: #ffffff;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    border-radius: var(--md-shape-full);
    text-transform: none;
    padding: 10px 24px;
}

md-filled-button.secondary { --md-filled-button-container-color: var(--secondary); }
md-filled-button.success { --md-filled-button-container-color: var(--success); }
md-filled-button.danger { --md-filled-button-container-color: var(--danger); }

md-outlined-button {
    --md-outlined-button-outline-color: var(--primary);
    --md-outlined-button-label-text-color: var(--primary);
    font-family: 'Poppins', sans-serif;
    border-radius: var(--md-shape-full);
    text-transform: none;
}

md-text-button {
    --md-text-button-label-text-color: var(--primary);
    font-family: 'Poppins', sans-serif;
    text-transform: none;
}

md-icon-button {
    --md-icon-button-icon-color: var(--primary);
}

/* Cards */
.mdc-card {
    background-color: var(--md-sys-color-surface);
    border-radius: var(--md-shape-medium);
    box-shadow: var(--md-sys-elevation-1);
    overflow: hidden;
}

.mdc-card:hover {
    box-shadow: var(--md-sys-elevation-2);
}

.mdc-card__header {
    padding: 16px;
    background-color: rgba(var(--primary-rgb), 0.04);
    border-bottom: 1px solid var(--md-sys-color-outline);
}

.mdc-card__title {
    font-family: 'Montserrat', sans-serif;
    font-size: 22px;
    font-weight: 500;
    color: var(--primary);
    margin: 0;
}

.mdc-card__content {
    padding: 16px;
    font-family: 'Poppins', sans-serif;
    color: var(--md-sys-color-on-surface);
}

.mdc-card__actions {
    padding: 8px 16px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Forms & Inputs */
md-outlined-text-field {
    --md-outlined-text-field-focus-outline-color: var(--primary);
    --md-outlined-text-field-focus-label-text-color: var(--primary);
    --md-outlined-text-field-label-text-font: 'Poppins', sans-serif;
    width: 100%;
}

md-outlined-text-field.error {
    --md-outlined-text-field-error-focus-outline-color: var(--danger);
}

md-outlined-select {
    --md-outlined-select-text-field-focus-outline-color: var(--primary);
    width: 100%;
}

md-checkbox {
    --md-checkbox-selected-container-color: var(--primary);
    --md-checkbox-selected-icon-color: #ffffff;
}

md-radio {
    --md-radio-selected-icon-color: var(--primary);
}

md-switch {
    --md-switch-selected-track-color: var(--primary);
}

/* Navigation */
md-top-app-bar {
    --md-top-app-bar-container-color: var(--primary);
    --md-top-app-bar-headline-color: #ffffff;
    box-shadow: var(--md-sys-elevation-2);
}

md-navigation-bar {
    --md-navigation-bar-container-color: var(--md-sys-color-surface);
    box-shadow: var(--md-sys-elevation-2);
}

md-navigation-tab {
    --md-navigation-tab-active-label-text-color: var(--primary);
    --md-navigation-tab-active-icon-color: var(--primary);
}

/* Dialogs & Modals */
md-dialog {
    --md-dialog-container-color: var(--md-sys-color-surface);
    --md-dialog-headline-color: var(--primary);
    --md-dialog-headline-font: 'Montserrat', sans-serif;
    min-width: 280px;
    max-width: 560px;
}

/* Material Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.modal.show {
    opacity: 1;
}

.modal.fade {
    opacity: 0;
    transition: opacity 0.15s linear;
}

.modal.fade.show {
    opacity: 1;
}

.modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem auto;
    pointer-events: none;
    max-width: 500px;
}

.modal-dialog-scrollable {
    height: calc(100% - 3.5rem);
}

.modal-dialog-scrollable .modal-content {
    max-height: 100%;
    overflow: hidden;
}

.modal-dialog-scrollable .modal-body {
    overflow-y: auto;
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background-color: var(--md-sys-color-surface);
    background-clip: padding-box;
    border-radius: var(--md-shape-large);
    outline: 0;
    box-shadow: var(--md-sys-elevation-3);
}

.modal-header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--md-sys-color-outline);
}

.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 24px;
}

.modal-footer {
    display: flex;
    flex-shrink: 0;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--md-sys-color-outline);
}

/* Modal Backdrop */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-backdrop.fade {
    opacity: 0;
    transition: opacity 0.15s linear;
}

.modal-backdrop.show {
    opacity: 1;
}

/* Modal Sizes */
.modal-xl {
    max-width: 1140px;
}

.modal-lg {
    max-width: 800px;
}

.modal-sm {
    max-width: 300px;
}

/* Modal Fullscreen */
@media (max-width: 991.98px) {
    .modal-fullscreen-lg-down {
        width: 100vw;
        max-width: none;
        height: 100%;
        margin: 0;
    }
    .modal-fullscreen-lg-down .modal-content {
        height: 100%;
        border: 0;
        border-radius: 0;
    }
    .modal-fullscreen-lg-down .modal-header,
    .modal-fullscreen-lg-down .modal-footer {
        border-radius: 0;
    }
    .modal-fullscreen-lg-down .modal-body {
        overflow-y: auto;
    }
}

/* Collapse/Accordion Support */
.collapse:not(.show) {
    display: none;
}

.collapse.show {
    display: block;
}

.collapsing {
    height: 0;
    overflow: hidden;
    transition: height 0.35s ease;
}

/* Tab Content Support */
.tab-content {
    width: 100%;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.tab-pane.fade {
    opacity: 0;
    transition: opacity 0.15s linear;
}

.tab-pane.fade.show {
    opacity: 1;
}

.tab-pane.fade.active.show {
    opacity: 1;
}

.nav-pills .nav-link.active {
    background-color: var(--primary);
    color: white;
}

/* Progress */
md-circular-progress, md-linear-progress {
    --md-circular-progress-active-indicator-color: var(--primary);
    --md-linear-progress-active-indicator-color: var(--primary);
}

/* ===== UTILITY CLASSES ===== */

/* Background Colors */
.bg-primary { background-color: var(--primary) !important; color: #ffffff; }
.bg-secondary { background-color: var(--secondary) !important; color: #ffffff; }
.bg-success { background-color: var(--success) !important; color: #ffffff; }
.bg-danger { background-color: var(--danger) !important; color: #ffffff; }
.bg-warning { background-color: var(--warning) !important; }
.bg-info { background-color: var(--info) !important; color: #ffffff; }
.bg-light { background-color: var(--light) !important; }
.bg-dark { background-color: var(--dark) !important; color: #ffffff; }

.bg-primary-subtle { background-color: rgba(var(--primary-rgb), 0.08) !important; color: var(--primary); }
.bg-secondary-subtle { background-color: rgba(var(--secondary-rgb), 0.08) !important; }
.bg-success-subtle { background-color: rgba(var(--success-rgb), 0.08) !important; }

/* Text Colors */
.text-primary { color: var(--primary) !important; }
.text-secondary { color: var(--secondary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }

/* Elevation */
.elevation-1 { box-shadow: var(--md-sys-elevation-1) !important; }
.elevation-2 { box-shadow: var(--md-sys-elevation-2) !important; }
.elevation-3 { box-shadow: var(--md-sys-elevation-3) !important; }

/* Border Radius */
.rounded-sm { border-radius: var(--md-shape-small) !important; }
.rounded-md { border-radius: var(--md-shape-medium) !important; }
.rounded-lg { border-radius: var(--md-shape-large) !important; }
.rounded-full { border-radius: var(--md-shape-full) !important; }

/* ===== GLOBAL STYLES ===== */
body {
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    line-height: 24px;
    color: var(--md-sys-color-on-surface);
    background-color: var(--md-sys-color-background);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    margin: 0 0 16px 0;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    opacity: 0.8;
}

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

/* ===== NATIVE SELECT - MATERIAL UI MINIMALISTA ===== */
.mui-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-shape-small);
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    background-color: white;
    color: var(--md-sys-color-on-surface);
    transition: border-color 0.2s;
    cursor: pointer;
}

.mui-select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
}

.mui-select:hover {
    border-color: rgba(var(--primary-rgb), 0.5);
}

.mui-select option {
    padding: 8px;
    font-size: 13px;
}
