/* MySocial Admin Panel - Modern UI */
:root {
    --primary: #32c9a7;
    --primary-dark: #26a88e;
    --sidebar-bg: #1a1d2e;
    --sidebar-hover: #252840;
    --sidebar-active: #32c9a7;
    --header-bg: #fff;
    --body-bg: #f4f6fb;
    --card-bg: #fff;
    --text: #2d3748;
    --text-muted: #718096;
    --border: #e2e8f0;
    --danger: #e53e3e;
    --warning: #d69e2e;
    --success: #38a169;
    --info: #3182ce;
    --sidebar-width: 240px;
    --header-height: 60px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--body-bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand .brand-icon {
    width: 32px; height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 800; color: #fff;
}

.sidebar-brand .brand-name {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
}

.sidebar-brand .brand-sub {
    color: rgba(255,255,255,0.4);
    font-size: 11px;
    font-weight: 400;
}

.sidebar-nav { padding: 12px 0; }

.nav-section {
    padding: 8px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    margin-top: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: rgba(255,255,255,0.65);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    position: relative;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
    text-decoration: none;
}

.nav-item.active {
    background: rgba(50,201,167,0.15);
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.nav-item .nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 20px;
    min-width: 18px;
    text-align: center;
}

/* ===== MAIN CONTENT ===== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== TOPBAR ===== */
.topbar {
    height: var(--header-height);
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}

.topbar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    flex: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-badge {
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--radius);
    background: var(--body-bg);
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text);
    padding: 4px 8px;
}

/* ===== PAGE CONTENT ===== */
.page-content {
    padding: 24px;
    flex: 1;
}

/* ===== STAT CARDS ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    border-left: 4px solid var(--primary);
}

.stat-card.danger  { border-left-color: var(--danger); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.info    { border-left-color: var(--info); }
.stat-card.success { border-left-color: var(--success); }

.stat-icon {
    font-size: 28px;
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    background: rgba(50,201,167,0.1);
}

.stat-card.danger  .stat-icon { background: rgba(229,62,62,0.1); }
.stat-card.warning .stat-icon { background: rgba(214,158,46,0.1); }
.stat-card.info    .stat-icon { background: rgba(49,130,206,0.1); }
.stat-card.success .stat-icon { background: rgba(56,161,105,0.1); }

.stat-info .stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.stat-info .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
    font-weight: 500;
}

.stat-info .stat-sub {
    font-size: 11px;
    color: var(--success);
    margin-top: 2px;
}

/* ===== CARDS ===== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.card-body { padding: 20px; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    background: var(--body-bg);
    padding: 10px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    vertical-align: middle;
}

table tr:last-child td { border-bottom: none; }
table tr:hover td { background: #fafbfc; }

.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-cell img {
    width: 34px; height: 34px;
    border-radius: 50%;
    object-fit: cover;
    background: #e2e8f0;
}

.user-cell .user-info strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
}

.user-cell .user-info span {
    font-size: 11px;
    color: var(--text-muted);
}

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    gap: 4px;
}

.badge-success { background: rgba(56,161,105,0.12); color: var(--success); }
.badge-danger  { background: rgba(229,62,62,0.12);  color: var(--danger);  }
.badge-warning { background: rgba(214,158,46,0.12); color: var(--warning); }
.badge-info    { background: rgba(49,130,206,0.12); color: var(--info);    }
.badge-muted   { background: rgba(113,128,150,0.12); color: var(--text-muted); }
.badge-primary { background: rgba(50,201,167,0.12); color: var(--primary); }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover { text-decoration: none; opacity: 0.9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary  { background: var(--primary); color: #fff; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-warning  { background: var(--warning); color: #fff; }
.btn-success  { background: var(--success); color: #fff; }
.btn-info     { background: var(--info);    color: #fff; }
.btn-outline  { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost    { background: transparent; color: var(--text-muted); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-xs { padding: 2px 7px; font-size: 11px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 5px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="datetime-local"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13.5px;
    color: var(--text);
    background: #fff;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(50,201,167,0.1);
}

.form-group textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Toggle Switch */
.toggle-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
}

.toggle {
    position: relative;
    width: 42px; height: 24px;
    cursor: pointer;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    top:0; left:0; right:0; bottom:0;
    background: #cbd5e0;
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider:before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider:before { transform: translateX(18px); }

.toggle-label { font-size: 13.5px; font-weight: 500; color: var(--text); }

/* ===== SEARCH & FILTER BAR ===== */
.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--body-bg);
    border-radius: var(--radius) var(--radius) 0 0;
}

