/* =====================================================
   ADMIN STYLES v2 — FULLY FIXED + ENHANCED
   ===================================================== */

/* ===== ADMIN PANEL — BASE ===== */
.admin-body {
    font-family: "Poppins", system-ui, sans-serif;
    background: #ffffff;
    color: #1a1025;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== ANIMATED BACKGROUND ===== */
.admin-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.admin-bg__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.25;
    animation: adminOrbFloat 25s ease-in-out infinite;
    will-change: transform;
}

.admin-bg__orb--1 {
    width: 600px; height: 600px;
    background: linear-gradient(135deg, #e9d5ff, #c084fc);
    top: -250px; right: -150px;
}

.admin-bg__orb--2 {
    width: 500px; height: 500px;
    background: linear-gradient(135deg, #f3e8ff, #e879f9);
    bottom: -200px; left: -150px;
    animation-delay: -8s;
}

.admin-bg__orb--3 {
    width: 350px; height: 350px;
    background: linear-gradient(135deg, #a5f3fc, #c084fc);
    top: 40%; left: 40%;
    opacity: 0.15;
    animation-delay: -16s;
}

@keyframes adminOrbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(40px, -30px) scale(1.06); }
    50% { transform: translate(-30px, 40px) scale(0.94); }
    75% { transform: translate(-40px, -20px) scale(1.03); }
}

.admin-bg__grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(139, 92, 246, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 92, 246, 0.04) 1px, transparent 1px);
    background-size: 50px 50px;
}

.admin-bg__particles { position: absolute; inset: 0; }

.admin-particle {
    position: absolute;
    width: 4px; height: 4px;
    background: rgba(139, 92, 246, 0.3);
    border-radius: 50%;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.4);
    animation: adminParticle linear infinite;
}

.admin-particle:nth-child(1) { top: 10%; left: 15%; animation-duration: 18s; width: 3px; height: 3px; }
.admin-particle:nth-child(2) { top: 25%; left: 75%; animation-duration: 22s; animation-delay: 3s; width: 5px; height: 5px; }
.admin-particle:nth-child(3) { top: 50%; left: 30%; animation-duration: 15s; animation-delay: 6s; }
.admin-particle:nth-child(4) { top: 70%; left: 60%; animation-duration: 20s; animation-delay: 2s; width: 3px; height: 3px; }
.admin-particle:nth-child(5) { top: 85%; left: 20%; animation-duration: 25s; animation-delay: 8s; width: 6px; height: 6px; opacity: 0.2; }
.admin-particle:nth-child(6) { top: 40%; left: 85%; animation-duration: 17s; animation-delay: 4s; }
.admin-particle:nth-child(7) { top: 15%; left: 50%; animation-duration: 23s; animation-delay: 10s; width: 3px; height: 3px; }
.admin-particle:nth-child(8) { top: 60%; left: 10%; animation-duration: 19s; animation-delay: 5s; }

@keyframes adminParticle {
    0% { transform: translateY(0) translateX(0) scale(1); opacity: 0; }
    10% { opacity: 1; }
    50% { opacity: 0.6; }
    90% { opacity: 1; }
    100% { transform: translateY(-100vh) translateX(40px) scale(0.5); opacity: 0; }
}

/* ===== SCROLLBAR (Cross-browser) ===== */
.admin-body::-webkit-scrollbar { width: 8px; }
.admin-body::-webkit-scrollbar-track { background: #faf5ff; }
.admin-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #a855f7, #d946ef);
    border-radius: 10px;
}

/* Firefox scrollbar */
.admin-body {
    scrollbar-width: thin;
    scrollbar-color: #a855f7 #faf5ff;
}

/* ===== LOGIN SCREEN ===== */
.login-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    transition: opacity 0.6s ease, visibility 0.6s;
}

.login-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    padding: 48px 40px;
    background: white;
    border: 1px solid rgba(139, 92, 246, 0.12);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(139, 92, 246, 0.12), 0 0 0 1px rgba(139, 92, 246, 0.06);
    z-index: 1;
    animation: loginAppear 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginAppear {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(217, 70, 239, 0.2), rgba(139, 92, 246, 0.1));
    border-radius: inherit;
    z-index: -1;
    filter: blur(1px);
}

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

.login-logo__icon {
    width: 72px; height: 72px;
    margin: 0 auto 16px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #9333ea, #d946ef);
    border-radius: 16px;
    font-family: "Space Grotesk", monospace;
    font-size: 1.5rem; font-weight: 700; color: white;
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.4);
    animation: loginIconPulse 3s ease-in-out infinite;
}

