/* dash.css - Custom styling for the application */

main {
    max-width: 100%; /* Override yk.css default 800px constraint */
    padding: 1rem 2rem;
    margin-top: 80px; /* Compense le header fixe */
}

/* Dashboard Header */
.dash-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: color-mix(in srgb, var(--md-bg), transparent 35%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--md-divider);
    box-shadow: var(--md-shadow-1);
    flex-wrap: wrap;
    gap: 1rem;
}

.dash-header h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--md-primary) 20%, #2196f3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    width: fit-content;
}

.brand img {
    height: 48px;
    width: auto;
    border-radius: var(--md-radius);
}

.dash-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.dash-nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--md-text-secondary);
    font-weight: 700;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: var(--md-radius);
    transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dash-nav a:hover {
    background-color: var(--md-input-bg);
    color: var(--md-primary);
}

.dash-nav a.active {
    background-color: var(--md-primary);
    color: var(--md-on-primary);
    box-shadow: var(--md-shadow-1);
}

.dash-controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    cursor: pointer;
}

/* Section Header (Title + Action) */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1.5rem;
}

#edit-seg-rules-list grid > div:first-child {
    position: relative;
    padding-left: 14px;
}

#edit-seg-rules-list grid > div:first-child::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 1rem; /* Aligne le bas du trait avec le bas du select (grace au margin-bottom: 1rem) */
    height: 48px; 
    width: 4px;
    background-color: transparent;
    transition: background-color 0.3s;
}

#edit-seg-rules-list grid.valid > div:first-child::before {
    background-color: var(--md-success);
}

/* Custom widths for segment rules */
#edit-seg-rules-list grid > div:nth-child(1) {
    flex: 0 0 calc(30% - 1rem);
}

#edit-seg-rules-list grid > div:nth-child(2) {
    flex: 0 0 calc(30% - 1rem);
}

#edit-seg-rules-list grid > div:nth-child(3) {
    flex: 1 1 0%;
}

fieldset:disabled {
    opacity: 0.6;
    filter: blur(2px);
    pointer-events: none;
    transition: filter 0.3s, opacity 0.3s;
}

.section-header h2 {
    margin: 0;
    flex-grow: 1;
    text-transform: uppercase;
}

/* Page Specific Themes */

/* Listes */
.dash-nav a[href="#listes"].active { background-color: #bf82c9 !important; color: #fff !important; }
#listes h2, #liste h2 { color: #bf82c9; }

/* Segments */
.dash-nav a[href="#segments"].active { background-color: #629aa8 !important; color: #fff !important; }
#segments h2, #segment h2 { color: #629aa8; }

/* Campagnes */
.dash-nav a[href="#campagnes"].active { background-color: #f19f5a !important; color: #fff !important; }
#campagnes h2, #campagne h2 { color: #f19f5a; }

/* Gadgets */
.dash-nav a[href="#gadgets"].active { background-color: #d5e08e !important; color: #333 !important; }
#gadgets h2, #gadget h2 { color: #d5e08e; }

[data-actif="false"] em.success {
    display: none;
}

[data-actif="true"] em.warning {
    display: none;
}

/* Table Styling for all object lists */
table tbody tr {
    transition: background-color 0.2s ease;
}

table tbody tr:hover {
    background-color: var(--md-input-bg);
}

#segment-filtres, #gadget-filtres, #liste-filtres {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

#segment-filtres label, #gadget-filtres label, #liste-filtres label {
    display: inline-flex;
    align-items: center;
    margin: 0;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
}

table td strong {
    font-size: 1rem;
    transition: color 0.2s ease;
}

#table-campagnes td strong {
    font-size: 1.1rem;
}

.input-combo {
    display: flex;
    align-items: center;
    background-color: var(--md-input-bg);
    border-bottom: 1px solid var(--md-text-secondary);
    border-radius: 4px 4px 0 0;
    transition: border-bottom-color 0.2s;
    width: 280px;
    height: 48px;
    overflow: hidden;
}

.input-combo:focus-within {
    border-bottom: 2px solid var(--md-primary);
}

.input-combo select {
    margin-bottom: 0 !important;
    background-color: transparent !important;
    border-bottom: none !important;
    height: 100% !important;
    flex-grow: 1;
    padding-bottom: 0 !important;
}

.input-combo button {
    height: 100%;
    width: 44px;
    min-width: 44px;
    margin-bottom: 0;
    box-shadow: none !important;
    background: transparent !important;
    border-left: 1px solid var(--md-divider);
    border-radius: 0;
    padding: 0;
}

.input-combo button:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
}

button.tiny {
    height: 28px;
    font-size: 0.7rem;
    padding: 0 0.75rem;
    letter-spacing: 0.5px;
}

[data-theme="dark"] .input-combo button:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

td[data-all="true"] .count-box {
    display: none;
}

td[data-all="false"] .all-tag {
    display: none;
}

#table-campagnes td strong {
    font-size: 1.1rem;
    color: var(--md-text-secondary);
    transition: color 0.2s ease;
}

#table-campagnes td strong.success {
    color: var(--md-success);
}

#table-campagnes td strong.warning {
    color: var(--md-warning);
}

#table-campagnes td strong.error {
    color: var(--md-error);
}

#table-campagnes td strong.secondary {
    color: var(--md-text-secondary);
    opacity: 0.7;
}

#table-campagnes tbody tr {
    transition: background-color 0.2s ease;
}

#table-campagnes tbody tr:hover {
    background-color: var(--md-input-bg);
}

/* Empty State Styling */
.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 2rem;
    text-align: center;
    color: var(--md-text-secondary);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--md-radius);
    border: 2px dashed rgba(255, 255, 255, 0.05);
    margin-top: 1rem;
}

#list-gadgets:empty + .empty-state,
#list-segments:empty + .empty-state,
#list-listes:empty + .empty-state {
    display: flex;
}

.empty-state svg {
    opacity: 0.2;
    margin-bottom: 1.5rem;
    color: var(--md-primary);
}

.empty-state p {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
}

/* Spinner Animation */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-top: 5px solid var(--md-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Disabled Inputs styling */
input:disabled, select:disabled, textarea:disabled {
    color: var(--md-text-secondary) !important;
    opacity: 0.6;
    cursor: not-allowed;
}

section {
	width: 90%;
	margin: 0 auto;
	background: #ffffff0a;
	padding: 2rem;
    animation: sectionFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Styles pour les sélecteurs et optgroup */
select {
    background-color: var(--md-input-bg) !important;
    color: var(--md-text-primary);
    border: none;
}

[data-theme="dark"] select option {
    background-color: #1e1e1e;
    color: #e0e0e0;
}

select optgroup {
    color: var(--md-text-secondary);
    font-style: normal;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.7rem;
    padding: 0.5rem 0;
}

[data-theme="dark"] select optgroup {
    background-color: #1e1e1e;
    color: #fff; /* Texte des groupes en blanc pur pour un contraste max */
}

select option {
    text-transform: none;
    font-weight: 400;
    font-size: 1rem;
    padding: 4px;
}

@keyframes sectionFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