.filter-bar input,
.filter-bar select {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.filter-bar input:focus,
.filter-bar select:focus {
    border-color: var(--primary);
}

.filter-bar input[type="text"] { min-width: 200px; }

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success { background: rgba(56,161,105,0.1);  color: var(--success); border: 1px solid rgba(56,161,105,0.2); }
.alert-danger  { background: rgba(229,62,62,0.1);   color: var(--danger);  border: 1px solid rgba(229,62,62,0.2);  }
.alert-warning { background: rgba(214,158,46,0.1);  color: var(--warning); border: 1px solid rgba(214,158,46,0.2); }
.alert-info    { background: rgba(49,130,206,0.1);  color: var(--info);    border: 1px solid rgba(49,130,206,0.2);  }

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
    transition: all 0.2s;
    text-decoration: none;
}

.pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration: none; }
.pagination span.current { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { transform: translateY(-20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header .modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); padding: 0 4px; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ===== TOAST ===== */
#toast-container {
    position: fixed;
    top: 20px; right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 600;
    color: #fff;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.3s ease;
    min-width: 240px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.success { background: var(--success); }
.toast.danger  { background: var(--danger);  }
.toast.warning { background: var(--warning); }
.toast.info    { background: var(--info);    }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* ===== CHARTS ===== */
.chart-wrap { position: relative; height: 250px; }

/* ===== MISC ===== */
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #e2e8f0;
}

.post-preview {
    background: var(--body-bg);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text);
    max-height: 80px;
    overflow: hidden;
    border-left: 3px solid var(--primary);
}

.actions-cell { white-space: nowrap; display: flex; gap: 4px; align-items: center; }

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1d2e 0%, #252840 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .icon {
    width: 56px; height: 56px;
    background: var(--primary);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 900;
    color: #fff;
    margin-bottom: 12px;
}

.login-logo h2 { font-size: 20px; font-weight: 800; color: var(--text); }
.login-logo p  { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0;
    }
    .hamburger-btn { display: block; }
    .form-row { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .page-content { padding: 16px; }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .filter-bar input[type="text"] { min-width: 100%; }
}

/* ===== MOBILE RESPONSIVE IMPROVEMENTS ===== */

/* Table: horizontal scroll on small screens */
@media (max-width: 768px) {
    .page-content { padding: 12px; }

    /* Stat grid: 2 columns on tablet, 1 on phone */
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

    /* Cards */
    .card-header { flex-wrap: wrap; gap: 8px; }
    .card-body { padding: 14px; }

    /* Tables: make them scroll horizontally */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table th, table td { padding: 9px 10px; font-size: 12px; }

    /* Filter bar stacks */
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar input[type="text"],
    .filter-bar select { width: 100%; min-width: unset; }

    /* Buttons smaller */
    .btn { padding: 6px 11px; font-size: 12px; }
    .btn-sm { padding: 4px 9px; font-size: 11px; }
    .btn-xs { padding: 3px 7px; font-size: 11px; }

    /* Actions cell: wrap */
    .actions-cell { flex-wrap: wrap; gap: 3px; }

    /* Modal full width */
    .modal { max-width: 100% !important; margin: 0; border-radius: 0; max-height: 100vh; }
    .modal-overlay { padding: 0; align-items: flex-end; }

    /* Form rows: single column */
    .form-row { grid-template-columns: 1fr !important; gap: 0; }

    /* Topbar */
    .topbar-badge { display: none; }
    .topbar-user span { display: none; }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { padding: 14px; }
    .stat-info .stat-value { font-size: 20px; }
    .stat-icon { font-size: 22px; width: 38px; height: 38px; }
    
    /* Hide less important table columns on mobile */
    table .hide-mobile { display: none; }
    
    /* Pagination */
    .pagination a, .pagination span { padding: 5px 9px; font-size: 12px; }
}

/* Sidebar overlay on mobile */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .hamburger-btn { display: block; }
    
    /* Overlay when sidebar open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }
    .sidebar-overlay.active { display: block; }
}

/* Notify grid responsive */
.notify-grid { gap: 16px; }
@media(max-width:700px) { .notify-grid { grid-template-columns: 1fr !important; } }

/* Reports responsive */
@media(max-width:600px) {
    .report-actions { flex-direction: column; }
}

/* Login page on small screens */
@media(max-width:420px) {
    .login-box { padding: 28px 20px; }
}
