@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@400;500;600;700&family=Roboto:wght@300;400;500;700&display=swap');

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
    font-family: 'Roboto', sans-serif;
    background: #f0f2f5;
    color: #374146;
    line-height: 1.6;
    min-height: 100vh;
}
h1, h2, h3, h4, h5 { font-family: 'Raleway', sans-serif; font-weight: 600; color: #0d1d31; }
a { color: #2B6CB0; text-decoration: none; }
a:hover { color: #1E4D7B; }
img { max-width: 100%; }

/* ===== LAYOUT ===== */
.admin-wrapper { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: 220px;
    background: linear-gradient(180deg, #0d1d31, #1E4D7B);
    color: #fff;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    transition: width 0.3s ease;
}
/* Collapsed sidebar: icons only */
.sidebar-collapsed .sidebar { width: 56px; }
.sidebar-collapsed .main-content { margin-left: 56px; }
.sidebar-collapsed .sidebar-header { padding: 14px 8px; }
.sidebar-collapsed .sidebar-bubble { display: none; }
.sidebar-collapsed .sidebar-nav { padding: 8px 0; }
.sidebar-collapsed .sidebar-nav .nav-section { font-size: 0; padding: 3px 0; margin-top: 4px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-collapsed .sidebar-nav a {
    justify-content: center;
    padding: 10px 0;
    border-left: 3px solid transparent;
    font-size: 0;
}
.sidebar-collapsed .sidebar-nav a span,
.sidebar-collapsed .sidebar-nav .nav-badge { display: none; }
.sidebar-collapsed .sidebar-nav a i { margin-right: 0; font-size: 1.05rem; }
/* Sidebar tooltip (JS-generated, appended to body) */
.sidebar-tooltip {
    position: fixed;
    background: #1a1a2e;
    color: #fff;
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 0.78rem;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10000;
    box-shadow: 0 3px 10px rgba(0,0,0,0.4);
    opacity: 0;
    transition: opacity 0.15s;
}
.sidebar-tooltip.show { opacity: 1; }
.sidebar-header {
    padding: 18px 14px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: relative;
    overflow: hidden;
}
.sidebar-header h2 {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
}
.sidebar-header small { color: rgba(255,255,255,0.6); font-size: 0.8rem; }
.sidebar-mini-logo {
    display: none;
    font-size: 1.2rem;
    font-weight: 800;
    color: #eda922;
    letter-spacing: 1px;
}
.sidebar-collapsed .sidebar-mini-logo { display: block; }
.sidebar-collapsed .sidebar-header h2,
.sidebar-collapsed .sidebar-header small { display: none; }

/* Decorative bubbles */
.sidebar-bubble {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(237,169,34,0.3);
    pointer-events: none;
}
.sidebar-bubble.b1 { width: 60px; height: 60px; top: -10px; right: -15px; }
.sidebar-bubble.b2 { width: 40px; height: 40px; bottom: -5px; left: -10px; }
.sidebar-bubble.b3 { width: 25px; height: 25px; top: 15px; left: 10px; border-color: rgba(237,169,34,0.15); }

.sidebar-nav { padding: 15px 0; }
.sidebar-nav .nav-section {
    padding: 6px 16px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.4);
    margin-top: 10px;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 9px 16px;
    color: rgba(255,255,255,0.8);
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-size: 0.84rem;
}
.sidebar-nav a:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border-left-color: #eda922;
}
.sidebar-nav a.active {
    background: rgba(237,169,34,0.12);
    color: #eda922;
    border-left-color: #eda922;
}
.sidebar-nav a i { width: 20px; margin-right: 10px; text-align: center; font-size: 0.9rem; }
.sidebar-nav .nav-badge {
    margin-left: auto;
    background: #eda922;
    color: #0d1d31;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 22px;
    text-align: center;
}

/* ===== TOPBAR ===== */
.main-content { margin-left: 220px; flex: 1; min-height: 100vh; display: flex; flex-direction: column; transition: margin-left 0.3s ease; }
.topbar {
    background: linear-gradient(135deg, #1a5276, #2980b9, #3498db);
    color: #fff;
    padding: 0 30px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 15px; }
.topbar-left h1 { font-size: 1.2rem; color: #fff; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 20px; }
.topbar-right a { color: rgba(255,255,255,0.9); }
.topbar-right a:hover { color: #eda922; }
.topbar-user { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.topbar-user i { font-size: 1.2rem; }
.btn-hamburger {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
}
.btn-sidebar-toggle {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.3s;
}
.btn-sidebar-toggle:hover { background: rgba(255,255,255,0.25); }
.sidebar-collapsed .btn-sidebar-toggle i { transform: rotate(180deg); }

/* ===== CONTENT AREA ===== */
.content-area { padding: 30px; flex: 1; }

/* ===== CARDS ===== */
.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
    margin-bottom: 25px;
    overflow: hidden;
}
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid #edf0f2;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h3 { font-size: 1.05rem; }
.card-body { padding: 24px; }

/* ===== STAT CARDS (Dashboard) ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-icon {
    width: 56px; height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
}
.stat-icon.blue { background: linear-gradient(135deg, #2B6CB0, #3498db); }
.stat-icon.orange { background: linear-gradient(135deg, #eda922, #f0b830); }
.stat-icon.green { background: linear-gradient(135deg, #27ae60, #2ecc71); }
.stat-icon.red { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.stat-icon.purple { background: linear-gradient(135deg, #8e44ad, #9b59b6); }
.stat-info h4 { font-size: 1.6rem; margin-bottom: 2px; }
.stat-info p { color: #6d7a83; font-size: 0.85rem; }

/* ===== TABLES ===== */
.table-responsive { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
table th {
    background: #f7f9fb;
    padding: 12px 16px;
    text-align: left;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6d7a83;
    font-weight: 600;
    border-bottom: 2px solid #edf0f2;
}
table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: middle;
}
table tr:hover td { background: #f9fafb; }
table .thumb { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; }
table .thumb-square { width: 45px; height: 45px; border-radius: 8px; object-fit: cover; }

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-success { background: #e8f8f0; color: #27ae60; }
.badge-warning { background: #fef9e7; color: #f39c12; }
.badge-danger { background: #fdecec; color: #e74c3c; }
.badge-info { background: #eaf2f8; color: #2B6CB0; }
.badge-secondary { background: #eef0f2; color: #6d7a83; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Roboto', sans-serif;
    text-decoration: none;
    line-height: 1.4;
}
.btn-primary { background: #eda922; color: #fff; }
.btn-primary:hover { background: #d4941a; color: #fff; }
.btn-secondary { background: #2B6CB0; color: #fff; }
.btn-secondary:hover { background: #1E4D7B; color: #fff; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; color: #fff; }
.btn-outline { background: transparent; border: 1px solid #c5c7c9; color: #374146; }
.btn-outline:hover { border-color: #2B6CB0; color: #2B6CB0; }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-icon { padding: 8px 10px; }
.btn-group { display: flex; gap: 8px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374146;
    font-size: 0.9rem;
}
.form-group label .required { color: #e74c3c; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="url"], input[type="tel"], input[type="date"], input[type="time"],
input[type="datetime-local"], select, textarea {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.92rem;
    font-family: 'Roboto', sans-serif;
    color: #374146;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #2B6CB0;
    box-shadow: 0 0 0 3px rgba(43,108,176,0.1);
}
textarea { height: auto; padding: 14px 16px; resize: vertical; min-height: 120px; }
select { cursor: pointer; appearance: auto; }
.form-hint { font-size: 0.8rem; color: #6d7a83; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ===== BILINGUAL TABS ===== */
.bilingual-tabs { margin-bottom: 0; }
.tab-buttons { display: flex; gap: 0; margin-bottom: 0; }
.tab-btn {
    padding: 8px 20px;
    background: #edf0f2;
    border: 1px solid #d1d5db;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: #6d7a83;
    font-family: 'Roboto', sans-serif;
    transition: all 0.2s;
}
.tab-btn.active {
    background: #fff;
    color: #2B6CB0;
    border-color: #2B6CB0;
    border-bottom-color: #fff;
    position: relative;
    z-index: 1;
}
.tab-content {
    display: none;
    border: 1px solid #d1d5db;
    border-radius: 0 8px 8px 8px;
    margin-top: -1px;
}
.tab-content.active { display: block; }
.tab-content input, .tab-content textarea {
    border: none;
    border-radius: 0 8px 8px 8px;
}
.tab-content input:focus, .tab-content textarea:focus { box-shadow: none; border: none; }

/* ===== TINYMCE WYSIWYG ===== */
.bilingual-tabs .tox-tinymce {
    border: none;
    border-radius: 0 0 8px 8px;
}
.tab-content .tox-tinymce {
    width: 100%;
}
.tab-content textarea.wysiwyg {
    min-height: 200px;
}

/* ===== IMAGE UPLOAD ===== */
.image-upload {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
    position: relative;
}
.image-upload:hover { border-color: #2B6CB0; }
.image-upload i { font-size: 2rem; color: #c5c7c9; margin-bottom: 8px; }
.image-upload p { color: #6d7a83; font-size: 0.85rem; }
.image-upload input[type="file"] {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
}
.image-preview { margin-top: 12px; }
.image-preview img { max-height: 150px; border-radius: 8px; }
.current-image { margin-bottom: 10px; }
.current-image img { max-height: 100px; border-radius: 8px; border: 2px solid #edf0f2; }

/* ===== ALERTS ===== */
.alert {
    padding: 14px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background: #e8f8f0; color: #27ae60; border: 1px solid #c3e6cb; }
.alert-error { background: #fdecec; color: #e74c3c; border: 1px solid #f5c6cb; }
.alert-warning { background: #fef9e7; color: #f39c12; border: 1px solid #fdeaa8; }
.alert-info { background: #eaf2f8; color: #2B6CB0; border: 1px solid #bee5eb; }

/* ===== PAGINATION ===== */
.pagination { display: flex; gap: 6px; margin-top: 20px; justify-content: center; }
.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #d1d5db;
    color: #374146;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.page-btn:hover { border-color: #2B6CB0; color: #2B6CB0; }
.page-btn.active { background: #2B6CB0; color: #fff; border-color: #2B6CB0; }

/* ===== FILTERS BAR ===== */
.filters-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.filters-bar select, .filters-bar input[type="text"] { width: auto; height: 40px; font-size: 0.85rem; }
.filters-bar input[type="text"] { min-width: 200px; }

/* ===== SORTABLE (DRAG & DROP) ===== */
.sortable-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid #edf0f2;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: grab;
    transition: box-shadow 0.2s;
}
.sortable-item:active { cursor: grabbing; }
.sortable-item.dragging { box-shadow: 0 4px 20px rgba(0,0,0,0.15); opacity: 0.9; }
.sortable-handle { color: #c5c7c9; font-size: 1.1rem; }
.sortable-item .item-title { flex: 1; font-weight: 500; }
.sortable-item .item-actions { display: flex; gap: 8px; }

/* ===== TOGGLE SWITCH ===== */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    display: inline-block;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0;
    right: 0; bottom: 0;
    background: #d1d5db;
    border-radius: 24px;
    transition: 0.3s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: #27ae60; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d1d31, #1E4D7B, #2B6CB0);
    position: relative;
    overflow: hidden;
}
.login-page .bubble {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(237,169,34,0.2);
    animation: float 8s ease-in-out infinite;
}
.login-page .bubble:nth-child(1) { width: 120px; height: 120px; top: 10%; left: 10%; animation-delay: 0s; }
.login-page .bubble:nth-child(2) { width: 80px; height: 80px; top: 60%; right: 15%; animation-delay: 2s; }
.login-page .bubble:nth-child(3) { width: 60px; height: 60px; bottom: 15%; left: 30%; animation-delay: 4s; }
.login-page .bubble:nth-child(4) { width: 150px; height: 150px; top: 30%; right: 5%; animation-delay: 1s; border-color: rgba(237,169,34,0.1); }
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 45px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}
.login-card h1 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 5px;
}
.login-card .subtitle {
    text-align: center;
    color: #6d7a83;
    margin-bottom: 30px;
    font-size: 0.9rem;
}
.login-card .btn-primary {
    width: 100%;
    height: 48px;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 10px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #6d7a83;
}
.empty-state i { font-size: 3rem; margin-bottom: 15px; color: #d1d5db; }
.empty-state p { margin-bottom: 15px; }

/* ===== CONFIRM MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.custom-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}
.modal-box {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}
.modal-box h3 { margin-bottom: 10px; }
.modal-box p { color: #6d7a83; margin-bottom: 20px; }
.modal-box .btn-group { justify-content: center; }

/* ===== ACTIONS COLUMN ===== */
.actions { display: flex; gap: 6px; align-items: center; }
.actions a, .actions button { display: inline-flex; }

/* ===== DETAIL VIEW ===== */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.detail-item { margin-bottom: 10px; }
.detail-item .label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; color: #6d7a83; margin-bottom: 2px; }
.detail-item .value { font-weight: 500; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0 !important; }
    .btn-hamburger { display: block; }
    .btn-sidebar-toggle { display: none !important; }
    .content-area { padding: 20px 15px; }
    .topbar { padding: 0 15px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .filters-bar { flex-direction: column; align-items: stretch; }
    .filters-bar select, .filters-bar input[type="text"] { width: 100%; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-card { padding: 30px 25px; margin: 15px; }
}

/* ===== INSTALL PAGE ===== */
.install-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d1d31, #1E4D7B, #2B6CB0);
}
.install-card {
    background: #fff;
    border-radius: 16px;
    padding: 45px 40px;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.install-card h1 { text-align: center; margin-bottom: 20px; }
.install-log {
    background: #1a1a2e;
    color: #0f0;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.8;
}
.install-log .ok { color: #2ecc71; }
.install-log .err { color: #e74c3c; }
.install-log .info { color: #3498db; }

/* ===== SIDEBAR OVERLAY (mobile) ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}
.sidebar-overlay.show { display: block; }

/* ===== QUICK ACTIONS ===== */
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 30px; }
.quick-action-card {
    flex: 1;
    min-width: 180px;
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
    transition: transform 0.2s;
    color: #374146;
}
.quick-action-card:hover { transform: translateY(-3px); color: #374146; }
.quick-action-card i { font-size: 1.8rem; color: #2B6CB0; margin-bottom: 8px; }
.quick-action-card span { display: block; font-size: 0.85rem; font-weight: 500; }

/* ===== MISC ===== */
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

/* ===== GLOBAL SEARCH ===== */
.global-search {
    position: relative;
    flex: 1;
    max-width: 420px;
    margin: 0 20px;
}
.global-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.global-search-input-wrap i {
    position: absolute;
    left: 14px;
    color: rgba(255,255,255,0.6);
    font-size: 0.9rem;
    pointer-events: none;
}
.global-search-input-wrap input {
    width: 100%;
    height: 38px;
    padding: 0 14px 0 38px;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 8px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 0.85rem;
    font-family: 'Roboto', sans-serif;
    transition: background 0.2s, border-color 0.2s;
}
.global-search-input-wrap input::placeholder { color: rgba(255,255,255,0.5); }
.global-search-input-wrap input:focus {
    outline: none;
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.5);
    box-shadow: none;
}
.search-results {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
    max-height: 400px;
    overflow-y: auto;
    z-index: 200;
}
.search-results.show { display: block; }
.search-result-group { border-bottom: 1px solid #edf0f2; }
.search-result-group:last-child { border-bottom: none; }
.search-result-group-header {
    padding: 10px 16px 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #6d7a83;
    font-weight: 600;
}
.search-result-item {
    display: block;
    padding: 8px 16px;
    color: #374146;
    text-decoration: none;
    transition: background 0.15s;
}
.search-result-item:hover,
.search-result-item.active {
    background: #f0f5fa;
    color: #2B6CB0;
}
.search-result-title { font-weight: 500; font-size: 0.9rem; }
.search-result-subtitle { font-size: 0.78rem; color: #6d7a83; margin-top: 1px; }
.search-result-item.active .search-result-title { color: #2B6CB0; }
.search-no-results {
    padding: 20px 16px;
    text-align: center;
    color: #6d7a83;
    font-size: 0.85rem;
}

@media (max-width: 600px) {
    .global-search { display: none; }
}

/* ===== ANALYTICS CHARTS ===== */
.analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }
.analytics-grid .card { margin-bottom: 0; }
.bar-chart { display: flex; flex-direction: column; gap: 12px; }
.bar-chart-row { display: flex; align-items: center; gap: 12px; }
.bar-chart-label {
    width: 90px;
    font-size: 0.82rem;
    color: #374146;
    text-align: right;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bar-chart-track {
    flex: 1;
    background: #edf0f2;
    border-radius: 6px;
    height: 28px;
    position: relative;
    overflow: hidden;
}
.bar-chart-fill {
    height: 100%;
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    min-width: 30px;
    transition: width 0.6s ease;
}
.bar-chart-fill.blue { background: linear-gradient(135deg, #2B6CB0, #3498db); }
.bar-chart-fill.green { background: linear-gradient(135deg, #27ae60, #2ecc71); }
.bar-chart-fill.orange { background: linear-gradient(135deg, #eda922, #f0b830); }
.bar-chart-fill.red { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.bar-chart-fill.purple { background: linear-gradient(135deg, #8e44ad, #9b59b6); }
.bar-chart-fill.teal { background: linear-gradient(135deg, #00897b, #26a69a); }

.stacked-bar { display: flex; border-radius: 6px; overflow: hidden; height: 36px; }
.stacked-bar-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    min-width: 40px;
    transition: flex 0.6s ease;
}
.stacked-bar-legend { display: flex; gap: 16px; margin-top: 10px; flex-wrap: wrap; }
.stacked-bar-legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: #374146; }
.stacked-bar-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-item { display: flex; align-items: center; gap: 12px; }
.rank-number {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #edf0f2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #374146;
    flex-shrink: 0;
}
.rank-item:nth-child(1) .rank-number { background: #eda922; color: #fff; }
.rank-item:nth-child(2) .rank-number { background: #95a5a6; color: #fff; }
.rank-item:nth-child(3) .rank-number { background: #cd7f32; color: #fff; }
.rank-info { flex: 1; min-width: 0; }
.rank-info-name { font-size: 0.85rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-info-bar {
    margin-top: 4px;
    background: #edf0f2;
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}
.rank-info-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}
.rank-count { font-size: 0.82rem; font-weight: 600; color: #374146; flex-shrink: 0; }

.timeline-list { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f2f5;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}
.timeline-dot.blue { background: #2B6CB0; }
.timeline-dot.green { background: #27ae60; }
.timeline-dot.orange { background: #eda922; }
.timeline-dot.red { background: #e74c3c; }
.timeline-dot.gray { background: #95a5a6; }
.timeline-content { flex: 1; min-width: 0; }
.timeline-content strong { font-weight: 500; }
.timeline-content small { color: #6d7a83; display: block; margin-top: 2px; font-size: 0.78rem; }
.timeline-date { font-size: 0.78rem; color: #6d7a83; flex-shrink: 0; }

@media (max-width: 1024px) {
    .analytics-grid { grid-template-columns: 1fr; }
}

/* ===== BULK ACTIONS BAR ===== */
.bulk-bar {
    position: fixed;
    bottom: -80px;
    left: 260px;
    right: 0;
    z-index: 500;
    transition: bottom 0.3s ease;
    pointer-events: none;
}
.bulk-bar.show {
    bottom: 0;
    pointer-events: auto;
}
.bulk-bar-inner {
    background: linear-gradient(135deg, #1a5276, #2980b9);
    color: #fff;
    padding: 14px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    font-size: 0.9rem;
}
.bulk-bar-inner span { font-size: 0.9rem; }
.bulk-bar-inner .bulk-count {
    font-size: 1.1rem;
    margin-right: 2px;
}
.bulk-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bulk-bar-actions .btn {
    font-size: 0.82rem;
    padding: 6px 14px;
    border-radius: 6px;
}
.bulk-bar-actions .btn:hover { opacity: 0.9; }
.bulk-bar-actions .bulk-status-select {
    width: auto;
    height: 34px;
    padding: 0 10px;
    font-size: 0.82rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.15);
    color: #fff;
    cursor: pointer;
}
.bulk-bar-actions .bulk-status-select option { color: #374146; background: #fff; }

/* Bulk select checkboxes */
.bulk-select-all,
.bulk-select {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #2B6CB0;
}
table th:first-child:has(.bulk-select-all),
table td:first-child:has(.bulk-select) {
    width: 40px;
    text-align: center;
}

@media (max-width: 768px) {
    .bulk-bar { left: 0; }
    .bulk-bar-inner {
        padding: 12px 15px;
        flex-direction: column;
        gap: 10px;
    }
    .bulk-bar-actions { flex-wrap: wrap; justify-content: center; }
}

/* ===== MEDIA LIBRARY ===== */
.media-filter {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #edf0f2;
}
.media-filter form select {
    width: auto;
    height: 48px;
    min-width: 150px;
}
.media-filter form input[type="text"] {
    min-width: 220px;
    border-radius: 8px 0 0 8px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}
.media-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: #f0f2f5;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}
.media-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.media-item .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    padding: 40px 12px 12px;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.media-item:hover .overlay {
    opacity: 1;
}
.media-item .overlay .media-name {
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.media-item .overlay .media-info {
    color: rgba(255,255,255,0.7);
    font-size: 0.72rem;
}
.media-item .overlay .media-date {
    color: rgba(255,255,255,0.5);
    font-size: 0.68rem;
}
.media-item .overlay .media-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}
.media-item .overlay .media-actions .btn {
    padding: 4px 10px;
    font-size: 0.75rem;
}

/* Media Preview Modal */
.media-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.media-modal.show {
    opacity: 1;
    pointer-events: auto;
}
.media-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    text-align: center;
}
.media-modal-content img {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.media-modal-close {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 36px;
    height: 36px;
    background: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    color: #374146;
    transition: background 0.2s;
    z-index: 1;
}
.media-modal-close:hover {
    background: #e74c3c;
    color: #fff;
}
.media-modal-info {
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    margin-top: 10px;
}

@media (max-width: 768px) {
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }
}
@media (max-width: 480px) {
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

/* ===== SCHEDULING BADGES ===== */
.badge-scheduled {
    background: #eaf2f8;
    color: #2B6CB0;
}
.badge-expired {
    background: #fdecec;
    color: #e74c3c;
}
.schedule-info {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.schedule-info small {
    font-size: 0.75rem;
    color: #6d7a83;
}
.schedule-info .badge {
    font-size: 0.68rem;
    padding: 2px 8px;
}
