/* Styles compilés pour Gestion Patrimoine MinBudget */
/* Version nettoyée et optimisée */

/* ========================================
   POLICES POPPINS - DEFINITIONS LOCALES
======================================== */

@font-face {
    font-family: 'Poppins';
    src: url('../fonts/poppins/Poppins-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Poppins';
    src: url('../fonts/poppins/Poppins-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Poppins';
    src: url('../fonts/poppins/Poppins-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Poppins';
    src: url('../fonts/poppins/Poppins-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ========================================
   VARIABLES CSS CONSOLIDEES
======================================== */

:root {
    /* Couleurs Ministère du Budget - Alignées sur Preline */
    --minbudget-blue: #2563eb;  /* blue-600 Preline */
    --minbudget-blue-dark: #1d4ed8;  /* blue-700 Preline */
    --minbudget-blue-light: #dbeafe;  /* blue-100 Preline */
    --minbudget-yellow: #fff24b;
    --minbudget-red: #db3832;
    
    /* Typographie harmonisée */
    --ui-text-xs: 0.75rem;      /* 12px */
    --ui-text-sm: 0.875rem;     /* 14px */
    --ui-text-base: 0.9375rem;  /* 15px */
    --ui-text-lg: 1rem;         /* 16px */
    --ui-text-xl: 1.125rem;     /* 18px */
    
    /* Dimensions UI */
    --ui-button-sm: 2rem;       /* 32px height */
    --ui-button-md: 2.25rem;    /* 36px height */
    --ui-button-lg: 2.5rem;     /* 40px height */
    
    /* Espacement */
    --ui-padding-sm: 0.5rem;    /* 8px */
    --ui-padding-md: 0.75rem;   /* 12px */
    --ui-padding-lg: 1rem;      /* 16px */
    
    --ui-spacing-xs: 0.375rem;  /* 6px */
    --ui-spacing-sm: 0.5rem;    /* 8px */
    --ui-spacing-md: 0.75rem;   /* 12px */
    --ui-spacing-lg: 1rem;      /* 16px */
}

/* ========================================
   THEMES DAISYUI MINBUDGET
======================================== */

[data-theme="minbudget"] {
    color-scheme: light;
    --minbudget-blue: #2563eb;  /* blue-600 Preline */
    --minbudget-blue-dark: #1d4ed8;  /* blue-700 Preline */
    --minbudget-blue-light: #dbeafe;  /* blue-100 Preline */
    
    /* Variables DaisyUI */
    --p: 217 91% 60%;   /* #2563eb */
    --pc: 0 0% 100%;    /* white */
    --b1: 0 0% 100%;    /* white */
    --bc: 220 13% 22%;  /* #1f2937 */
}

[data-theme="minbudget-dark"] {
    color-scheme: dark;
    --minbudget-blue: #2563eb;  /* blue-600 Preline */
    --minbudget-blue-dark: #1d4ed8;  /* blue-700 Preline */
    --minbudget-blue-light: #3b82f6;  /* blue-500 Preline */
    
    /* Variables DaisyUI */
    --p: 217 91% 60%;   /* #2563eb */
    --pc: 0 0% 100%;    /* white */
    --b1: 220 13% 22%;  /* #1f2937 */
    --bc: 220 14% 95%;  /* #f9fafb */
}

/* ========================================
   TYPOGRAPHIE GLOBALE
======================================== */

* {
    font-family: 'Poppins', system-ui, -apple-system, sans-serif !important;
    font-size: var(--ui-text-base) !important; /* 15px base */
}

h1 { 
    font-size: var(--ui-text-xl) !important; 
    font-weight: 600 !important; 
}

h2 { 
    font-size: var(--ui-text-lg) !important; 
    font-weight: 600 !important; 
}

h3 { 
    font-size: var(--ui-text-base) !important; 
    font-weight: 600 !important; 
}

label { 
    font-size: var(--ui-text-sm) !important; 
    font-weight: 500 !important; 
}

/* Classes utilitaires de taille */
.text-xs { font-size: var(--ui-text-xs) !important; }
.text-sm { font-size: var(--ui-text-sm) !important; }

/* ========================================
   MODE SOMBRE - STYLES CONSOLIDÉS
======================================== */

[data-theme="minbudget-dark"] body,
[data-theme="minbudget-dark"] .bg-base-100,
[data-theme="minbudget-dark"] .bg-white,
[data-theme="minbudget-dark"] fieldset,
[data-theme="minbudget-dark"] .card {
    background-color: #1f2937 !important;
    color: #f9fafb !important;
}

[data-theme="minbudget-dark"] .bg-base-200,
[data-theme="minbudget-dark"] .bg-gray-50,
[data-theme="minbudget-dark"] .bg-gray-100,
[data-theme="minbudget-dark"] .bg-gray-200,
[data-theme="minbudget-dark"] input,
[data-theme="minbudget-dark"] select,
[data-theme="minbudget-dark"] textarea {
    background-color: #374151 !important;
    color: #f9fafb !important;
    border-color: #4b5563 !important;
}

[data-theme="minbudget-dark"] h1,
[data-theme="minbudget-dark"] h2,
[data-theme="minbudget-dark"] h3,
[data-theme="minbudget-dark"] p,
[data-theme="minbudget-dark"] span,
[data-theme="minbudget-dark"] label,
[data-theme="minbudget-dark"] th,
[data-theme="minbudget-dark"] td,
[data-theme="minbudget-dark"] legend,
[data-theme="minbudget-dark"] .text-gray-900,
[data-theme="minbudget-dark"] .text-gray-700,
[data-theme="minbudget-dark"] .text-gray-600,
[data-theme="minbudget-dark"] .text-gray-500,
[data-theme="minbudget-dark"] .text-gray-400 {
    color: #f9fafb !important;
}

/* SVG dans le mode sombre */
[data-theme="minbudget-dark"] svg {
    background-color: transparent !important;
    fill: currentColor !important;
}

/* ========================================
   MODE CLAIR - STYLES CONSOLIDÉS
======================================== */

[data-theme="minbudget"] h1,
[data-theme="minbudget"] h2,
[data-theme="minbudget"] h3,
[data-theme="minbudget"] p,
[data-theme="minbudget"] span,
[data-theme="minbudget"] label,
[data-theme="minbudget"] th,
[data-theme="minbudget"] td,
[data-theme="minbudget"] legend,
[data-theme="minbudget"] .text-gray-900,
[data-theme="minbudget"] .text-gray-700 {
    color: #1f2937 !important;
}

[data-theme="minbudget"] .bg-white,
[data-theme="minbudget"] fieldset,
[data-theme="minbudget"] .card {
    background-color: #ffffff !important;
    color: #1f2937 !important;
}

/* ========================================
   CONTRASTE BLEU - RÈGLES CONSOLIDÉES
======================================== */

/* Tous les éléments avec fond bleu - texte blanc forcé */
*[style*="background-color: var(--minbudget-blue)"],
*[style*="background-color: var(--minbudget-blue)"] *,
*[style*="background-color: #2563eb"],
*[style*="background-color: #2563eb"] *,
*[style*="background-color:#2563eb"],
*[style*="background-color:#2563eb"] *,
*[style*="background: var(--minbudget-blue)"],
*[style*="background: var(--minbudget-blue)"] *,
*[style*="background: #2563eb"],
*[style*="background: #2563eb"] *,
*[style*="background:#2563eb"],
*[style*="background:#2563eb"] *,
.bg-minbudget-blue,
.bg-minbudget-blue *,
.bg-blue-500,
.bg-blue-500 *,
.bg-blue-600,
.bg-blue-600 *,
.bg-blue-700,
.bg-blue-700 * {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    text-shadow: none !important;
}

/* Headers de tableaux avec fond bleu */
thead[style*="background-color: var(--minbudget-blue)"],
thead[style*="background-color: var(--minbudget-blue)"] *,
th[style*="background-color: var(--minbudget-blue)"],
th[style*="background-color: var(--minbudget-blue)"] *,
#result_list thead,
#result_list thead *,
.admin thead[style*="background-color"],
.admin thead[style*="background-color"] * {
    color: #ffffff !important;
    background-color: transparent !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* Boutons avec fond bleu */
button[style*="background-color: var(--minbudget-blue)"],
button[style*="background-color: var(--minbudget-blue)"] *,
.btn[style*="background-color: var(--minbudget-blue)"],
.btn[style*="background-color: var(--minbudget-blue)"] * {
    color: #ffffff !important;
}

/* États hover pour les éléments bleus */
.hover\:bg-blue-600:hover,
.hover\:bg-blue-700:hover,
.hover\:bg-blue-800:hover,
[data-theme="minbudget-dark"] .hover\:bg-blue-600:hover,
[data-theme="minbudget-dark"] .hover\:bg-blue-700:hover,
[data-theme="minbudget-dark"] .hover\:bg-blue-800:hover {
    color: #ffffff !important;
}

/* États hover pour les liens dans les éléments bleus */
*[style*="background-color: var(--minbudget-blue)"] a:hover,
*[style*="background-color: #2563eb"] a:hover,
.admin thead[style*="background-color"] a:hover,
#result_list thead a:hover {
    color: #dbeafe !important;
    text-decoration: underline !important;
}

/* ========================================
   TABLEAUX - STYLES CONSOLIDÉS
======================================== */

[data-theme="minbudget-dark"] table,
[data-theme="minbudget-dark"] thead,
[data-theme="minbudget-dark"] tbody,
[data-theme="minbudget-dark"] tr {
    background-color: #1f2937 !important;
}

[data-theme="minbudget-dark"] th,
[data-theme="minbudget-dark"] td {
    background-color: transparent !important;
    color: #f9fafb !important;
    border-color: #4b5563 !important;
}

[data-theme="minbudget-dark"] #result_list tbody tr {
    background-color: #1f2937 !important;
}

[data-theme="minbudget-dark"] #result_list tbody tr:nth-child(even) {
    background-color: #374151 !important;
}

/* Headers bleus pour les deux thèmes */
[data-theme="minbudget"] #result_list thead,
[data-theme="minbudget-dark"] #result_list thead {
    background-color: var(--minbudget-blue) !important;
}

/* ========================================
   FORMULAIRES ADMIN - STYLES CONSOLIDÉS
======================================== */

.admin .form-control .label .label-text {
    font-size: var(--ui-text-xs) !important;
    font-weight: 500 !important;
}

.admin .form-control input:not([type="checkbox"]):not([type="radio"]),
.admin .form-control select,
.admin .form-control textarea {
    font-size: var(--ui-text-sm) !important;
    height: var(--ui-button-md) !important;
    padding: var(--ui-spacing-xs) var(--ui-spacing-md) !important;
}

.admin .form-control textarea {
    height: auto !important;
    min-height: 72px !important;
    padding: var(--ui-spacing-sm) var(--ui-spacing-md) !important;
}

/* Fieldsets compacts */
.admin .module h2,
.admin .module caption,
.admin .inline-group h2 {
    font-size: var(--ui-text-base) !important;
    padding: var(--ui-spacing-sm) var(--ui-spacing-md) !important;
    margin-bottom: var(--ui-spacing-sm) !important;
}

.admin .module {
    margin-bottom: var(--ui-spacing-lg) !important;
}

.admin .form-row {
    padding: var(--ui-spacing-sm) var(--ui-spacing-md) !important;
    margin-bottom: var(--ui-spacing-xs) !important;
}

/* Mode sombre pour formulaires */
[data-theme="minbudget-dark"] .input-bordered,
[data-theme="minbudget-dark"] .form-control input,
[data-theme="minbudget-dark"] .form-control select,
[data-theme="minbudget-dark"] .form-control textarea {
    background-color: #374151 !important;
    color: #f9fafb !important;
    border-color: #4b5563 !important;
}

[data-theme="minbudget-dark"] .modal-box,
[data-theme="minbudget-dark"] .dropdown-content,
[data-theme="minbudget-dark"] .menu,
[data-theme="minbudget-dark"] .alert,
[data-theme="minbudget-dark"] .badge {
    background-color: #1f2937 !important;
    color: #f9fafb !important;
    border-color: #4b5563 !important;
}

/* ========================================
   SIDEBAR - STYLES CONSOLIDÉS
======================================== */

#sidebar {
    font-size: var(--ui-text-xs) !important;
}

#sidebar summary,
#sidebar a[href] {
    padding: var(--ui-spacing-sm) !important;
    font-size: 11px !important;
}

