/*
Theme Name: Mediadoria
Theme URI: https://mediadoria.es
Description: Theme hijo para plataforma de gestión inteligente de seguros con IA
Author: Mediadoria
Author URI: https://mediadoria.es
Template: hello-elementor
Version: 1.0.0
License: Proprietary
Text Domain: mediadoria
*/

/* Fuentes modernas */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* =====================================================
   VARIABLES CSS - PALETA MEDIADORIA
   ===================================================== */
:root {
    /* Colores principales - Verde esmeralda profesional */
    --md-primary: #059669;
    --md-primary-dark: #047857;
    --md-primary-light: #10b981;
    --md-primary-50: #ecfdf5;
    --md-primary-100: #d1fae5;
    
    /* Secundario - Azul profundo */
    --md-secondary: #1e40af;
    --md-secondary-dark: #1e3a8a;
    
    /* Estados */
    --md-danger: #ef4444;
    --md-warning: #f59e0b;
    --md-success: #10b981;
    --md-info: #3b82f6;
    
    /* Grises */
    --md-gray-50: #f9fafb;
    --md-gray-100: #f3f4f6;
    --md-gray-200: #e5e7eb;
    --md-gray-300: #d1d5db;
    --md-gray-400: #9ca3af;
    --md-gray-500: #6b7280;
    --md-gray-600: #4b5563;
    --md-gray-700: #374151;
    --md-gray-800: #1f2937;
    --md-gray-900: #111827;
    
    /* UI */
    --md-radius: 8px;
    --md-radius-lg: 12px;
    --md-shadow: 0 1px 3px rgba(0,0,0,0.1);
    --md-shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --md-shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}

/* =====================================================
   LAYOUT DASHBOARD
   ===================================================== */
.md-dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.md-page-header {
    margin-bottom: 30px;
}

.md-page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--md-gray-900);
    margin: 0 0 8px 0;
}

.md-page-subtitle {
    color: var(--md-gray-500);
    margin: 0;
}

/* =====================================================
   TARJETAS DE ESTADÍSTICAS
   ===================================================== */
.md-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.md-stat-card {
    background: white;
    border-radius: var(--md-radius-lg);
    padding: 20px;
    box-shadow: var(--md-shadow);
    border: 1px solid var(--md-gray-200);
    transition: all 0.2s;
}

.md-stat-card:hover {
    box-shadow: var(--md-shadow-md);
    transform: translateY(-2px);
}

.md-stat-card__label {
    font-size: 0.875rem;
    color: var(--md-gray-500);
    margin-bottom: 8px;
}

.md-stat-card__value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--md-gray-900);
}

.md-stat-card__value--primary {
    color: var(--md-primary);
}

.md-stat-card__value--success {
    color: var(--md-success);
}

.md-stat-card__value--warning {
    color: var(--md-warning);
}

.md-stat-card__change {
    font-size: 0.75rem;
    margin-top: 4px;
    color: var(--md-gray-500);
}

/* =====================================================
   FORMULARIOS
   ===================================================== */
.md-form {
    background: white;
    border-radius: var(--md-radius-lg);
    padding: 30px;
    box-shadow: var(--md-shadow);
    border: 1px solid var(--md-gray-200);
}

.md-form__section {
    margin-bottom: 25px;
}

.md-form__section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--md-gray-700);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--md-gray-200);
}

.md-form__row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 15px;
}

.md-form__group {
    margin-bottom: 15px;
}

.md-form__label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--md-gray-700);
    margin-bottom: 6px;
}

.md-form__label--required::after {
    content: " *";
    color: var(--md-danger);
}