@keyframes loginIconPulse {
    0%, 100% { box-shadow: 0 0 30px rgba(139, 92, 246, 0.3); }
    50% { box-shadow: 0 0 50px rgba(139, 92, 246, 0.6), 0 0 80px rgba(217, 70, 239, 0.2); }
}

.login-logo__title {
    font-family: "Space Grotesk", monospace;
    font-size: 1.8rem; font-weight: 700;
    background: linear-gradient(135deg, #9333ea, #d946ef);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-logo__subtitle {
    font-size: 0.85rem; color: #9ca3af;
    margin-top: 4px; letter-spacing: 0.1em; text-transform: uppercase;
}

/* ===== FORM ELEMENTS ===== */
.admin-form-group { position: relative; margin-bottom: 20px; }

.admin-label {
    display: block; font-size: 0.78rem; font-weight: 600; color: #6b7280;
    margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.08em;
}

.admin-input {
    width: 100%; padding: 14px 18px;
    background: #faf5ff;
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 12px; color: #1a1025;
    font-size: 1rem; font-family: "Poppins", system-ui, sans-serif;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    box-sizing: border-box;
}

.admin-input::placeholder { color: #9ca3af; }

.admin-input:focus {
    border-color: #a855f7;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
    background: white;
}

.admin-input.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
    animation: inputShake 0.5s ease;
}

/* FIX: Disabled state */
.admin-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f3f4f6;
}

@keyframes inputShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.admin-textarea {
    width: 100%; padding: 14px 18px;
    background: #faf5ff;
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 12px; color: #1a1025;
    font-size: 0.9rem; font-family: "Poppins", system-ui, sans-serif;
    transition: all 0.2s ease; outline: none;
    resize: vertical; min-height: 80px;
    box-sizing: border-box;
}

.admin-textarea:focus {
    border-color: #a855f7;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
    background: white;
}

.admin-select {
    width: 100%; padding: 14px 18px;
    background: #faf5ff;
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 12px; color: #1a1025;
    font-size: 0.9rem; font-family: "Poppins", system-ui, sans-serif;
    outline: none; cursor: pointer;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    box-sizing: border-box;
}