#sidebar svg {
    width: 14px !important;
    height: 14px !important;
}

/* Sidebar avec fond bleu - texte blanc forcé */
#sidebar summary[style*="background"],
#sidebar summary[style*="background"] *,
#sidebar summary[style*="background-color"],
#sidebar summary[style*="background-color"] *,
#sidebar [style*="var(--minbudget-blue)"],
#sidebar [style*="var(--minbudget-blue)"] *,
#sidebar [style*="#2563eb"],
#sidebar [style*="#2563eb"] * {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    text-shadow: none !important;
}

/* Hover amélioré pour sidebar en mode clair */
[data-theme="minbudget"] #sidebar summary:not([style*="background"]):hover,
[data-theme="minbudget"] #sidebar a:not([style*="background"]):hover,
#sidebar summary:not([style*="background"]):hover,
#sidebar a:not([style*="background"]):hover {
    background-color: rgba(0, 149, 201, 0.08) !important;
    color: #1f2937 !important;
    transition: all 0.2s ease !important;
}

/* ========================================
   BOUTONS CRUD - STYLES CONSOLIDÉS
======================================== */

.intercepted-button {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 24px !important;
    height: 24px !important;
    margin-left: 4px !important;
    margin-right: 2px !important;
    padding: 0 !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 4px !important;
    background: transparent !important;
    text-decoration: none !important;
    opacity: 0.8 !important;
    transition: all 0.2s ease !important;
    vertical-align: top !important;
}