.md-form__input,
.md-form__select,
.md-form__textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.9375rem;
    border: 1px solid var(--md-gray-300);
    border-radius: var(--md-radius);
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.md-form__input:focus,
.md-form__select:focus,
.md-form__textarea:focus {
    outline: none;
    border-color: var(--md-primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.md-form__input--error,
.md-form__select--error,
.md-form__textarea--error {
    border-color: var(--md-danger);
}

.md-form__error {
    font-size: 0.75rem;
    color: var(--md-danger);
    margin-top: 4px;
}

.md-form__textarea {
    min-height: 100px;
    resize: vertical;
}

/* =====================================================
   BOTONES
   ===================================================== */
.md-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--md-radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.md-btn--primary {
    background: var(--md-primary);
    color: white;
}

.md-btn--primary:hover {
    background: var(--md-primary-dark);
    color: white;
}

.md-btn--secondary {
    background: var(--md-gray-100);
    color: var(--md-gray-700);
    border: 1px solid var(--md-gray-300);
}

.md-btn--secondary:hover {
    background: var(--md-gray-200);
}

.md-btn--success {
    background: var(--md-success);
    color: white;
}

.md-btn--danger {
    background: var(--md-danger);
    color: white;
}

.md-btn--sm {
    padding: 6px 12px;
    font-size: 0.8125rem;
}

.md-btn--lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.md-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Botones de acciones en tablas - inline y outline */
.md-table td .md-btn--sm {
    padding: 8px;
    min-width: 36px;
    min-height: 36px;
    background: white;
    border: 1px solid var(--md-primary);
    color: var(--md-primary);
    border-radius: 6px;
    margin-right: 6px;
}

.md-table td .md-btn--sm:hover {
    background: var(--md-primary-50);
}

.md-table td .md-btn--sm.md-btn--secondary {
    border-color: var(--md-primary);
    color: var(--md-primary);
    background: white;
}

.md-table td .md-btn--sm.md-btn--danger {
    border-color: var(--md-primary);
    color: var(--md-primary);
    background: white;
}

.md-table td .md-btn--sm.md-btn--danger:hover {
    background: var(--md-primary-50);
}

/* Contenedor de acciones en tabla - horizontal */
.md-table td:last-child {
    white-space: nowrap;
}

/* =====================================================
   TABLAS
   ===================================================== */
.md-table-wrapper {
    background: white;
    border-radius: var(--md-radius-lg);
    box-shadow: var(--md-shadow);
    border: 1px solid var(--md-gray-200);
    overflow: hidden;
}

.md-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--md-gray-200);
    background: var(--md-gray-50);
}

.md-table-title {
    font-weight: 600;
    color: var(--md-gray-900);
}

.md-table {
    width: 100%;
    border-collapse: collapse;
}

.md-table th,
.md-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--md-gray-200);
    vertical-align: middle;
}

.md-table th {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--md-gray-600);
    background: var(--md-gray-50);
}

.md-table td {
    font-size: 0.875rem;
    color: var(--md-gray-700);
}

.md-table td strong {
    color: var(--md-gray-900);
}

.md-table td small {
    display: block;
    margin-top: 4px;
    line-height: 1.4;
}

.md-table tbody tr:hover {
    background: var(--md-gray-50);
}

.md-table tbody tr:last-child td {
    border-bottom: none;
}

/* =====================================================
   BADGES / ETIQUETAS
   ===================================================== */
.md-badge {
    display: inline-flex;
    align-items: center;
    padding: 0;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--md-gray-700);
}

.md-badge--vivienda,
.md-badge--vehiculos,
.md-badge--sanidad,
.md-badge--vida {
    background: transparent;
    color: var(--md-gray-700);
}

.md-badge--pendiente {
    background: rgba(245, 158, 11, 0.1);
    color: var(--md-warning);
    padding: 4px 10px;
    border-radius: 9999px;
}

.md-badge--analizado {
    background: rgba(16, 185, 129, 0.1);
    color: var(--md-success);
    padding: 4px 10px;
    border-radius: 9999px;
}

.md-badge--enviado {
    background: rgba(59, 130, 246, 0.1);
    color: var(--md-info);
    padding: 4px 10px;
    border-radius: 9999px;
}

/* =====================================================
   FILTROS
   ===================================================== */
