/* ==========================================================================
   1. VARIABLES DE THÈME & RESET
   ========================================================================== */
:root {
    --win-blue: #000080;
    --win-yellow: #FFDE21;  
    --win-headerfooter: #FFFF00;
    --win-light-blue: #BDD5FB;
    --win-green: #008000;
    --win-white: #FFFFFF;
    --win-light-grey: #F0F0F0;
    --max-menu-width: 500px;
    --shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Reset de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

/* Verrouillage de la racine (Mobile SPA) */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    background-color: var(--win-light-blue);
}

/* ==========================================================================
   2. STRUCTURE DE L'APPLICATION (SPA Layout)
   ========================================================================== */
.app-page {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    -webkit-overflow-scrolling: touch;
}

.app-footer {
    flex-shrink: 0;
    background-color: var(--win-blue);
    color: white;
    text-align: center;
    padding: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

.app-header {
    background-color: var(--win-blue);
    color: white;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 50px;
}

.header-title {
    font-size: 1.3rem;
    font-weight: bold;
    margin: 0;
}

/* ==========================================================================
   3. BOUTONS & COMPOSANTS D'ACTION
   ========================================================================== */
/* Bouton Retour */
.btn-back {
    position: absolute;
    left: 15px;
    background-color: var(--win-white);
    color: var(--win-blue);
    border: 1px solid var(--win-blue);
    border-radius: 6px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    line-height: 1;
}

.btn-back-icon {
    font-size: 0.9rem;
}

.btn-back:active {
    background-color: #e6e6e6;
}

/* Boutons de listes compacts */
.btn-list,
.btn-list-delete,
.btn-list-group,
.btn-edit {
    margin: 0 !important;
    width: 36px !important;
    height: 36px !important;
    border: 0;
    border-radius: 8px;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    box-shadow: 3px 3px #DCDCDC;
}

.btn-list { background-color: var(--win-blue); }
.btn-list-delete { background-color: #dc3545; }
.btn-list-group { background-color: var(--win-white); }
.btn-edit { 
    background-color: transparent; 
    width: 32px !important; 
    height: 32px !important; 
}

/* Actions Formulaire */
.form-actions-top {
    display: flex;
    justify-content: center;
    gap: 12px;
    width: 100%;
    max-width: 450px;
    margin: 15px auto;
}

.btn-action {
    background-color: var(--win-blue);
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.btn-action:active {
    background-color: #00005a;
}

.btn-save-action {
    background-color: var(--win-blue) !important;
    color: var(--win-white) !important;
    border: none;
    border-radius: 6px;
    padding: 10px 22px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    transition: transform 0.1s, background-color 0.2s;
}

.btn-save-action:hover {
    background-color: orange !important;
    transform: translateY(-1px);
}

.btn-save-action:active {
    transform: translateY(1px);
}

/* Boutons d'actions génériques */
.btn-vanilla-action {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid #ced4da;
    transition: background-color 0.2s, border-color 0.2s;
}

.btn-vanilla-success {
    background-color: #f8f9fa;
    color: #2e7d32;
}
.btn-vanilla-success:hover {
    background-color: #e8f5e9;
    border-color: #2e7d32;
}

.btn-vanilla-warning {
    background-color: var(--win-white);
    color: #f57c00;
}
.btn-vanilla-warning:hover {
    background-color: #fff3e0;
    border-color: #f57c00;
}

.btn-vanilla-danger {
    background-color: var(--win-white);
    border: 1px solid #dc3545;
    color: #dc3545;
}
.btn-vanilla-danger:hover {
    background-color: #dc3545;
    color: var(--win-white);
}

#btn-input-delete {
    background-color: #e74c3c;
    color: var(--win-white);
    opacity: 1;
    cursor: pointer;
}

#btn-input-delete:disabled {
    background-color: #ccc;
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================================================
   4. NAVIGATION & MENUS
   ========================================================================== */
.content-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.main-logo {
    margin: 20px 0;
}

.logo-container, .menu-container {
    width: 100%;
    max-width: var(--max-menu-width);
}

.logo-container {
    text-align: left;
    margin-bottom: 10px;
}

.menu-list {
    width: 100%;
    max-width: 500px;
    background: var(--win-white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--win-blue);
    cursor: pointer;
    transition: background 0.2s;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:active {
    background-color: #f5f5f5;
}

.menu-icon {
    font-size: 1.2rem;
    margin-right: 15px;
}

.menu-text {
    flex: 1;
    color: var(--win-blue);
    font-weight: bold;
    font-size: 1.3rem;
}

.menu-arrow {
    color: var(--win-blue);
    font-weight: bold;
}

.menu-arrow img {
    width: 28px;
    height: 28px;
    display: block;
}

.my-custom-icon {
    width: 32px !important;  
    height: 32px !important; 
    margin-right: 12px !important;
    position: static !important;
    display: block !important;
    padding: 0 !important;
}

/* ==========================================================================
   5. FORMULAIRES & CARTES COMPACTES
   ========================================================================== */
.info-group {
    width: 100%;
    max-width: 500px;
    margin-bottom: 20px;
}

.list-header {
    color: var(--win-blue) !important;
    background-color: #f0f0f0;
    font-weight: bold;
    font-size: 1.05rem;
    padding: 10px 15px;
    margin-bottom: 15px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    border-bottom: 2px solid var(--win-blue) !important;
    letter-spacing: 0.5px;
}

.info-card {
    background: var(--win-white);
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.info-item {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.info-item:last-child {
    border-bottom: none;
}

.info-item:hover, .info-item:active {
    background-color: #f9f9fc;
}

.info-icon {
    margin-right: 15px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.info-icon img {
    width: 32px;
    height: 32px;
    display: block;
}

.info-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

.info-text h4 {
    color: var(--win-blue);
    font-size: 0.95rem;
    font-weight: bold;
    margin: 0 0 3px 0;
}

.info-text p {
    color: var(--win-blue);
    font-size: 0.85rem;
    margin: 0;
}

.info-action {
    margin-left: auto !important;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding-left: 10px;
}

.info-action img {
    width: 24px !important;
    height: 24px !important;
    max-width: none !important;
    display: block;
}

.form-card {
    padding: 18px;
    box-sizing: border-box;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
    text-align: left;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    color: var(--win-blue);
    font-weight: bold;
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.form-group input, 
.form-group textarea {
    width: 100%;
    padding: 10px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: var(--win-white);
    box-sizing: border-box;
    color: var(--win-blue);
}

.form-group input[type="number"] {
    text-align: right;
}

.form-group input:disabled {
    background-color: #f2f2f2;
    border: 1px dashed #ccc;
    color: #777;
    cursor: not-allowed;
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

/* Alignements en ligne pour formulaires */
.form-group-inline {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    margin-bottom: 6px !important;
    width: 100%;
    box-sizing: border-box;
}

.form-group-inline label {
    width: 100px;
    flex-shrink: 0;
    margin-bottom: 0 !important;
    text-align: left;
    color: #374151 !important;
    font-weight: 600;
    font-size: 14px;
}

.form-group-inline input, 
.form-group-inline select,
.form-group-inline textarea {
    flex: 1;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 6px 10px;
    height: 38px;
    min-height: 38px;
    font-size: 14px;
    color: var(--win-blue);
    background-color: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
}

.form-group-inline input:focus, 
.form-group-inline select:focus,
.form-group-inline textarea:focus {
    outline: none;
    background-color: var(--win-white);
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-group-inline select {
    line-height: 1.2;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2310b981%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 12px auto;
    padding-right: 28px;
}

.form-group-inline textarea {
    height: 42px !important;
    min-height: 42px !important;
    resize: vertical;
}

.form-card-compact {
    background: var(--win-white);
    border-radius: 12px;
    padding: 10px 14px !important;
    margin-bottom: 10px !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.form-group-inline input:disabled,
.form-group-inline input[readonly],
.form-group-inline select:disabled {
    background-color: #e2e8f0 !important;
    border-color: #cbd5e1 !important;
    color: var(--win-blue) !important;
    opacity: 0.8;
    cursor: not-allowed;
    box-shadow: none !important;
}

/* ==========================================================================
   6. ONGLET & FILTRES
   ========================================================================== */
.analysis-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin: 0 auto 20px auto;
    width: 100%;
    max-width: 500px;
}

.analysis-filter-bar label {
    color: var(--win-blue);
    background-color: var(--win-white);
    font-size: 1.1rem;
    font-weight: bold;
    white-space: nowrap;
}

.filter-select-container {
    display: flex;
    gap: 10px;
    flex-grow: 1;
}

.filter-select-container select {
    flex: 1; /* Distribue l'espace équitablement */
    padding: 8px 10px;
    font-size: 1rem;
    border: 1px solid var(--win-blue);
    border-radius: 6px;
    background-color: var(--win-white);
    color: var(--win-blue);
    height: 38px; /* Hauteur cohérente */
    cursor: pointer;
}

.tabs-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    background: var(--win-white);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.tabs-header {
    display: flex;
    background-color: var(--win-white);
    border-bottom: 2px solid #e1e1e8;
}

.tab-btn {
    flex: 1;
    padding: 12px 15px;
    border: none;
    font-size: 1rem;
    font-weight: bold;
    color: var(--win-blue);
    background: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    color: var(--win-white);
    background-color: var(--win-blue);
    border-bottom: 3px solid var(--win-blue);
    margin-bottom: -2px;
}
.tab-btn:hover:not(.active) {
    background-color: #d9e6f2;
}

.tabs-content {
    padding: 15px;
}

.tab-pane {
    display: none;
}

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

.tab-btn-sub {
    padding: 8px 15px;
    border: none;
    background: var(--win-blue);
    color: white;
    font-weight: bold;
    cursor: pointer;
    border-bottom: 1px solid #000080;
    transition: all 0.2s;
}

.tab-btn-sub.active {
    border-bottom: 1px solid var(--win-blue);
    color: var(--win-blue);
    background-color: orange;
}

.tab-btn-sub:hover:not(.active) {
    background-color: #d9e6f2;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}

/* ==========================================================================
   7. TABLEAUX & TABULATOR
   ========================================================================== */
table {
    border: 1px solid var(--win-blue);
    border-collapse: collapse;
}

.tabulator {
    background-color: var(--win-white) !important;
    color: var(--win-blue) !important;   
    font-weight: 500;
	border: 1px solid #000080;
}
.tabulator-header .tabulator-col {
    background-color: var(--win-blue) !important;
    color: var(--win-white) !important;   
    font-weight: 500;
}

.tabulator .tabulator-tableholder .tabulator-cell {
    background-color: var(--win-white) !important;
    color: var(--win-blue) !important;
    font-weight: 500;
}

.tabulator .tabulator-row.tabulator-selected,
.tabulator .tabulator-row.tabulator-selected .tabulator-cell,
.tabulator .tabulator-row.tabulator-selected:hover,
.tabulator .tabulator-row.tabulator-selected:hover .tabulator-cell {
    background-color: #FFB742 !important;
    color: var(--win-blue) !important;
    font-weight: bold; 
}
/*     background-color: var(--win-light-grey) !important; */

.tabulator-row {
    min-height: auto !important;
}

.tabulator-row .tabulator-cell {
    padding: 6px 4px !important;
    line-height: 1.3 !important;
}

/* #tables-list-container { */
    /* overflow: hidden !important; /* Laisse Tabulator gérer le scroll tout seul */ */
    /* box-sizing: border-box; */
/* } */

.clickable-score {
    cursor: pointer;
    text-decoration: underline dotted #28a745;
    font-weight: bold;
}

.clickable-score:not(.is-empty):active {
    background-color: #e2e3e5;
}

.clickable-score.is-empty {
    cursor: default;
    text-decoration: none !important;
}

/* Podium & Top 3 */
.top3-title {
    color: #2e7d32;
    text-align: center;
    margin: 10px 0 5px 0;
    font-size: 16px;
}

.podium-cards-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 5px;
}

.podium-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--win-white);
    border-radius: 10px;
    padding: 12px 15px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    border-left: 5px solid #ccc;
}

.podium-card.rank-1 { border-left-color: #ffd700; background: linear-gradient(90deg, #fffdf0 0%, #ffffff 100%); }
.podium-card.rank-2 { border-left-color: #c0c0c0; }
.podium-card.rank-3 { border-left-color: #cd7f32; }

.podium-badge {
    font-size: 22px;
    margin-right: 12px;
}

.podium-details {
    flex-grow: 1;
}

.podium-date {
    font-size: 12px;
    color: #666;
    font-weight: bold;
}

.podium-golf {
    font-size: 14px;
    color: #1b5e20;
    font-weight: bold;
}

.podium-subtext {
    font-size: 11px;
    color: #888;
}

.podium-score {
    font-size: 22px;
    font-weight: bold;
    color: #2e7d32;
    padding-left: 10px;
}

.best3_card {
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
    transition: 0.3s;
    width: 33%;
    background-color: var(--win-light-grey);
    border: black 2px outset;
    border-radius: 5px;
}

.best3_card:hover {
    box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
}

.best3_container {
    padding: 2px 16px;
}

.top3-grid-container {
    display: flex;
    flex-direction: row;
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
}

.top3-column {
    flex: 1;
    min-width: 0;
}

@media (max-width: 600px) {
    .top3-grid-container {
        flex-direction: column;
    }
}

/* ==========================================================================
   9. FENÊTRES MODALES & DIALOGS
   ========================================================================== */
.custom-modal {
    border: none;
    border-radius: 8px;
    padding: 0;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--win-white);
}

.custom-modal::backdrop,
dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

/* 
dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
}
 */
 
.modal-header {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    border-bottom: 1px solid #eee;
	background-color: #000080;
}

.modal-header i {
    font-size: 1.3rem;
}

.modal-body {
    padding: 20px;
    color: #000080;
    font-size: 1rem;
    line-height: 1.4;
	background-color: #BDD5FB;
}

.modal-footer {
    padding: 10px 20px;
    text-align: right;
    border-top: 1px solid #000080;
	background-color: #000080;
}

.btn-modal {
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    color: var(--win-white);
}

/* Variantes Modales */
.modal-green .modal-header { color: #2ecc71; }
.modal-green .btn-modal { background-color: #2ecc71; }
.modal-green .btn-modal:active { background-color: #27ae60; }

.modal-orange .modal-header { color: #f39c12; }
.modal-orange .btn-modal { background-color: #f39c12; }
.modal-orange .btn-modal:active { background-color: #d35400; }

.modal-red .modal-header { color: #e74c3c; }
.modal-red .btn-modal { background-color: #e74c3c; }
.modal-red .btn-modal:active { background-color: #c0392b; }

/* ==========================================================================
   10. ÉDITEURS & COMPOSANTS SPÉCIFIQUES
   ========================================================================== */
/* Texte Informations */
.about-title { color: var(--win-blue) !important; font-weight: bold !important; display: block; }
.about-subtitle { color: var(--win-blue) !important; font-size: 0.85em !important; display: block; }

/* Métadonnées Designer */
.designer-meta-labels, 
.designer-meta-labels strong,
#tab-main-db strong {
    color: var(--win-blue) !important;
    font-weight: bold;
}

/* Éditeur Quill */
#quill-db-editor,
#quill-table-desc-editor,
#quill-table-rel-editor {
    border: 2px dashed #000080;
    border-radius: 8px;
    background-color: #f8fafc;
    min-height: 250px;
    transition: border-color 0.2s, background-color 0.2s;
}

.ql-container.ql-snow {
    border: 1px solid #000080 !important;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    background-color: var(--win-white) !important;
}

.ql-toolbar.ql-snow {
    border: 1px solid #000080 !important;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    background-color: #f0f4f9 !important;
}

/* Déclinée d'en-tête bleu pour la modale */
.modal-header-blue {
    background-color: var(--win-blue);
    color: var(--win-white);
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Croix de fermeture */
.btn-close-modal {
    background: none;
    border: none;
    color: var(--win-white);
    font-size: 1.5em;
    cursor: pointer;
    line-height: 1;
}

.btn-close-modal:hover {
    color: var(--win-yellow);
}

/* Alignement spécifique du textarea dans la modale */
.form-group-inline.align-top {
    align-items: flex-start;
}

.form-group-inline.align-top textarea {
    height: 90px !important;
    min-height: 90px !important;
}

/* Centrage parfait et réinitialisation des marges par défaut du <dialog> */
dialog#dialog-add-table {
  margin: auto;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

/* Arrière-plan sombre semi-transparent */
dialog#dialog-add-table::backdrop {
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
}

/* Conteneur principal du menu déroulant */
.er-dropdown {
    position: relative;
    display: inline-block;
}

/* Bouton principal */
.er-btn-drop {
    background: #1e3a8a;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
}

.er-btn-drop:hover {
    background: #1d4ed8;
}

.er-btn-drop:disabled {
    background: #64748b;
    opacity: 0.6;
    cursor: not-allowed;
}

/* Menu flottant */
.er-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background-color: #ffffff;
    min-width: 140px;
    box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    z-index: 1000;
    overflow: hidden;
}

/* Éléments du menu */
.er-dropdown-content a {
    color: #1e293b;
    padding: 8px 12px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.15s ease;
}

.er-dropdown-content a:hover {
    background-color: #f1f5f9;
}

/* Affichage dynamique */
.er-dropdown.active .er-dropdown-content {
    display: block;
}

/* Style de la carte sélectionnée */
.db-table-card.selected-card {
    outline: 2px solid #ef4444 !important; /* Bordure rouge dynamique */
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4) !important;
}