/* Masquage des icônes originales */
.intercepted-button img,
.intercepted-button svg,
.intercepted-button::before {
    display: none !important;
}

/* Icônes SVG via pseudo-éléments */
.intercepted-button::after {
    content: "" !important;
    display: block !important;
    width: 14px !important;
    height: 14px !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}

/* Icônes par type d'action */
.intercepted-button[id^="add_id_"]::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23059669' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M12 6v6m0 0v6m0-6h6m-6 0H6'/%3E%3C/svg%3E") !important;
}

.intercepted-button[id^="change_id_"]::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%231d4ed8' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z'/%3E%3C/svg%3E") !important;
}

.intercepted-button[id^="view_id_"]::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23374151' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M15 12a3 3 0 11-6 0 3 3 0 016 0z'/%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z'/%3E%3C/svg%3E") !important;
}

.intercepted-button[id^="delete_id_"]::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23dc2626' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16'/%3E%3C/svg%3E") !important;
}

/* États hover */
.intercepted-button:hover {
    opacity: 1 !important;
    transform: scale(1.05) !important;
    border-color: #9ca3af !important;
    background: rgba(243, 244, 246, 0.1) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

/* Mode sombre pour boutons CRUD */
[data-theme="minbudget-dark"] .intercepted-button {
    border-color: #6b7280 !important;
}

[data-theme="minbudget-dark"] .intercepted-button:hover {
    background: rgba(75, 85, 99, 0.1) !important;
    border-color: #9ca3af !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

/* Icônes mode sombre - couleurs plus vives */
[data-theme="minbudget-dark"] .intercepted-button[id^="add_id_"]::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%2310b981' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M12 6v6m0 0v6m0-6h6m-6 0H6'/%3E%3C/svg%3E") !important;
}

[data-theme="minbudget-dark"] .intercepted-button[id^="change_id_"]::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%236366f1' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z'/%3E%3C/svg%3E") !important;
}