.md-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 20px;
    background: var(--md-gray-50);
    border-radius: var(--md-radius-lg);
    margin-bottom: 20px;
    align-items: flex-end;
}

.md-filters__group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.md-filters__group[style*="align-self: flex-end"] {
    flex-direction: row !important;
    gap: 10px;
    align-items: center;
}

.md-filters__label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--md-gray-600);
}

.md-filters__input,
.md-filters__select {
    padding: 8px 12px;
    border: 1px solid var(--md-gray-300);
    border-radius: var(--md-radius);
    font-size: 0.875rem;
    min-width: 150px;
}

.md-filters .md-btn {
    white-space: nowrap;
}

/* =====================================================
   ALERTAS
   ===================================================== */
.md-alert {
    padding: 15px 20px;
    border-radius: var(--md-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.md-alert--success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #065f46;
}

.md-alert--error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #991b1b;
}

.md-alert--warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #92400e;
}

.md-alert--info {
    background: rgba(5, 150, 105, 0.1);
    border: 1px solid rgba(5, 150, 105, 0.3);
    color: #047857;
}

/* =====================================================
   PAGINACIÓN
   ===================================================== */
.md-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-top: 1px solid var(--md-gray-200);
}

.md-pagination__info {
    font-size: 0.875rem;
    color: var(--md-gray-500);
}

.md-pagination__buttons {
    display: flex;
    gap: 5px;
}

.md-pagination__btn {
    padding: 8px 12px;
    font-size: 0.875rem;
    border: 1px solid var(--md-gray-300);
    background: white;
    border-radius: var(--md-radius);
    cursor: pointer;
    transition: all 0.2s;
}

.md-pagination__btn:hover:not(:disabled) {
    background: var(--md-gray-50);
    border-color: var(--md-primary);
}

.md-pagination__btn--active {
    background: var(--md-primary);
    color: white;
    border-color: var(--md-primary);
}

/* =====================================================
   MENÚ MY ACCOUNT
   ===================================================== */

/* Layout del área de cliente */
.woocommerce-account .woocommerce-MyAccount-navigation {
    width: 180px !important;
    min-width: 180px !important;
    max-width: 180px !important;
    flex-shrink: 0;
}

.woocommerce-account .woocommerce-MyAccount-content {
    flex: 1 !important;
    max-width: calc(100% - 200px) !important;
    width: calc(100% - 200px) !important;
}

.woocommerce-account .woocommerce {
    display: flex;
    gap: 30px;
}

.woocommerce-MyAccount-navigation ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.woocommerce-MyAccount-navigation li {
    border-bottom: 1px solid var(--md-gray-200);
}

.woocommerce-MyAccount-navigation li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    color: var(--md-gray-700);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.875rem;
    white-space: nowrap;
}

.woocommerce-MyAccount-navigation li a:hover,
.woocommerce-MyAccount-navigation li.is-active a {
    background: var(--md-primary-50);
    color: var(--md-primary);
}

.woocommerce-MyAccount-navigation li.is-active a {
    border-left: 3px solid var(--md-primary);
    font-weight: 500;
}

/* Separador antes de sección Mediadoria */
.woocommerce-MyAccount-navigation li.md-menu-separator {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid var(--md-gray-200);
}

.woocommerce-MyAccount-navigation li.md-menu-separator::before {
    content: "GESTIÓN";
    display: block;
    padding: 0 12px 8px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--md-gray-500);
}

/* =====================================================
   TARJETAS DE CONTENIDO
   ===================================================== */
.md-card {
    background: white;
    border-radius: var(--md-radius-lg);
    box-shadow: var(--md-shadow);
    border: 1px solid var(--md-gray-200);
    overflow: hidden;
}

.md-card__header {
    padding: 20px;
    border-bottom: 1px solid var(--md-gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.md-card__title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--md-gray-900);
    margin: 0;
}

.md-card__body {
    padding: 20px;
}

.md-card__footer {
    padding: 15px 20px;
    border-top: 1px solid var(--md-gray-200);
    background: var(--md-gray-50);
}

