/* static/css/admin_style.css */

/* --- Root Variables (Dark Theme) --- */
:root {
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --primary-color: #6baed6;
    --primary-variant-color: #3700b3;
    --secondary-color: #03dac6;
    --text-primary: rgba(255, 255, 255, 0.87);
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-disabled: rgba(255, 255, 255, 0.38);
    --error-color: #cf6679;

    --glass-bg: rgba(30, 30, 30, 0.6);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-blur: 10px;
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --border-radius-m: 12px;
    --border-radius-s: 6px;
}

/* --- Basic Reset & Body --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; background-color: var(--bg-color); color: var(--text-primary); line-height: 1.6; display: flex; flex-direction: column; min-height: 100vh; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
h1, h2, h3, h4, h5, h6 { color: var(--text-primary); margin-bottom: 1rem; font-weight: 500; }
h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
a { color: var(--secondary-color); text-decoration: none; transition: color 0.2s ease-in-out; }
a:hover, a:focus { color: var(--primary-color); text-decoration: underline; outline: 2px solid transparent; outline-offset: 2px; }
img { max-width: 100%; height: auto; display: block; vertical-align: middle; }
code { background-color: rgba(255, 255, 255, 0.1); padding: 0.2em 0.4em; border-radius: var(--border-radius-s); font-size: 0.9em; font-family: "SF Mono", "Consolas", "Menlo", monospace; }
time { color: var(--text-secondary); }

/* --- Layout Containers --- */
.container { width: 95%; max-width: 1200px; margin-left: auto; margin-right: auto; padding-left: 15px; padding-right: 15px; }

/* --- Navbar --- */
.navbar { background: rgba(18, 18, 18, 0.7); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur)); border-bottom: 1px solid var(--glass-border); padding: 0.8rem 0; position: sticky; top: 0; z-index: 1030; }
.navbar .container { display: flex; justify-content: space-between; align-items: center; }
.navbar-brand { font-size: 1.5rem; font-weight: 600; color: var(--text-primary); text-decoration: none; }
.navbar-brand:hover { color: #fff; text-decoration: none; }
.navbar-nav { list-style: none; display: flex; gap: 1.5rem; align-items: center; }
.navbar-nav a { color: var(--text-secondary); font-weight: 500; font-size: 1rem; padding: 0.5rem 0; border-bottom: 2px solid transparent; transition: color 0.2s ease, border-color 0.2s ease; }
.navbar-nav a:hover, .navbar-nav a:focus, .navbar-nav a.active { color: var(--text-primary); border-bottom-color: var(--primary-color); text-decoration: none; }

/* --- Main Content & Footer --- */
.content-area { flex-grow: 1; padding-top: 2rem; padding-bottom: 3rem; }
.footer { text-align: center; padding: 1.5rem 0; margin-top: auto; font-size: 0.9em; color: var(--text-secondary); border-top: 1px solid var(--glass-border); background-color: var(--surface-color); }

/* --- Page Headers --- */
.page-header, .dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; }

/* --- Glassmorphism Card Effect --- */
.card { border-radius: var(--border-radius-m); padding: 1.5rem 2rem; margin-bottom: 1.5rem; border: 1px solid transparent; }
.card.glassmorphic { background: var(--glass-bg); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur)); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow); }

/* --- Forms --- */
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: var(--text-secondary); }
.form-control { display: block; width: 100%; padding: 0.8rem 1rem; font-size: 1rem; font-weight: 400; line-height: 1.5; color: var(--text-primary); background-color: rgba(255, 255, 255, 0.08); background-clip: padding-box; border: 1px solid var(--glass-border); appearance: none; border-radius: var(--border-radius-s); transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; }
.form-control:focus { color: var(--text-primary); background-color: rgba(255, 255, 255, 0.1); border-color: var(--primary-color); outline: 0; box-shadow: 0 0 0 0.25rem rgba(var(--primary-variant-color), 0.5); }
.form-control::placeholder { color: var(--text-disabled); opacity: 1; }
.form-control:disabled, .form-control[readonly] { background-color: rgba(255, 255, 255, 0.05); opacity: 0.7; }
textarea.form-control { min-height: calc(1.5em + 1.6rem + 2px); resize: vertical; }
.form-control.is-invalid { border-color: var(--error-color); padding-right: calc(1.5em + 1.6rem); background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23cf6679'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23cf6679' stroke='none'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 0.8rem center; background-size: 1em 1em; }
.form-control.is-invalid:focus { border-color: var(--error-color); box-shadow: 0 0 0 0.25rem rgba(207, 102, 121, 0.5); }
.invalid-feedback { display: block; width: 100%; margin-top: 0.25rem; font-size: 0.875em; color: var(--error-color); }
.form-group { margin-bottom: 1.5rem; }
.form-text { font-size: 0.875em; color: var(--text-secondary); margin-top: 0.25rem; display: block; }
fieldset { border: none; padding: 0; margin: 0; margin-bottom: 1.5rem; }
legend { font-size: 1.25rem; font-weight: 500; margin-bottom: 1rem; padding: 0; float: left; width: 100%; }
.form-actions { margin-top: 1rem; display: flex; gap: 1rem; align-items: center; justify-content: flex-end; }