[data-theme="minbudget-dark"] .intercepted-button[id^="view_id_"]::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23d1d5db' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M15 12a3 3 0 11-6 0 3 3 0 016 0z'/%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z'/%3E%3C/svg%3E") !important;
}

[data-theme="minbudget-dark"] .intercepted-button[id^="delete_id_"]::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23f87171' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16'/%3E%3C/svg%3E") !important;
}

/* ========================================
   WIDGETS ET ALIGNEMENT
======================================== */

.related-widget-wrapper {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.related-widget-wrapper select,
.related-widget-wrapper input {
    flex: 1 !important;
    min-width: 0 !important;
}

.related-widget-wrapper .intercepted-button {
    flex-shrink: 0 !important;
}

/* ========================================
   RESPONSIVE ET LAYOUT
======================================== */

.admin #content {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.admin .results .overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin #result_list th,
.admin #result_list td {
    min-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: var(--ui-spacing-md);
}

.admin #result_list th:first-child,
.admin #result_list td:first-child {
    min-width: 50px !important;
    width: 50px !important;
    max-width: 50px !important;
}

/* ========================================
   AVATARS ET NOTIFICATIONS
======================================== */

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.avatar > div {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-weight: 500;
}

.avatar .bg-neutral {
    background-color: #6b7280 !important;
    color: #ffffff !important;
}

