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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --accent: #f57c00;
    --text: #1e293b;
    --text-muted: #64748b;
    --bg: #ffffff;
    --bg-alt: #f1f5f9;
    --border: #e2e8f0;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #2563eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);
    --radius: 10px;
    --radius-sm: 6px;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --header-height: 64px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background: var(--bg-alt);
    line-height: 1.6;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: var(--bg); border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; }

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}
.login-card {
    background: var(--bg);
    padding: 48px 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}
.login-card h1 { font-size: 22px; margin-bottom: 28px; text-align: center; color: var(--text); font-weight: 700; }
.login-card h1 i { color: var(--accent); margin-right: 8px; }
.back-link { display: block; text-align: center; margin-top: 20px; color: var(--text-muted); font-size: 14px; }
.back-link:hover { color: var(--primary); }

.admin-layout { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width var(--transition);
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.sidebar-brand a {
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-brand a:hover { text-decoration: none; }
.sidebar-brand a i {
    color: var(--accent);
    font-size: 22px;
    flex-shrink: 0;
    width: 32px;
    text-align: center;
}

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

.nav-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #475569;
    padding: 16px 20px 8px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    border-left: 3px solid transparent;
    margin: 1px 0;
}
.sidebar-link i {
    font-size: 16px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}
.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
    text-decoration: none;
    border-left-color: rgba(255,255,255,0.15);
}
.sidebar-link.active {
    background: rgba(37, 99, 235, 0.15);
    color: #60a5fa;
    border-left-color: var(--sidebar-active);
    font-weight: 600;
}
.sidebar-link-logout {
    margin-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 14px;
}
.sidebar-link-logout:hover { color: #f87171; border-left-color: #ef4444; }

.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition);
    min-width: 0;
}

.admin-header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.header-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.header-welcome {
    font-size: 14px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-alt);
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 500;
}
.header-welcome i { color: var(--primary); font-size: 16px; }

.sidebar-toggle {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-muted);
    transition: all 0.2s;
}
.sidebar-toggle:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.sidebar-collapsed .admin-sidebar { width: var(--sidebar-collapsed-width); }
.sidebar-collapsed .admin-main { margin-left: var(--sidebar-collapsed-width); }
.sidebar-collapsed .brand-text { opacity: 0; }
.sidebar-collapsed .sidebar-link span { opacity: 0; width: 0; }
.sidebar-collapsed .nav-section-label { font-size: 0; padding: 12px 0 4px; text-align: center; }
.sidebar-collapsed .nav-section-label::after { content: ''; display: block; width: 24px; height: 1px; background: #334155; margin: 0 auto; }
.sidebar-collapsed .sidebar-link { justify-content: center; padding: 11px 0; border-left-width: 0; }
.sidebar-collapsed .sidebar-link i { width: auto; font-size: 18px; }
.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
.sidebar-collapsed .sidebar-brand a { gap: 0; }

.admin-content { padding: 32px; }

.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.section-header h2 { font-size: 22px; font-weight: 700; }
.section-header h3 { font-size: 18px; font-weight: 700; }
.section-header h3 i { color: var(--accent); margin-right: 6px; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 32px; }
.stat-card {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.stat-icon-blue { background: #dbeafe; color: #2563eb; }
.stat-icon-purple { background: #ede9fe; color: #7c3aed; }
.stat-icon-green { background: #dcfce7; color: #16a34a; }
.stat-icon-orange { background: #ffedd5; color: #ea580c; }
.stat-icon-red { background: #fee2e2; color: #dc2626; }
.stat-info { flex: 1; }
.stat-number { font-size: 32px; font-weight: 800; color: var(--text); line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.admin-section { margin-bottom: 32px; }
.admin-section h3 { font-size: 18px; margin-bottom: 16px; font-weight: 700; }
.admin-section h3 i { color: var(--text-muted); margin-right: 6px; }

.table-wrap {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}
.admin-table th, .admin-table td { padding: 14px 18px; text-align: left; font-size: 14px; }
.admin-table th {
    background: var(--bg-alt);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.6px;
    border-bottom: 2px solid var(--border);
}
.admin-table td { border-top: 1px solid var(--border); }
.admin-table tr:hover td { background: #f8fafc; }
.admin-table tr:last-child td { border-bottom: none; }

.table-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.table-thumb-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.actions-cell { white-space: nowrap; display: flex; gap: 6px; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-featured { background: #fef3c7; color: #92400e; }
.badge-default { background: var(--bg-alt); color: var(--text-muted); }
.badge-active { background: #dcfce7; color: #166534; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    background: var(--bg);
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
textarea.form-control { resize: vertical; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; display: block; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-actions { display: flex; gap: 12px; margin-top: 28px; }

.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.checkbox-label input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary); }

.current-image { margin-bottom: 12px; }
.current-image img { max-width: 150px; border-radius: var(--radius-sm); border: 1px solid var(--border); }

.admin-form {
    max-width: 720px;
    background: var(--bg);
    padding: 36px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.stats-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stats-grid-5 { grid-template-columns: repeat(5, 1fr); }
.analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

.event-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.event-view { background: #dbeafe; color: #1d4ed8; }
.event-whatsapp { background: #dcfce7; color: #166534; }
.event-vcard { background: #fef3c7; color: #92400e; }

.text-muted { color: var(--text-muted); font-size: 14px; }
.text-center { text-align: center; }

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .stats-grid-5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition);
        width: var(--sidebar-width) !important;
    }
    .sidebar-mobile-open .admin-sidebar { transform: translateX(0); }
    .sidebar-mobile-open .sidebar-overlay { display: block; }
    .admin-main { margin-left: 0 !important; }
    .sidebar-toggle { display: flex; }
    .admin-content { padding: 20px 16px; }
    .admin-header { padding: 0 16px; }
    .stats-grid { grid-template-columns: 1fr; }
    .stats-grid-4 { grid-template-columns: 1fr 1fr; }
    .stats-grid-5 { grid-template-columns: 1fr 1fr; }
    .analytics-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .admin-table th, .admin-table td { padding: 10px 12px; }
    .header-title { font-size: 16px; }
    .admin-search-box { flex-direction: column; gap: 0; }
    .admin-search-input { font-size: 14px; padding: 10px 12px 10px 38px; }
}

.admin-search-box {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.admin-search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.admin-search-icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 15px;
    pointer-events: none;
}
.admin-search-input {
    width: 100%;
    padding: 12px 120px 12px 44px;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    background: transparent;
    color: var(--text);
    outline: none;
}
.admin-search-input::placeholder {
    color: #94a3b8;
}
.admin-search-count {
    position: absolute;
    right: 16px;
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 500;
}
.admin-muted { color: var(--text-muted); }