/* --- Buttons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.7rem 1.5rem; font-size: 1rem; font-weight: 500; line-height: 1.5; text-align: center; text-decoration: none; vertical-align: middle; cursor: pointer; user-select: none; border: 1px solid transparent; border-radius: var(--border-radius-s); transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; }
.btn:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }
.btn:active { transform: scale(0.98); }
.btn > svg { width: 1em; height: 1em; vertical-align: text-bottom; }
.btn-primary { color: #000; background-color: var(--primary-color); border-color: var(--primary-color); }
.btn-primary:hover, .btn-primary:focus { color: #000; background-color: #9ecae1; border-color: #6baed6; box-shadow: 0 4px 15px rgba(134, 224, 252, 0.3); }
.btn-secondary { color: var(--text-primary); background-color: rgba(255, 255, 255, 0.1); border-color: var(--glass-border); }
.btn-secondary:hover, .btn-secondary:focus { color: #fff; background-color: rgba(255, 255, 255, 0.15); border-color: rgba(255, 255, 255, 0.25); }
.btn-danger { color: #fff; background-color: var(--error-color); border-color: var(--error-color); }
.btn-danger:hover, .btn-danger:focus { color: #fff; background-color: #b0495a; border-color: #b0495a; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.875rem; border-radius: var(--border-radius-s); gap: 0.3rem; }
.btn-sm > svg { width: 0.9em; height: 0.9em; }
.btn-link { background: none; border: none; color: var(--secondary-color); padding: 0; text-decoration: underline; } /* Added btn-link style */
.btn-link:hover, .btn-link:focus { color: var(--primary-color); }

/* --- Widget Card List Layout (Dashboard & Analytics) --- */
.widget-card-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
    gap: 1.75rem;
    margin-top: 2rem; /* Added margin */
}

/* Standard Widget Card (e.g., for admin dashboard list) */
.widget-card {
    /* Inherits .card .glassmorphic */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1.5rem; /* Consistent padding */
}

/* Specific styles for clickable Analytics cards */
.analytics-widget-card {
    /* Inherits .card .glassmorphic */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1.5rem;
    cursor: pointer; /* Indicate clickability */
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}
.analytics-widget-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
}

/* Shared Header for both card types */
.widget-card-header,
.analytics-widget-card .card-header /* Use card-header inside analytics card */
{
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem; /* Adjusted margin */
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
    gap: 1rem;
}