[data-theme="minbudget-dark"] .avatar .bg-neutral {
    background-color: #9ca3af !important;
    color: #1f2937 !important;
}

/* Badge de notification */
.indicator-item[style*="--minbudget-red"],
.badge[style*="--minbudget-red"],
span[style*="background-color: var(--minbudget-red)"] {
    background-color: var(--minbudget-red) !important;
    color: #ffffff !important;
    border: none !important;
    -webkit-text-fill-color: #ffffff !important;
    text-shadow: none !important;
}

[data-theme="minbudget-dark"] .indicator-item[style*="--minbudget-red"],
[data-theme="minbudget-dark"] .badge[style*="--minbudget-red"],
[data-theme="minbudget-dark"] span[style*="background-color: var(--minbudget-red)"] {
    background-color: #ef4444 !important;
}

.badge-xs {
    font-size: 0.625rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

/* ========================================
   UTILITAIRES FINAUX
======================================== */

/* Messages et erreurs compacts */
.admin .messagelist {
    margin-bottom: var(--ui-spacing-md) !important;
}

.admin .messagelist .info,
.admin .messagelist .success,
.admin .messagelist .warning,
.admin .messagelist .error {
    font-size: var(--ui-text-sm) !important;
    padding: var(--ui-spacing-sm) var(--ui-spacing-md) !important;
}

/* Help text compact */
.admin .help,
.admin .helptext {
    font-size: var(--ui-text-xs) !important;
    margin-top: var(--ui-spacing-xs) !important;
}

/* Breadcrumbs compacts */
.admin .breadcrumbs {
    font-size: var(--ui-text-sm) !important;
    padding: var(--ui-spacing-sm) var(--ui-spacing-md) !important;
}

.admin .breadcrumbs a {
    font-size: var(--ui-text-sm) !important;
}

/* Classes Tailwind dark fixes */
[data-theme="minbudget-dark"] .dark\:bg-gray-800,
[data-theme="minbudget-dark"] .dark\:bg-gray-700,
[data-theme="minbudget-dark"] .dark\:text-white {
    background-color: #1f2937 !important;
    color: #f9fafb !important;
}

[data-theme="minbudget-dark"] .border-gray-200,
[data-theme="minbudget-dark"] .dark\:border-gray-700,
[data-theme="minbudget-dark"] .divide-gray-200,
[data-theme="minbudget-dark"] .dark\:divide-gray-700 {
    border-color: #4b5563 !important;
}
