/* smrt-survey/assets/css/dashboard.css */

:root {
	--smrt-primary: #0f52ba;           /* Modern Blue */
	--smrt-primary-hover: #0a3d8c;     
    --smrt-accent-1: #3b82f6;          
    --smrt-accent-2: #10b981;          
    --smrt-accent-3: #f59e0b;          
    --smrt-accent-4: #14b8a6;          
	--smrt-text: #1f2937;              /* Slate 800 */
	--smrt-text-light: #6b7280;        /* Gray 500 */
	--smrt-bg: #ffffff;
	--smrt-surface: #f3f4f6;           /* Gray 100 backdrop */
	--smrt-border: #e5e7eb;            /* Gray 200 */
	--smrt-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0,0,0,0.02); /* Extremely soft ambient shadow */
    --smrt-shadow-hover: 0 20px 40px -10px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
	--smrt-danger-hover: #ef4444;
	--smrt-radius: 20px; /* Highly rounded SaaS look */
	--smrt-font: 'Inter', 'CabinetGrotesk', system-ui, sans-serif;
}

.smrt-dashboard-container {
	font-family: var(--smrt-font);
	color: var(--smrt-text);
    background: transparent; /* Let Native WP or Surface show */
	padding: 20px 0; /* Remove horizontal padding so the grid sits flush */
    margin: 30px 0;
	box-sizing: border-box;
    position: relative;
    max-width: 1200px;
}

.smrt-dashboard-container * {
	box-sizing: border-box;
}

/* Topbar Filters & Export */
.smrt-dashboard-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--smrt-bg);
    padding: 20px 25px;
    border-radius: var(--smrt-radius);
    margin-bottom: 25px;
    box-shadow: var(--smrt-shadow);
    border: 1px solid rgba(0,0,0,0.03);
    flex-wrap: wrap;
    gap: 15px;
}

.smrt-dashboard-filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.smrt-dashboard-filter {
    display: flex;
    flex-direction: column;
}

.smrt-dashboard-filter label {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--smrt-text-light);
    margin-bottom: 5px;
    text-transform: uppercase;
}

.smrt-dashboard-select {
    padding: 8px 30px 8px 12px;
    border: 1px solid var(--smrt-border);
    border-radius: 4px;
    background-color: var(--smrt-bg);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--smrt-text);
    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%23333333%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: 10px auto;
    cursor: pointer;
    min-width: 140px;
    height: 42px; /* Setzt alle Native-Dropdowns exakt auf 42px */
    box-sizing: border-box;
}

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

/* Select2 overrides */
.select2-container {
    font-family: inherit !important;
    font-size: 0.95rem !important; /* Gleicht Schriftgröße Native WP vs Select2 an */
    color: var(--smrt-text) !important;
    box-sizing: border-box !important;
    text-align: left !important; /* Unterbindet zentrierte Vererbung vom Topbar */
}
.select2-container--default .select2-selection--multiple {
    box-sizing: border-box !important;
    border: 1px solid var(--smrt-border) !important;
    border-radius: 4px !important;
    min-height: 42px !important; /* Gleicht Höhe mit Native Dropdowns und Buttons ab */
    background-color: var(--smrt-bg) !important;
    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%23333333%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") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px top 50% !important;
    background-size: 10px auto !important;
    padding: 0 30px 0 12px !important; /* 12px links exakt wie bei nativem Select */
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
}
.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--smrt-primary) !important;
    box-shadow: 0 0 0 2px rgba(0,72,153,0.1) !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    box-sizing: border-box !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #f1f3f5 !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 4px !important;
    padding: 2px 8px !important;
    margin: 2px 4px 2px 0 !important;
    color: var(--smrt-text) !important; /* Standard Text-Farbe für die Tags */
    font-weight: 500 !important;
    display: flex !important;
    flex-direction: row-reverse !important; /* Das "x" nach rechts schieben */
    align-items: center !important;
    float: none !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    border: none !important;
    background: transparent !important;
    color: #999 !important;
    font-size: 1.2rem !important;
    margin-left: 6px !important;
    margin-right: -2px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    position: static !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    background: transparent !important;
    color: #d32f2f !important; /* Rote Farbe beim Hovern über das Limitierungs-x */
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__display {
    padding: 0 !important;
    margin: 0 !important;
}
.select2-container--default .select2-search--inline {
    margin: 0 !important;
    float: none !important;
}
.select2-container--default .select2-search--inline .select2-search__field {
    font-family: inherit !important; 
    color: var(--smrt-text) !important; 
    text-align: left !important;
    margin: 0 !important;
    height: 24px !important;
    line-height: 24px !important;
}
.select2-container--default .select2-search--inline .select2-search__field::placeholder {
    color: var(--smrt-text) !important;
    opacity: 1 !important; /* Dummytext exakt gleich wie bei normalen Selects */
}