.widget-card-header .widget-name,
.analytics-widget-card .card-header .widget-name
{
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-primary);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-card-header .creation-date,
.analytics-widget-card .card-header .creation-date
{
    font-size: 0.8em;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Card Body (Admin Dashboard List Card) */
.widget-card-body {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: flex-start;
}

.ad-preview-card { display: block; width: 60px; height: 60px; object-fit: cover; border-radius: var(--border-radius-s); background-color: rgba(255, 255, 255, 0.05); flex-shrink: 0; }
.ad-preview-placeholder { display: flex; align-items: center; justify-content: center; width: 60px; height: 60px; font-size: 0.75em; color: var(--text-disabled); background-color: rgba(255, 255, 255, 0.05); border-radius: var(--border-radius-s); flex-shrink: 0; text-align: center; }

.description-container { flex-grow: 1; display: flex; gap: 0.5rem; align-items: flex-start; min-height: 60px; }
.description-text { flex-grow: 1; margin: 0; font-size: 0.9em; line-height: 1.5; color: var(--text-secondary); }
.description-text.text-muted { color: var(--text-disabled); font-style: italic; }
.description-edit-button { flex-shrink: 0; padding: 0.2rem 0.3rem; line-height: 1; opacity: 0.6; transition: opacity 0.2s ease; border-radius: 50%; background-color: rgba(255, 255, 255, 0.08); border: none; color: var(--text-secondary); margin-top: 2px; }
.description-edit-button:hover { opacity: 1; background-color: rgba(255, 255, 255, 0.15); color: var(--text-primary); }
.description-edit-button svg { width: 0.9em; height: 0.9em; vertical-align: middle; }

/* Card Footer (Admin Dashboard List Card) */
.widget-card-footer { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--glass-border); display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.widget-id-display { font-size: 0.75em; color: var(--text-disabled); word-break: break-all; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.widget-card-actions { display: flex; flex-wrap: nowrap; gap: 0.5rem; justify-content: flex-end; padding: 0; border: none; margin: 0; margin-top: 10px; }
.widget-card-actions form { margin: 0; }
.widget-card-actions .btn { white-space: nowrap; }

/* Card Body (Analytics Clickable Card) */
.analytics-widget-card .card-body {
    padding-top: 1rem; /* Add some space after header */
}

.analytics-stat {
    text-align: center;
    margin-bottom: 1rem; /* Space between stats */
}

.analytics-stat .stat-value {
    font-size: 1.75rem; /* Make numbers prominent */
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.analytics-stat .stat-label {
    font-size: 0.85em;
    color: var(--text-secondary);
}

/* --- Flash Messages --- */
.flash-messages { margin-bottom: 1.5rem; }
.alert { padding: 1rem 1.5rem; margin-bottom: 1rem; border: 1px solid transparent; border-radius: var(--border-radius-s); position: relative; }
.alert-success { color: #d1e7dd; background-color: rgba(30, 87, 51, 0.5); border-color: rgba(60, 118, 84, 0.5); }
.alert-error { color: #f8d7da; background-color: rgba(114, 35, 45, 0.5); border-color: rgba(132, 53, 65, 0.5); }
.alert-warning { color: #fff3cd; background-color: rgba(102, 77, 12, 0.5); border-color: rgba(128, 98, 22, 0.5); }
.alert-info { color: #cff4fc; background-color: rgba(11, 67, 84, 0.5); border-color: rgba(19, 86, 107, 0.5); }
.embed-code-display textarea, .alert-info textarea { width: 100%; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--glass-border); color: var(--text-primary); padding: 0.75rem; margin-top: 0.5rem; border-radius: var(--border-radius-s); font-family: "SF Mono", "Consolas", "Menlo", monospace; box-sizing: border-box; resize: vertical; min-height: 100px; }
.embed-code-display small, .alert-info small { display: block; margin-top: 0.5rem; color: var(--text-secondary); }

/* --- Edit Page Layout --- */
.grid-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 2rem; }
.form-column { }
.preview-column { }
.widget-preview h3 { margin-bottom: 1rem; }
.widget-preview .preview-box { display: inline-block; border: 1px dashed var(--text-disabled); margin-bottom: 1rem; overflow: hidden; line-height: 0; }
.widget-preview iframe { display: block; }

/* --- Modal Styles --- */
.modal { position: fixed; z-index: 1050; left: 0; top: 0; width: 100%; height: 100%; overflow-y: auto; /* Allow scrolling */ background-color: rgba(0,0,0,0.8); /* Darker overlay */ display: none; align-items: flex-start; /* Align top */ justify-content: center; padding-top: 5vh; /* Space from top */ animation: fadeIn 0.3s ease-out; }
.modal-content { background: var(--surface-color); color: var(--text-primary); margin: auto; padding: 1.5rem 2rem; /* Adjusted padding */ border: 1px solid var(--glass-border); width: 90%; max-width: 900px; /* Wider modal for charts */ border-radius: var(--border-radius-m); box-shadow: var(--glass-shadow); position: relative; background: var(--glass-bg); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur)); margin-bottom: 5vh; /* Space at bottom */ }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--glass-border); padding-bottom: 1rem; margin-bottom: 1.5rem; }
.modal-header h3 { margin: 0; color: var(--text-primary); font-weight: 600; font-size: 1.4rem; }
.modal-widget-id { font-size: 0.8em; color: var(--text-secondary); margin-left: 1rem; } /* Style for ID in modal header */
.close-button { color: var(--text-secondary); font-size: 1.8rem; font-weight: bold; line-height: 1; cursor: pointer; transition: color 0.2s ease; background: none; border: none; padding: 0; }
.close-button:hover, .close-button:focus { color: var(--text-primary); text-decoration: none; outline: none; }

/* Modal specific styles */
#description-modal .form-control { background-color: rgba(255, 255, 255, 0.1); }
#description-modal label { color: var(--text-secondary); }
.modal-body { /* Container for modal content */ }
.modal-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.modal-chart-container { height: 250px; /* Fixed height for charts */ margin-bottom: 2rem; }
.modal-referrer-table .table { margin-bottom: 0; } /* Remove extra margin */
.modal-referrer-table th { font-size: 0.9em; color: var(--text-secondary); }
.modal-referrer-table td { font-size: 0.9em; }
.modal-no-data { color: var(--text-disabled); font-style: italic; margin-top: 1rem; }

/* Iframe styles in modals */
.iframe-container { border: 1px dashed var(--glass-border); margin-bottom: 1rem; background: rgba(0,0,0,0.1); line-height: 0; overflow: hidden; border-radius: var(--border-radius-s); }
.iframe-code { margin-top: 1rem; }
.iframe-code h4 { font-size: 1rem; margin-bottom: 0.5rem; color: var(--text-secondary); font-weight: 500; }
.iframe-code button { margin-top: 0.5rem; }
.iframe-code small { display: block; margin-top: 0.75rem; color: var(--text-disabled); font-size: 0.85em;}

.iframe-code {
    margin-top: 1.5rem;
}

.iframe-code h4 {
    margin-bottom: 0.75rem;
}

.iframe-code textarea {
    display: block;
    width: 100%;
    margin-bottom: 1rem;
}

.iframe-code button {
    display: block;
    width: 100%;
    margin: 0.5rem auto 1rem;
}

.iframe-code small {
    display: block;
    text-align: center;
}

/* --- Bootstrap Overrides / Compatibility (if using BS classes) --- */
.row { --bs-gutter-x: 1.5rem; --bs-gutter-y: 0; display: flex; flex-wrap: wrap; margin-top: calc(-1 * var(--bs-gutter-y)); margin-right: calc(-.5 * var(--bs-gutter-x)); margin-left: calc(-.5 * var(--bs-gutter-x)); }
.row > * { flex-shrink: 0; width: 100%; max-width: 100%; padding-right: calc(var(--bs-gutter-x) * .5); padding-left: calc(var(--bs-gutter-x) * .5); margin-top: var(--bs-gutter-y); }
.col-md-4 { flex: 0 0 auto; width: 33.33333333%; }
.g-3 { --bs-gutter-x: 1rem; --bs-gutter-y: 1rem;} /* Example gutter */
.align-items-end { align-items: flex-end; }
.w-100 { width: 100%; }
.mt-4 { margin-top: 1.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.table { width: 100%; margin-bottom: 1rem; color: var(--text-primary); vertical-align: top; border-color: var(--glass-border); background-color: transparent; }
.table > :not(caption) > * > * { padding: .75rem .75rem; background-color: transparent; border-bottom-width: 1px; box-shadow: inset 0 0 0 9999px transparent; }
.table > tbody { vertical-align: inherit; }
.table > thead { vertical-align: bottom; }
.table thead th { color: var(--text-secondary); border-bottom-width: 2px; }
.table-striped > tbody > tr:nth-of-type(odd) > * { background-color: rgba(255, 255, 255, 0.04); }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.badge { display: inline-block; padding: .35em .65em; font-size: .75em; font-weight: 700; line-height: 1; color: #000; text-align: center; white-space: nowrap; vertical-align: baseline; border-radius: .375rem; }
.bg-primary { background-color: var(--primary-color); }
.display-5 { font-size: calc(1.425rem + 2.1vw); font-weight: 300; line-height: 1.2; }
@media (min-width: 1200px) { .display-5 { font-size: 3rem; } }
.fw-bold { font-weight: 700; }
.form-select { display: block; width: 100%; padding: .8rem 2.25rem .8rem 1rem; font-size: 1rem; font-weight: 400; line-height: 1.5; color: var(--text-primary); background-color: rgba(255, 255, 255, 0.08); background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236baed6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 1rem center; background-size: 16px 12px; border: 1px solid var(--glass-border); border-radius: .375rem; appearance: none; }
.form-select:focus { border-color: var(--primary-color); outline: 0; box-shadow: 0 0 0 0.25rem rgba(var(--primary-variant-color), 0.5); }


/* --- Utility Classes --- */
.text-center { text-align: center; }
.text-muted { color: var(--text-disabled) !important; } /* Ensure override if needed */

.alert-info pre {
    white-space: pre-wrap;       /* CSS3 */
    word-wrap: break-word;       /* IE */
    overflow-wrap: break-word;
    overflow-x: auto;
    max-width: 100%;
    margin: 0.5rem 0;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-s);
    padding: 0.75rem;
}

.alert-info code {
    display: block;
    background: transparent;
    color: var(--text-primary);
    padding: 0;
    font-family: "SF Mono", "Consolas", "Menlo", monospace;
    font-size: 0.9em;
    white-space: pre-wrap;
    word-break: break-all;
}

.width-indicator {
    text-align: right;
    font-size: 0.8em;
    margin-bottom: 10px;
    margin-right: 15px;
    color: var(--text-secondary);
    font-family: "SF Mono", "Consolas", "Menlo", monospace;
}

.width-indicator span {
    color: var(--primary-color);
    font-weight: 500;
}

/* YouTube thumbnail preview styling */
.youtube-preview-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.youtube-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.youtube-preview-container:hover .youtube-play-overlay {
    opacity: 1;
}

/* Optional: Add a slight darkening effect on hover */
.youtube-preview-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.1);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.youtube-preview-container:hover::after {
    opacity: 1;
}

/* Community Member styling */
.widget-metadata {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.assigned-member {
    font-size: 0.85em;
    color: var(--primary-color);
    background-color: rgba(187, 134, 252, 0.1);
    padding: 0.1rem 0.5rem;
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

/* Fix for dropdown menu text color */
.form-select option {
    background-color: var(--surface-color);
    color: var(--text-primary);
}

/* Additional rule for Firefox which handles selects differently */
@-moz-document url-prefix() {
    .form-select {
        color: var(--text-primary);
        background-color: var(--surface-color);
    }
    
    .form-select option {
        background-color: var(--surface-color);
        color: var(--text-primary);
    }
}

/* For Webkit browsers (Chrome, Safari) */
select.form-select:focus option:checked,
select.form-select option:hover {
    background: var(--primary-color);
    color: #000;
}

/* Styles for the geo map modal */
.large-modal {
    width: 90%;
    max-width: 1200px;
}

.country-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.country-bar-container {
    display: flex;
    align-items: center;
}

.country-name {
    width: 120px;
    text-align: right;
    padding-right: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.85em;
}

.country-bar-wrapper {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    height: 24px;
    position: relative;
}

.country-bar {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding-left: 8px;
    min-width: 30px;
    max-width: 100%;
    position: relative;
    color: #000;
    font-weight: 500;
    font-size: 0.8em;
}

.country-count {
    position: relative;
    z-index: 2;
}

/* Make the map markers consistent with dark theme */
.leaflet-popup-content-wrapper {
    background: var(--surface-color);
    color: var(--text-primary);
}

.leaflet-popup-tip {
    background: var(--surface-color);
}

/* Add these styles to the end of your admin_style.css file */

/* --- Mobile Menu Toggle Button (Hamburger/X) --- */
.navbar-toggler {
    display: none; /* Hidden by default on desktop */
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    background-color: transparent;
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-s);
    cursor: pointer;
    transition: box-shadow 0.15s ease-in-out;
    position: relative; /* Context for absolutely positioned icons */
    width: 38px;       /* Explicit dimensions for precision */
    height: 32px;
    box-sizing: border-box;
    overflow: hidden; /* Clip elements during animation */
}

.navbar-toggler:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(107, 174, 214, 0.5); /* Primary color focus */
}

/* Common styles for the icon bars */
.toggler-icon {
    display: block;
    position: absolute;
    height: 2px; /* Consistent thickness */
    width: 22px; /* Consistent length */
    background: var(--text-primary);
    border-radius: 1px;
    opacity: 1;
    left: 50%; /* Horizontal centering step 1 */
    transform: translateX(-50%); /* Horizontal centering step 2 */
    transform-origin: center; /* Rotation point */
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55), /* Animation transitions */
                opacity 0.3s ease-in-out,
                top 0.3s ease-in-out;
}