/* =====================================================
   MODALES
   ===================================================== */
.md-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    align-items: center;
    justify-content: center;
}

.md-modal.is-open {
    display: flex;
}

.md-modal__backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.md-modal__content {
    position: relative;
    background: #FFFFFF;
    border-radius: var(--md-radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.md-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 28px;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-bottom: 1px solid #6ee7b7;
    border-radius: var(--md-radius-lg) var(--md-radius-lg) 0 0;
}

.md-modal__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #047857;
    margin: 0;
}

.md-modal__close {
    background: none;
    border: none;
    font-size: 28px;
    color: #047857;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.md-modal__close:hover {
    opacity: 1;
    color: #047857;
}

.md-modal__body {
    padding: 28px;
}

.md-modal__body hr {
    border: none;
    border-top: 1px solid var(--md-gray-200);
    margin: 20px 0;
}

.md-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 18px 28px;
    border-top: 1px solid var(--md-gray-200);
    background: var(--md-gray-50);
    border-radius: 0 0 var(--md-radius-lg) var(--md-radius-lg);
}

/* Formularios dentro del modal - espaciado reducido */
.md-modal .md-form__group {
    margin-bottom: 16px;
}

.md-modal .md-form__row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.md-modal .md-form__row .md-form__group {
    flex: 1;
    margin-bottom: 0;
}

/* =====================================================
   CAJA DE ANÁLISIS IA
   ===================================================== */
.md-ai-box {
    background: linear-gradient(135deg, var(--md-primary-50) 0%, #f0fdf4 100%);
    border: 1px solid var(--md-primary-100);
    border-radius: var(--md-radius-lg);
    padding: 20px;
    margin: 0 0 20px 0;
}

/* Ocultar el HR después de la caja de IA */
.md-ai-box + hr,
.md-modal__body > hr:first-of-type {
    display: none;
}

.md-ai-box__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.md-ai-box__icon {
    width: 40px;
    height: 40px;
    background: var(--md-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.md-ai-box__title {
    font-weight: 600;
    color: var(--md-primary-dark);
}

.md-ai-response {
    background: white;
    border-radius: var(--md-radius);
    padding: 20px;
    border: 1px solid var(--md-gray-200);
}

.md-ai-response h3 {
    color: var(--md-primary-dark);
    margin: 25px 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--md-primary);
}

.md-ai-response h4 {
    color: var(--md-gray-700);
    margin: 18px 0 10px 0;
}

.md-ai-response ul {
    margin: 10px 0;
    padding-left: 20px;
}

.md-ai-response li {
    margin: 8px 0;
}

/* =====================================================
   FOOTER
   ===================================================== */
.md-site-footer {
    background: linear-gradient(135deg, #064e3b 0%, var(--md-primary) 100%);
    color: #FFFFFF;
    padding: 60px 0 0 0;
    margin-top: 80px;
}

.md-footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.md-footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.md-footer-brand {
    max-width: 300px;
}

.md-footer-logo {
    text-decoration: none;
    display: inline-block;
    margin-bottom: 16px;
}

.md-footer-logo__text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #FFFFFF;
}

.md-footer-tagline {
    font-size: 0.9rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.8);
}

.md-footer-title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #FFFFFF;
    margin-bottom: 20px;
}

.md-footer-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.md-footer-links li {
    margin-bottom: 12px;
}

.md-footer-links a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.md-footer-links a:hover {
    color: #FFFFFF;
}

.md-footer-bottom {
    padding: 24px 0;
    text-align: center;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.8);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
    .md-form__row {
        grid-template-columns: 1fr;
    }
    
    .md-stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .md-filters {
        flex-direction: column;
    }
    
    .md-table-wrapper {
        overflow-x: auto;
    }
    
    .md-pagination {
        flex-direction: column;
        gap: 15px;
    }
    
    .md-footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
    
    .md-footer-brand {
        grid-column: 1 / -1;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .md-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .md-footer-grid {
        grid-template-columns: 1fr;
    }
}