.admin-select:focus {
    border-color: #a855f7;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}

/* FIX: Password toggle positioning */
.toggle-password-btn {
    position: absolute;
    right: 14px;
    bottom: 14px;
    background: none; border: none;
    color: #9ca3af; cursor: pointer;
    padding: 4px; transition: color 0.2s ease;
    z-index: 2;
    display: flex; align-items: center; justify-content: center;
}

.toggle-password-btn:hover { color: #a855f7; }

/* ===== LOGIN BUTTON ===== */
.login-btn {
    width: 100%; padding: 16px;
    background: linear-gradient(135deg, #9333ea, #d946ef);
    border: none; border-radius: 12px;
    color: white; font-size: 1rem;
    font-weight: 600; font-family: "Poppins", system-ui, sans-serif;
    letter-spacing: 0.05em; text-transform: uppercase;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative; overflow: hidden;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 50px rgba(139, 92, 246, 0.5), 0 0 80px rgba(217, 70, 239, 0.2);
}

.login-btn:active { transform: translateY(0) scale(0.98); }

.login-btn span { position: relative; z-index: 1; }
.login-btn__loading { display: none; position: relative; z-index: 1; }
.login-btn__loading .spinner {
    width: 22px; height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto;
}

@keyframes spin { to { transform: rotate(360deg); } }
.login-btn.loading span { display: none; }
.login-btn.loading .login-btn__loading { display: block; }

.login-error {
    display: none;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 12px; color: #ef4444;
    font-size: 0.85rem; text-align: center;
    margin-bottom: 16px;
}

.login-error.visible {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.login-footer { text-align: center; margin-top: 24px; font-size: 0.8rem; color: #9ca3af; }
.login-footer a { color: #a855f7; text-decoration: none; transition: color 0.2s ease; }
.login-footer a:hover { color: #7c3aed; }

/* =====================================================
   ADMIN LAYOUT
   ===================================================== */
.admin-layout {
    display: none;
    position: relative; z-index: 1;
    min-height: 100vh;
}

.admin-layout.visible { display: flex; }

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 270px; background: white;
    border-right: 1px solid rgba(139, 92, 246, 0.1);
    display: flex; flex-direction: column;
    z-index: 100;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 4px 0 24px rgba(139, 92, 246, 0.05);
}

/* FIX: Sidebar backdrop for mobile */
.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.visible {
    display: block;
    opacity: 1;
}

.sidebar__header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.08);
    display: flex; align-items: center; gap: 14px;
}

.sidebar__logo {
    width: 42px; height: 42px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #9333ea, #d946ef);
    border-radius: 12px;
    font-family: "Space Grotesk", monospace;
    font-size: 0.9rem; font-weight: 700; color: white;
    flex-shrink: 0;
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.3);
}

.sidebar__brand-name { font-family: "Space Grotesk", monospace; font-weight: 700; font-size: 1.1rem; color: #1a1025; }
.sidebar__brand-sub { font-size: 0.7rem; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.1em; }

.sidebar__nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar__section { margin-bottom: 24px; }
.sidebar__section-title {
    padding: 8px 14px; font-size: 0.65rem; font-weight: 700;
    color: #9ca3af; text-transform: uppercase; letter-spacing: 0.15em;
}

.sidebar__link {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border-radius: 12px;
    color: #6b7280; text-decoration: none;
    font-size: 0.9rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border: none; background: none; width: 100%; text-align: left;
    font-family: "Poppins", system-ui, sans-serif;
}

.sidebar__link:hover { background: rgba(139, 92, 246, 0.06); color: #1a1025; }

.sidebar__link.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(217, 70, 239, 0.06));
    color: #9333ea;
    box-shadow: inset 3px 0 0 #9333ea;
    font-weight: 600;
}

.sidebar__link-icon { width: 20px; height: 20px; flex-shrink: 0; opacity: 0.6; }
.sidebar__link.active .sidebar__link-icon { opacity: 1; }

.sidebar__link-badge {
    margin-left: auto;
    padding: 2px 10px;
    background: linear-gradient(135deg, #9333ea, #d946ef);
    border-radius: 100px;
    font-size: 0.7rem; font-weight: 600; color: white;
    min-width: 22px; text-align: center;
}

.sidebar__footer { padding: 16px 12px; border-top: 1px solid rgba(139, 92, 246, 0.08); }

.sidebar__user {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; border-radius: 12px;
}

.sidebar__user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #a855f7, #d946ef);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem; color: white; flex-shrink: 0;
}

.sidebar__user-info { flex: 1; min-width: 0; }
.sidebar__user-name { font-size: 0.85rem; font-weight: 600; color: #1a1025; }
.sidebar__user-role { font-size: 0.7rem; color: #9ca3af; }

.sidebar__logout {
    background: none; border: none; color: #9ca3af;
    cursor: pointer; padding: 6px; border-radius: 8px;
    transition: all 0.2s ease; display: flex;
}

.sidebar__logout:hover { background: rgba(239, 68, 68, 0.08); color: #ef4444; }

/* ===== MAIN CONTENT ===== */
.admin-main { margin-left: 270px; flex: 1; min-height: 100vh; }

/* ===== TOP BAR ===== */
.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 32px;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(139, 92, 246, 0.08);
}

@supports (backdrop-filter: blur(20px)) {
    .topbar { background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
}

.topbar__left { display: flex; align-items: center; gap: 16px; }

.topbar__burger {
    display: none; background: none; border: none;
    color: #1a1025; cursor: pointer; padding: 8px;
    border-radius: 8px; transition: background 0.2s;
}

.topbar__burger:hover { background: rgba(139, 92, 246, 0.06); }

.topbar__title { font-size: 1.4rem; font-weight: 700; color: #1a1025; }
.topbar__breadcrumb { font-size: 0.8rem; color: #9ca3af; }
.topbar__right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* FIX: Theme toggle for admin */
.admin-theme-toggle {
    display: flex; align-items: center; justify-content: center;
    gap: 6px; padding: 8px 14px;
    background: white;
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 10px;
    color: #6b7280; font-size: 0.8rem;
    cursor: pointer; transition: all 0.2s ease;
    font-family: "Poppins", sans-serif;
    white-space: nowrap;
}

.admin-theme-toggle:hover {
    border-color: rgba(139, 92, 246, 0.3);
    color: #a855f7;
    background: rgba(139, 92, 246, 0.04);
}

.topbar__btn {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; padding: 10px 18px;
    background: white;
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 12px; color: #6b7280;
    font-size: 0.85rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s ease;
    font-family: "Poppins", sans-serif; text-decoration: none;
    white-space: nowrap;
}

.topbar__btn:hover {
    border-color: rgba(139, 92, 246, 0.3);
    color: #1a1025;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.1);
}

.topbar__btn--primary {
    background: linear-gradient(135deg, #9333ea, #d946ef);
    border-color: transparent; color: white;
}

.topbar__btn--primary:hover {
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
}

/* FIX: Disabled state */
.topbar__btn:disabled, .admin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.topbar__status {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    background: rgba(34, 197, 94, 0.06);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 100px;
    font-size: 0.75rem; font-weight: 600; color: #22c55e;
}

.topbar__status-dot {
    width: 7px; height: 7px;
    background: #22c55e; border-radius: 50%;
    animation: statusPulse 2s ease-in-out infinite;
    display: inline-block;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50% { opacity: 0.6; box-shadow: 0 0 0 5px rgba(34, 197, 94, 0); }
}

/* ===== CONTENT AREA ===== */
.content-area { padding: 32px; }

/* ===== PAGES ===== */
.admin-page { display: none; animation: pageIn 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.admin-page.active { display: block; }

@keyframes pageIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px; margin-bottom: 32px;
}

.stat-card {
    padding: 24px; background: white;
    border: 1px solid rgba(139, 92, 246, 0.1);
    border-radius: 16px;
    transition: all 0.3s ease;
    position: relative; overflow: hidden;
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.04);
}

.stat-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #a855f7, #d946ef);
    opacity: 0; transition: opacity 0.3s ease;
}

.stat-card:hover {
    border-color: rgba(139, 92, 246, 0.2);
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.1);
}

.stat-card:hover::before { opacity: 1; }

.stat-card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stat-card__icon { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: rgba(139, 92, 246, 0.06); }
.stat-card__icon svg { width: 22px; height: 22px; stroke: #a855f7; }
.stat-card__change { font-size: 0.75rem; font-weight: 600; padding: 4px 10px; border-radius: 100px; }
.stat-card__change--up { background: rgba(34, 197, 94, 0.08); color: #22c55e; }
.stat-card__value { font-size: 2rem; font-weight: 700; font-family: "Space Grotesk", monospace; color: #1a1025; margin-bottom: 4px; }
.stat-card__label { font-size: 0.85rem; color: #9ca3af; }

/* ===== ACTIVITY LOG ===== */
.activity-card { background: white; border: 1px solid rgba(139, 92, 246, 0.1); border-radius: 16px; overflow: hidden; box-shadow: 0 2px 12px rgba(139, 92, 246, 0.04); }
.activity-card__header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid rgba(139, 92, 246, 0.06); }
.activity-card__title { font-size: 1.1rem; font-weight: 600; color: #1a1025; }
.activity-card__clear { font-size: 0.8rem; color: #9ca3af; cursor: pointer; background: none; border: none; font-family: "Poppins", sans-serif; transition: color 0.2s; padding: 4px 8px; border-radius: 6px; }
.activity-card__clear:hover { color: #ef4444; background: rgba(239, 68, 68, 0.05); }
.activity-list { max-height: 400px; overflow-y: auto; }
.activity-item { display: flex; align-items: flex-start; gap: 14px; padding: 16px 24px; border-bottom: 1px solid rgba(139, 92, 246, 0.04); transition: background 0.2s; }
.activity-item:hover { background: rgba(139, 92, 246, 0.02); }
.activity-item:last-child { border-bottom: none; }
.activity-item__dot { width: 8px; height: 8px; border-radius: 50%; background: #a855f7; margin-top: 6px; flex-shrink: 0; }
.activity-item__dot--success { background: #22c55e; }
.activity-item__dot--warning { background: #f97316; }
.activity-item__dot--error { background: #ef4444; }
.activity-item__dot--info { background: #22d3ee; }
.activity-item__text { font-size: 0.85rem; color: #4a3f5c; line-height: 1.5; }
.activity-item__time { font-size: 0.75rem; color: #9ca3af; margin-top: 4px; }
.activity-empty { padding: 40px 24px; text-align: center; color: #9ca3af; font-size: 0.9rem; }

/* ===== TOAST (FIXED) ===== */
.toast-container {
    position: fixed; top: 20px; right: 20px;
    z-index: 100000; /* Higher than modal */
    display: flex; flex-direction: column; gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 20px;
    background: white;
    border: 1px solid rgba(139, 92, 246, 0.12);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(139, 92, 246, 0.15);
    min-width: 300px; max-width: 450px;
    animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative; overflow: hidden;
    pointer-events: auto;
}

.toast::before {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px;
}

.toast--success::before { background: #22c55e; }
.toast--error::before { background: #ef4444; }
.toast--warning::before { background: #f97316; }
.toast--info::before { background: #22d3ee; }
.toast.removing { animation: toastOut 0.3s ease forwards; }

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

.toast__icon { width: 20px; height: 20px; flex-shrink: 0; }
.toast__text { flex: 1; font-size: 0.85rem; color: #1a1025; }
.toast__close { background: none; border: none; color: #9ca3af; cursor: pointer; padding: 4px; border-radius: 4px; display: flex; }
.toast__close:hover { color: #1a1025; background: rgba(0,0,0,0.05); }

/* ===== ADMIN BUTTONS ===== */
.admin-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px;
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 12px; background: white; color: #6b7280;
    font-size: 0.85rem; font-weight: 500;
    font-family: "Poppins", sans-serif;
    cursor: pointer; transition: all 0.2s ease;
    text-decoration: none; white-space: nowrap;
    box-sizing: border-box;
}

.admin-btn:hover { border-color: rgba(139, 92, 246, 0.3); color: #1a1025; box-shadow: 0 4px 16px rgba(139, 92, 246, 0.08); }
.admin-btn--primary { background: linear-gradient(135deg, #9333ea, #d946ef); border-color: transparent; color: white; }
.admin-btn--primary:hover { box-shadow: 0 0 30px rgba(139, 92, 246, 0.4); transform: translateY(-1px); color: white; }
.admin-btn--danger { border-color: rgba(239, 68, 68, 0.2); color: #ef4444; }
.admin-btn--danger:hover { background: rgba(239, 68, 68, 0.05); border-color: #ef4444; }
.admin-btn--sm { padding: 6px 14px; font-size: 0.8rem; border-radius: 10px; }
.admin-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ===== SECTION HEADERS ===== */
.admin-section { margin-bottom: 32px; }
.admin-section__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.admin-section__title { font-size: 1.2rem; font-weight: 600; color: #1a1025; }

/* ===== FORM ROWS ===== */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-row--full { grid-template-columns: 1fr; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field__label { font-size: 0.78rem; font-weight: 600; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.06em; }

/* ===== TAGS ===== */
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tag-item {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 14px;
    background: rgba(139, 92, 246, 0.06);
    border: 1px solid rgba(139, 92, 246, 0.12);
    border-radius: 100px;
    font-size: 0.8rem; color: #7c3aed;
    transition: all 0.2s ease;
}

.tag-item:hover { background: rgba(139, 92, 246, 0.1); }

.tag-item__remove {
    background: none; border: none; color: #9ca3af;
    cursor: pointer; padding: 0; font-size: 1rem; line-height: 1;
    transition: color 0.2s;
}

.tag-item__remove:hover { color: #ef4444; }
.tag-add { display: flex; gap: 8px; margin-top: 8px; }
.tag-add input { flex: 1; }

/* ===== TEAM EDIT CARDS ===== */
.team-edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 24px; }

.team-edit-card {
    background: white;
    border: 1px solid rgba(139, 92, 246, 0.1);
    border-radius: 20px; overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.04);
}

.team-edit-card:hover { border-color: rgba(139, 92, 246, 0.2); box-shadow: 0 12px 32px rgba(139, 92, 246, 0.1); }

.team-edit-card__header {
    display: flex; align-items: center; gap: 16px;
    padding: 20px 22px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.04), rgba(217, 70, 239, 0.02));
    border-bottom: 1px solid rgba(139, 92, 246, 0.06);
}

.team-edit-card__avatar {
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, #a855f7, #d946ef);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; flex-shrink: 0;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.25);
    font-size: 1.5rem;
}

.team-edit-card__meta { flex: 1; min-width: 0; }
.team-edit-card__meta h3 { font-size: 1.1rem; font-weight: 600; color: #1a1025; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-edit-card__meta p { font-size: 0.8rem; color: #a855f7; }
.team-edit-card__actions { display: flex; gap: 6px; flex-shrink: 0; }
.team-edit-card__body { padding: 22px; }

/* ===== WORKS EDITOR ===== */
.works-edit-list { display: flex; flex-direction: column; gap: 16px; }

.works-edit-item {
    background: white;
    border: 1px solid rgba(139, 92, 246, 0.1);
    border-radius: 16px; overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.04);
}

.works-edit-item:hover { border-color: rgba(139, 92, 246, 0.2); }

/* FIX: Drag visual */
.works-edit-item[draggable="true"] { transition: opacity 0.2s, border-color 0.2s; }
.works-edit-item.drag-over { border-color: #a855f7 !important; border-top-width: 3px; background: rgba(139, 92, 246, 0.02); }

.works-edit-item__header {
    display: flex; align-items: center; gap: 16px;
    padding: 18px 22px; cursor: pointer;
    transition: background 0.2s;
}

.works-edit-item__header:hover { background: rgba(139, 92, 246, 0.02); }

.works-edit-item__info { flex: 1; min-width: 0; }
.works-edit-item__title { font-size: 1rem; font-weight: 600; color: #1a1025; }
.works-edit-item__subtitle { font-size: 0.8rem; color: #9ca3af; margin-top: 2px; }
.works-edit-item__meta { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.works-edit-item__count { padding: 4px 14px; background: rgba(139, 92, 246, 0.06); border-radius: 100px; font-size: 0.78rem; font-weight: 600; color: #a855f7; }
.works-edit-item__body { display: none; padding: 0 22px 22px; border-top: 1px solid rgba(139, 92, 246, 0.06); }
.works-edit-item__body.open { display: block; padding-top: 22px; animation: pageIn 0.3s ease; }

/* ===== PHOTO UPLOAD ===== */
.photo-upload {
    display: flex; flex-direction: column; align-items: center;
    gap: 16px; padding: 24px;
    border: 2px dashed rgba(139, 92, 246, 0.2);
    border-radius: 16px;
    transition: all 0.3s ease; cursor: pointer;
    text-align: center;
    background: rgba(139, 92, 246, 0.02);
}

.photo-upload:hover { border-color: #a855f7; background: rgba(139, 92, 246, 0.04); }
.photo-upload.dragover { border-color: #a855f7; background: rgba(139, 92, 246, 0.08); transform: scale(1.01); }

.photo-upload__preview {
    width: 100px; height: 100px;
    border-radius: 50%; background: #faf5ff;
    border: 2px solid rgba(139, 92, 246, 0.15);
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem;
}

.photo-upload__preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-upload__text { font-size: 0.85rem; color: #9ca3af; }
.photo-upload__text strong { color: #a855f7; }
.photo-upload input[type="file"] { display: none; }

/* ===== MEMBER WORKS ===== */
.member-works-grid { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.member-work-thumb { width: 80px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.member-work-thumb img { width: 80px; height: 60px; object-fit: cover; border-radius: 8px; border: 1px solid rgba(139, 92, 246, 0.1); }
.member-work-thumb span { font-size: 0.65rem; color: #9ca3af; text-align: center; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 80px; }

/* ===== PORTFOLIO PAGE ===== */
.portfolio-categories { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }

.portfolio-cat-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 24px; background: white;
    border: 2px solid rgba(139, 92, 246, 0.12);
    border-radius: 16px; cursor: pointer;
    transition: all 0.3s ease;
    font-family: "Poppins", sans-serif;
    font-size: 0.9rem; font-weight: 500; color: #4a3f5c;
}

.portfolio-cat-btn:hover { border-color: rgba(139, 92, 246, 0.3); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(139, 92, 246, 0.12); }

.portfolio-cat-btn.active {
    background: linear-gradient(135deg, #9333ea, #d946ef);
    border-color: transparent; color: white;
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.4);
}

.portfolio-cat-btn__count { padding: 2px 10px; background: rgba(139, 92, 246, 0.1); border-radius: 100px; font-size: 0.75rem; font-weight: 700; color: #7c3aed; }
.portfolio-cat-btn.active .portfolio-cat-btn__count { background: rgba(255, 255, 255, 0.25); color: white; }

.portfolio-workspace { min-height: 300px; }

.portfolio-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 16px; padding: 80px 20px; text-align: center; color: #9ca3af;
    border: 2px dashed rgba(139, 92, 246, 0.15); border-radius: 20px;
}

.portfolio-grid-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }

.portfolio-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }

.portfolio-photo-card {
    position: relative; border-radius: 16px;
    overflow: hidden; background: white;
    border: 2px solid rgba(139, 92, 246, 0.1);
    transition: all 0.3s ease; cursor: pointer;
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.06);
}

.portfolio-photo-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
}

/* FIX: Selected state */
.portfolio-photo-card.selected {
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2), 0 12px 32px rgba(139, 92, 246, 0.15);
}

.portfolio-photo-card.selected::after {
    content: '✓';
    position: absolute; top: 8px; left: 8px;
    width: 24px; height: 24px;
    background: #a855f7; color: white;
    border-radius: 50%; font-size: 0.75rem;
    display: flex; align-items: center; justify-content: center;
    z-index: 5;
}

.portfolio-photo-card__img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover; display: block;
}

@supports not (aspect-ratio: 4/3) {
    .portfolio-photo-card__img { padding-top: 75%; height: 0; }
}

.portfolio-photo-card__info { padding: 12px; }
.portfolio-photo-card__name { font-size: 0.85rem; font-weight: 600; color: #1a1025; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portfolio-photo-card__meta { font-size: 0.75rem; color: #9ca3af; }

/* FIX: Always show checkbox, not just on hover */
.portfolio-photo-card__actions {
    position: absolute; top: 8px; right: 8px;
    display: flex; gap: 4px;
    z-index: 5;
}

/* ===== MODAL (FIXED z-index) ===== */
.admin-modal {
    position: fixed; inset: 0;
    z-index: 5000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    opacity: 0; visibility: hidden;
    transition: all 0.3s ease;
}

.admin-modal.open { opacity: 1; visibility: visible; }

.admin-modal__backdrop {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

@supports (backdrop-filter: blur(8px)) {
    .admin-modal__backdrop { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
}

.admin-modal__container {
    position: relative; width: 100%;
    max-width: 560px; max-height: 85vh;
    overflow-y: auto; background: white;
    border: 1px solid rgba(139, 92, 246, 0.12);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(139, 92, 246, 0.2);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s ease;
}

.admin-modal.open .admin-modal__container { transform: translateY(0) scale(1); }

.admin-modal__header { display: flex; align-items: center; justify-content: space-between; padding: 22px 26px; border-bottom: 1px solid rgba(139, 92, 246, 0.08); }
.admin-modal__title { font-size: 1.2rem; font-weight: 600; color: #1a1025; }
.admin-modal__close { background: none; border: none; color: #9ca3af; cursor: pointer; padding: 6px; border-radius: 8px; transition: all 0.2s; display: flex; }
.admin-modal__close:hover { background: rgba(239, 68, 68, 0.06); color: #ef4444; }
.admin-modal__body { padding: 26px; }
.admin-modal__footer { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 26px; border-top: 1px solid rgba(139, 92, 246, 0.08); flex-wrap: wrap; }

/* ===== PHOTO EDITOR ===== */
.pe-canvas-area {
    background: #f0ecf5; padding: 20px;
    display: flex; align-items: center; justify-content: center;
    min-height: 300px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.08);
}

.pe-canvas-wrap {
    position: relative; display: inline-block;
    border-radius: 8px; overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.pe-canvas-wrap canvas { display: block; max-width: 100%; max-height: 400px; }

.pe-crop-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 10; }
.pe-crop-box {
    position: absolute; top: 10%; left: 10%; width: 80%; height: 80%;
    border: 2px solid white;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    cursor: move; z-index: 11;
}

.pe-crop-box::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(to right, rgba(255,255,255,0.3) 1px, transparent 1px),
                linear-gradient(to bottom, rgba(255,255,255,0.3) 1px, transparent 1px);
    background-size: 33.33% 33.33%;
}

.pe-crop-handle { position: absolute; width: 16px; height: 16px; background: white; border: 2px solid #9333ea; border-radius: 50%; z-index: 12; }
.pe-crop-handle--nw { top: -8px; left: -8px; cursor: nw-resize; }
.pe-crop-handle--ne { top: -8px; right: -8px; cursor: ne-resize; }
.pe-crop-handle--sw { bottom: -8px; left: -8px; cursor: sw-resize; }
.pe-crop-handle--se { bottom: -8px; right: -8px; cursor: se-resize; }

.pe-toolbar {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 20px; background: white;
    border-bottom: 1px solid rgba(139, 92, 246, 0.08);
    flex-wrap: wrap;
}

.pe-toolbar__group { display: flex; gap: 6px; padding-right: 12px; border-right: 1px solid rgba(139, 92, 246, 0.1); flex-wrap: wrap; }
.pe-toolbar__group:last-of-type { border-right: none; }

.pe-tool {
    display: flex; align-items: center; gap: 5px;
    padding: 8px 14px; background: #faf5ff;
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 10px; color: #6b7280;
    font-size: 0.8rem; cursor: pointer;
    transition: all 0.2s ease;
    font-family: "Poppins", sans-serif;
    white-space: nowrap;
}

.pe-tool:hover { border-color: #a855f7; color: #7c3aed; background: rgba(139, 92, 246, 0.08); }
.pe-tool.active { background: linear-gradient(135deg, #9333ea, #d946ef); border-color: transparent; color: white; }
.pe-tool--filter { padding: 6px 12px; font-size: 0.75rem; }
.pe-tool--reset { margin-left: auto; border-color: rgba(239, 68, 68, 0.2); color: #ef4444; background: white; }
.pe-tool--reset:hover { border-color: #ef4444; background: rgba(239, 68, 68, 0.05); }

.pe-sliders {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 12px 20px; padding: 16px 24px;
    background: #faf5ff;
    border-bottom: 1px solid rgba(139, 92, 246, 0.08);
}

.pe-slider label { display: flex; justify-content: space-between; font-size: 0.78rem; font-weight: 500; color: #6b7280; margin-bottom: 4px; }
.pe-slider label span { font-family: "Space Grotesk", monospace; color: #7c3aed; font-weight: 600; }

.pe-slider input[type="range"] {
    width: 100%; height: 6px;
    -webkit-appearance: none; appearance: none;
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.15), rgba(139, 92, 246, 0.3));
    border-radius: 10px; outline: none;
}

.pe-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    background: linear-gradient(135deg, #9333ea, #d946ef);
    border-radius: 50%; cursor: pointer;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

.pe-slider input[type="range"]::-moz-range-thumb {
    width: 18px; height: 18px; border: none;
    background: linear-gradient(135deg, #9333ea, #d946ef);
    border-radius: 50%; cursor: pointer;
}

/* ===== SPIN ANIMATION (for save button) ===== */
.spin-icon { animation: adminSpin 1s linear infinite; }
@keyframes adminSpin { to { transform: rotate(360deg); } }

/* ===== UNSAVED INDICATOR ===== */
.topbar__unsaved {
    display: none; padding: 4px 12px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 100px;
    font-size: 0.7rem; font-weight: 600; color: #f59e0b;
    animation: unsavedPulse 2s ease-in-out infinite;
    white-space: nowrap;
}

.topbar__unsaved.visible { display: flex; align-items: center; gap: 4px; }

@keyframes unsavedPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ===== SEARCH ===== */
.portfolio-search { display: flex; gap: 8px; margin-bottom: 16px; }
.portfolio-search input { flex: 1; }

/* ===== IMPORT AREA ===== */
.import-area { display: none; margin-top: 12px; padding: 16px; border: 2px dashed rgba(139, 92, 246, 0.2); border-radius: 12px; }
.import-area.visible { display: block; }

/* ===== PREVIEW FRAME ===== */
.preview-frame { width: 100%; height: 500px; border: 1px solid rgba(139, 92, 246, 0.1); border-radius: 12px; background: white; }

/* ===== LAST SAVED ===== */
.topbar__last-saved { font-size: 0.7rem; color: #9ca3af; margin-top: 2px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .topbar__burger { display: flex; }
    .team-edit-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .content-area { padding: 20px 16px; }
    .topbar { padding: 12px 16px; }
    .topbar__title { font-size: 1.1rem; }
    .topbar__status { display: none; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .login-card { margin: 16px; padding: 36px 28px; }
    .pe-sliders { grid-template-columns: 1fr; }
    .pe-toolbar { justify-content: center; }
    .pe-toolbar__group { border-right: none; padding-right: 0; }
    .pe-tool--reset { margin-left: 0; width: 100%; justify-content: center; }
    .portfolio-photo-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .portfolio-categories { gap: 8px; }
    .portfolio-cat-btn { padding: 10px 16px; font-size: 0.8rem; }
    .admin-modal__container { max-width: 95vw; max-height: 95vh; }
    .admin-theme-toggle span { display: none; }
    .toast-container { right: 10px; left: 10px; }
    .toast { min-width: auto; max-width: 100%; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .topbar__right { gap: 6px; }
    .topbar__btn span { display: none; }
    .topbar__btn { padding: 10px; }
    .team-edit-card__header { flex-wrap: wrap; gap: 10px; }
    .team-edit-card__actions { margin-left: 0; width: 100%; justify-content: flex-end; }
    .portfolio-photo-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .pe-toolbar__group { width: 100%; justify-content: center; }
    .pe-canvas-wrap canvas { max-height: 250px; }
}