/* Initial vertical positions for the bars (Hamburger state) */
.toggler-icon.top-bar {
    top: 9px; /* Calculated position */
    transform: translateX(-50%) rotate(0deg); /* Center + Initial rotation */
}
.toggler-icon.middle-bar {
    top: 15px; /* Calculated position */
    transform: translateX(-50%); /* Center */
}
.toggler-icon.bottom-bar {
    top: 21px; /* Calculated position */
    transform: translateX(-50%) rotate(0deg); /* Center + Initial rotation */
}

/* --- Animation to 'X' when .is-active class is present --- */
.navbar-toggler.is-active .toggler-icon.top-bar {
    top: 15px; /* Move to vertical center */
    transform: translateX(-50%) rotate(45deg); /* Center and rotate */
}
.navbar-toggler.is-active .toggler-icon.middle-bar {
    opacity: 0; /* Fade out */
    transform: translateX(-50%) scale(0.1); /* Center and shrink (optional) */
}
.navbar-toggler.is-active .toggler-icon.bottom-bar {
    top: 15px; /* Move to vertical center */
    transform: translateX(-50%) rotate(-45deg); /* Center and rotate opposite */
}

/* --- Media Query for Mobile --- */
/* Adjust 768px breakpoint as needed */
@media (max-width: 1100px) {
    .navbar .container {
        /* Ensure container allows wrapping if needed, although toggler should prevent it */
        flex-wrap: nowrap;
    }

    .navbar-brand { font-size: .9rem; font-weight: 600; color: var(--text-primary); text-decoration: none; }

    /* Show the toggler button on mobile */
    .navbar-toggler {
        display: block;
    }

    /* Hide the collapsible content by default on mobile */
    .navbar-collapse {
        display: none; /* Hide initially */
        flex-basis: 100%; /* Take full width when shown */
        flex-grow: 1;
        align-items: center;
        /* Style the collapsed menu container */
        position: absolute; /* Position it absolutely relative to navbar */
        top: 100%; /* Place it right below the navbar */
        left: 0;
        right: 0;
        background: rgba(9, 9, 9, 1); /* Made slightly more transparent */
        border-top: 1px solid var(--glass-border);
        padding: 0; /* Remove padding initially for collapse effect */
        max-height: 0; /* Start collapsed */
        overflow: hidden; /* Hide content when collapsed */
        transition: max-height 0.35s ease-out, padding 0.35s ease-out; /* Smooth transition */
        z-index: 1020; /* Ensure it's above content below */
        box-shadow: 0 8px 16px rgba(0,0,0,0.3); /* Add shadow */
        transition: max-height 0.35s ease-out, padding 0.35s ease-out; /* Make sure transition is defined */
    }


    /* Styles for when the menu is active (shown) */
    .navbar-collapse.is-active {
        display: block; /* Change display to block */
        max-height: 70vh; /* Set a max-height for the open menu */
        padding: 1rem 1.5rem; /* Add padding back when open */
        overflow-y: auto; /* Allow scrolling if content is too long */
        backdrop-filter: blur(8px); /* Apply blur ONLY when active */
        -webkit-backdrop-filter: blur(8px); /* Apply blur ONLY when active */
    }

    /* Stack nav items vertically */
    .navbar-nav {
        flex-direction: column;
        width: 100%; /* Make nav lists take full width */
        gap: 0.25rem; /* Reduce gap for vertical layout */
    }

    .navbar-nav li {
        width: 100%;
    }

    /* Style individual nav links for mobile */
    .navbar-nav a {
        display: block; /* Make links take full width */
        padding: 0.75rem 1rem; /* Adjust padding for touch targets */
        border-bottom: none; /* Remove desktop border */
        border-radius: var(--border-radius-s);
        transition: background-color 0.2s ease;
    }
    .navbar-nav a:hover,
    .navbar-nav a:focus {
        background-color: rgba(255, 255, 255, 0.1); /* Subtle hover effect */
        border-bottom: none;
        text-decoration: none;
    }

    /* Adjust the right-aligned section (login/logout) */
    .navbar .container {
        flex-wrap: nowrap; /* Prevent wrapping brand and toggle */
        align-items: center; /* Vertically align items */
    }

    /* Ensure welcome message looks okay */
    .navbar-nav .nav-link:not(a) { /* Target the span */
         padding: 0.75rem 1rem;
         display: block;
         color: var(--text-secondary);
    }

    /* --- Widget Card Adjustments for Mobile --- */
    .widget-card-header .widget-name,
    .analytics-widget-card .card-header .widget-name {
        font-size: 1.0rem; /* Slightly smaller font on mobile */
        /* Optionally allow wrapping if needed, but ellipsis might still be okay */
        /* white-space: normal; */
    }

    /* Optional: Adjust card padding or gaps if needed */
    .widget-card, .analytics-widget-card {
        padding: 1rem; /* Reduce padding slightly */
    }
    .widget-card-list {
         grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Ensure narrowest min width */
         gap: 1rem;
    }
}