.smrt-dashboard-btn {
	background-color: var(--smrt-primary);
	color: #fff;
	border: none;
	border-radius: 8px; /* Slightly sharper buttons for contrast */
	padding: 10px 24px;
	font-size: 0.95rem;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    line-height: 1;
    margin: 0 !important; /* Block WP theme overrides */
    height: 42px; /* Force exact height everywhere */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.smrt-dashboard-btn:hover {
	background-color: var(--smrt-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 82, 186, 0.2);
}

/* Summary Cards Grid */
.smrt-dashboard-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.smrt-summary-card {
    background: var(--smrt-bg);
    padding: 35px 25px;
    border-radius: var(--smrt-radius);
    box-shadow: var(--smrt-shadow);
    border: 1px solid rgba(0,0,0,0.03);
    text-align: center;
    border-left: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

.smrt-summary-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: var(--smrt-shadow-hover);
}

.smrt-summary-card h4 {
    margin: 0 0 15px 0;
    font-size: 1.15rem;
    color: var(--smrt-text);
    font-weight: 600;
}

.smrt-summary-value {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--smrt-primary);
    line-height: 1;
}

/* Chart Grid / Bento Box */
.smrt-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 20px;
}

.smrt-dashboard-card {
    background: var(--smrt-bg);
    padding: 30px;
    border-radius: var(--smrt-radius);
    box-shadow: var(--smrt-shadow);
    border: 1px solid rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

.smrt-dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--smrt-shadow-hover);
}

.smrt-dashboard-card.full-width {
    grid-column: 1 / -1;
}

.smrt-dashboard-card h3 {
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 1.35rem;
    color: var(--smrt-text);
    border-bottom: 2px solid var(--smrt-surface);
    padding-bottom: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.smrt-dashboard-hint {
    font-size: 0.85rem;
    color: var(--smrt-text-light);
    margin-top: -10px;
    margin-bottom: 15px;
}

.smrt-chart-container {
    position: relative;
    height: 380px;
    width: 100%;
    flex: 1;
}

/* Priority Score Ranking Bars */
.smrt-priority-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}
.smrt-priority-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: inherit;
    font-size: 0.85rem;
}
.smrt-priority-bar-label {
    width: 20px;
    color: var(--smrt-text-light);
    text-align: right;
    font-weight: 500;
}
.smrt-priority-bar-track {
    flex: 1;
    background-color: var(--smrt-surface-hover, #f0f4f8);
    border-radius: 4px;
    height: 34px;
    overflow: hidden;
    position: relative;
}
.smrt-priority-bar-fill {
    background-color: var(--smrt-primary);
    height: 100%;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    white-space: nowrap;
    transition: width 0.5s ease-out;
}
.smrt-priority-bar-text {
    color: #fff;
    font-weight: 500;
}
.smrt-priority-bar-score {
    width: 45px;
    text-align: right;
    font-weight: 600;
    color: var(--smrt-primary);
}
.smrt-priority-bar-score small {
    font-weight: normal;
    color: var(--smrt-text-light);
    font-size: 0.8em;
}

/* Loader */
.smrt-dashboard-loader {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(247,249,250,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--smrt-radius);
}

.smrt-dashboard-spinner {
    border: 4px solid var(--smrt-border);
    border-top: 4px solid var(--smrt-primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: dash-spin 1s linear infinite;
}

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

/* Data Table */
.smrt-data-management-section {
    font-size: 0.95rem;
}

.smrt-data-table th, .smrt-data-table td {
    border-bottom: 1px solid var(--smrt-border);
    padding: 12px 15px;
    vertical-align: middle;
}

.smrt-data-table tbody tr {
    transition: background-color 0.2s;
}

.smrt-data-table tbody tr:hover {
    background-color: var(--smrt-surface);
}

.smrt-delete-btn {
    background: transparent;
    border: none;
    color: var(--smrt-text-light);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.smrt-delete-btn:hover {
    color: #d32f2f;
    background-color: rgba(211, 47, 47, 0.1);
}

.smrt-page-btn {
    background-color: transparent;
    border: 1px solid var(--smrt-border);
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    color: var(--smrt-text);
    transition: background-color 0.2s;
}

.smrt-page-btn:hover:not(:disabled) {
    background-color: var(--smrt-surface);
}

.smrt-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .smrt-dashboard-topbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .smrt-dashboard-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .smrt-dashboard-select {
        width: 100%;
    }
    
    .smrt-dashboard-export {
        margin-top: 10px;
        text-align: center;
    }
    
    .smrt-dashboard-btn {
        width: 100%;
    }
    
    .smrt-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .smrt-chart-container {
        height: 300px;
    }
}
