:root {
    --admin-sidebar-width: 280px;
    --admin-header-height: 70px;
    --admin-primary: #6366f1;
    /* Indigo 500 - More premium than purple */
    --admin-primary-dark: #4f46e5;
    --admin-primary-light: #e0e7ff;
    --admin-bg: #f3f4f6;
    /* Cool Gray 100 */
    --admin-surface: #ffffff;
    --admin-border: #e5e7eb;
    --admin-text: #1f2937;
    /* Gray 800 */
    --admin-text-muted: #6b7280;
    /* Gray 500 */
    --admin-success: #10b981;
    --admin-error: #ef4444;
    --admin-warning: #f59e0b;
    --admin-info: #3b82f6;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

.admin-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--admin-bg);
    color: var(--admin-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

/* Sidebar */
.admin-sidebar {
    width: var(--admin-sidebar-width);
    background: var(--admin-surface);
    border-right: 1px solid var(--admin-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.admin-logo {
    height: var(--admin-header-height);
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--admin-text);
    letter-spacing: -0.025em;
}

.admin-logo-image {
    width: auto;
    object-fit: contain;
}

.logo-subtitle {
    font-size: 0.75rem;
    color: var(--admin-primary);
    background: var(--admin-primary-light);
    padding: 2px 8px;
    border-radius: 9999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--admin-border) transparent;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-section-title {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--admin-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    padding-left: 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    color: var(--admin-text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 0.5rem;
    position: relative;
}

.nav-item:hover {
    background: var(--admin-bg);
    color: var(--admin-text);
}

.nav-item.active {
    background: var(--admin-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.nav-item.active .nav-badge {
    background: white;
    color: var(--admin-primary);
    box-shadow: none;
}

.nav-item i {
    width: 20px;
    height: 20px;
    stroke-width: 2px;
}

.nav-badge {
    margin-left: auto;
    background: var(--admin-error);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    min-width: 20px;
    text-align: center;
}

/* Submenus */
.nav-group .nav-item {
    cursor: pointer;
}

.submenu-icon {
    margin-left: auto;
    width: 16px !important;
    height: 16px !important;
    transition: transform 0.2s ease;
}

.nav-submenu {
    padding-left: 1rem;
    margin-top: 0.25rem;
    position: relative;
}

.nav-submenu::before {
    content: '';
    position: absolute;
    left: 1.6rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--admin-border);
}

.nav-subitem {
    display: block;
    padding: 0.5rem 0.75rem 0.5rem 1.5rem;
    color: var(--admin-text-muted);
    text-decoration: none;
    font-size: 0.825rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    position: relative;
    margin-bottom: 2px;
}

.nav-subitem:hover {
    color: var(--admin-primary);
    background: var(--admin-bg);
}

.nav-subitem.active {
    color: var(--admin-primary);
    font-weight: 600;
    background: var(--admin-primary-light);
}

.admin-sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--admin-border);
}

.nav-item-danger:hover {
    background: #fef2f2;
    color: var(--admin-error);
}

/* Main Content */
.admin-main {
    margin-left: var(--admin-sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-header {
    height: var(--admin-header-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 900;
}

.admin-page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--admin-text);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--admin-text);
    border-radius: 0.5rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
    background: var(--admin-bg);
    color: var(--admin-primary);
}

.mobile-menu-toggle i {
    width: 22px;
    height: 22px;
}

/* Search */
.search-box input {
    width: 320px;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    border: 1px solid var(--admin-border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: var(--admin-bg);
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    background: white;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px var(--admin-primary-light);
}

/* User Menu & Notifications */
.admin-user-wrapper {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 2rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
}

.admin-user:hover,
.admin-user.active {
    background: white;
    border-color: var(--admin-border);
    box-shadow: var(--shadow-sm);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--admin-primary-light);
    color: var(--admin-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar i {
    width: 20px;
    height: 20px;
}

.user-info {
    display: flex;
    flex-direction: column;
    margin-right: 0.5rem;
}

.admin-username {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--admin-text);
    line-height: 1.2;
}

.admin-role {
    font-size: 0.75rem;
    color: var(--admin-text-muted);
}

.user-chevron {
    width: 16px;
    height: 16px;
    color: var(--admin-text-muted);
    transition: transform 0.2s ease;
}

.admin-user.active .user-chevron {
    transform: rotate(180deg);
}

.user-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 240px;
    background: white;
    border: 1px solid var(--admin-border);
    box-shadow: var(--shadow-lg);
    border-radius: 0.75rem;
    padding: 0.5rem;
    display: none;
    z-index: 1000;
    animation: slideIn 0.2s ease;
}

.user-menu.active {
    display: block;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    color: var(--admin-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.user-menu-item:hover {
    background: var(--admin-bg);
    color: var(--admin-primary);
}

.user-menu-item i {
    width: 18px;
    height: 18px;
}

.user-menu-divider {
    height: 1px;
    background: var(--admin-border);
    margin: 0.5rem 0;
}

.user-menu-item-danger {
    color: var(--admin-error);
}

.user-menu-item-danger:hover {
    background: #fef2f2;
    color: var(--admin-error);
}

/* Notifications */
.admin-notifications {
    position: relative;
}

.notification-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--admin-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.notification-btn:hover {
    background: white;
    border-color: var(--admin-border);
    color: var(--admin-primary);
    box-shadow: var(--shadow-sm);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--admin-error);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0 0.35rem;
    border-radius: 9999px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: -80px;
    width: 320px;
    background: white;
    border: 1px solid var(--admin-border);
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 1000;
    overflow: hidden;
    animation: slideIn 0.2s ease;
}

.notification-dropdown.active {
    display: block;
}

.notification-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--admin-bg);
}

.notification-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--admin-text);
}

.notif-count-label {
    font-size: 0.75rem;
    color: var(--admin-primary);
    font-weight: 600;
    background: var(--admin-primary-light);
    padding: 0.15rem 0.6rem;
    border-radius: 9999px;
}

.notification-list {
    max-height: 350px;
    overflow-y: auto;
    padding: 0.5rem;
}

.notification-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--admin-text-muted);
}

.notification-empty i {
    width: 32px;
    height: 32px;
    margin-bottom: 0.5rem;
    opacity: 0.4;
}

.notification-empty p {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.notification-empty span {
    font-size: 0.8rem;
}

.notif-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    text-decoration: none;
    transition: all 0.2s ease;
    color: var(--admin-text);
}

.notif-item:hover {
    background: var(--admin-bg);
}

.notif-icon {
    width: 38px;
    height: 38px;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notif-icon i {
    width: 18px;
    height: 18px;
}

.notif-icon-info {
    background: #dbeafe;
    color: var(--admin-info);
}

.notif-icon-warning {
    background: #fef3c7;
    color: var(--admin-warning);
}

.notif-icon-success {
    background: #d1fae5;
    color: var(--admin-success);
}

.notif-icon-error {
    background: #fee2e2;
    color: var(--admin-error);
}

.notif-content {
    flex: 1;
    min-width: 0;
}

.notif-message {
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--admin-text);
    line-height: 1.3;
    margin: 0;
}

.notif-time {
    font-size: 0.7rem;
    color: var(--admin-text-muted);
}

.notif-arrow {
    width: 16px;
    height: 16px;
    color: var(--admin-text-muted);
    opacity: 0;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.notif-item:hover .notif-arrow {
    opacity: 1;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Content Area */
.admin-content {
    flex: 1;
    padding: 2rem;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

/* Cards & Stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--admin-surface);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--admin-primary-light);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon i {
    width: 28px;
    height: 28px;
}

/* Variant colors */
.stat-icon-primary {
    background: var(--admin-primary-light);
    color: var(--admin-primary);
}

.stat-icon-success {
    background: #d1fae5;
    color: var(--admin-success);
}

.stat-icon-warning {
    background: #fef3c7;
    color: var(--admin-warning);
}

.stat-icon-info {
    background: #dbeafe;
    color: var(--admin-info);
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 800;
    color: var(--admin-text);
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--admin-text-muted);
}

.stat-sublabel {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.stat-growth-up {
    color: var(--admin-success);
}

.stat-growth-down {
    color: var(--admin-error);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-card {
    background: var(--admin-surface);
    border-radius: 1rem;
    border: 1px solid var(--admin-border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.dashboard-card-large {
    grid-column: span 8;
}

.dashboard-card-medium {
    grid-column: span 6;
}

.dashboard-card-small {
    grid-column: span 4;
}

@media (max-width: 1200px) {

    .dashboard-card-large,
    .dashboard-card-medium,
    .dashboard-card-small {
        grid-column: span 12;
    }
}

.card-link {
    font-size: 0.875rem;
    color: var(--admin-primary);
    text-decoration: none;
    font-weight: 500;
}

.card-link:hover {
    text-decoration: underline;
}

/* Empty States */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    color: var(--admin-text-muted);
}

.empty-icon {
    width: 64px;
    height: 64px;
    background: var(--admin-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--admin-text-muted);
}

.empty-icon i {
    width: 32px;
    height: 32px;
}

.empty-state p {
    font-weight: 600;
    color: var(--admin-text);
    margin-bottom: 0.25rem;
}

.empty-subtitle {
    font-size: 0.875rem;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--admin-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-content {
    padding: 1.5rem;
    flex: 1;
}

/* Tables in cards (Top Pages etc) */
.top-page-item {
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: var(--admin-bg);
    border: 1px solid transparent;
}

.page-rank {
    width: 28px;
    height: 28px;
    border-radius: 0.375rem;
    background: var(--admin-text);
    color: white;
    font-size: 0.75rem;
}

/* Activity Feed */
.activity-item {
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--admin-border);
    background: white;
}

.activity-item:hover {
    border-color: var(--admin-primary-light);
    background: var(--admin-bg);
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--admin-bg);
    color: var(--admin-text-muted);
}

/* Mobile */
@media (max-width: 1024px) {
    .admin-sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

    .admin-sidebar.active {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

    .mobile-menu-toggle {
        display: block;
    }
}

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

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--admin-text);
    margin-bottom: 0.25rem;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--admin-text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: var(--admin-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--admin-primary-dark);
}

.btn-outline {
    background: white;
    border-color: var(--admin-border);
    color: var(--admin-text);
}

.btn-outline:hover {
    background: var(--admin-bg);
    border-color: var(--admin-text-muted);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    color: var(--admin-text-muted);
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-icon:hover {
    background: var(--admin-bg);
    color: var(--admin-primary);
}

.btn-icon-danger:hover {
    background: #fef2f2;
    color: var(--admin-error);
}

/* Forms */
.admin-form {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.admin-card {
    background: var(--admin-surface);
    border-radius: 1rem;
    border: 1px solid var(--admin-border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--admin-text);
    margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid var(--admin-border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: white;
    transition: all 0.2s;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px var(--admin-primary-light);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-help {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: var(--admin-text-muted);
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    background: var(--admin-bg);
    border: 1px solid var(--admin-border);
    border-right: none;
    border-radius: 0.5rem 0 0 0.5rem;
    color: var(--admin-text-muted);
}

.input-group .form-input {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--admin-text);
}

/* File Upload */
.file-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-upload-input {
    display: none;
}

.file-upload-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--admin-bg);
    border: 1px solid var(--admin-border);
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.file-upload-button:hover {
    background: var(--admin-border);
}

.file-upload-name {
    font-size: 0.875rem;
    color: var(--admin-text-muted);
}

/* Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.admin-table th {
    background: var(--admin-bg);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--admin-text-muted);
    border-bottom: 1px solid var(--admin-border);
    white-space: nowrap;
}

.admin-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--admin-border);
    color: var(--admin-text);
    vertical-align: middle;
}

.admin-table tr:hover td {
    background: var(--admin-bg);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-top: 1px solid var(--admin-border);
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--admin-text-muted);
}

.pagination-controls {
    display: flex;
    gap: 0.5rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid transparent;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
}

.alert-close:hover {
    opacity: 1;
}

/* Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--admin-bg);
    border-top: 1px solid var(--admin-border);
    border-radius: 0 0 1rem 1rem;
}

/* ========================================= */
/* Dashboard Redesign                        */
/* ========================================= */

/* Welcome Header */
.dashboard-welcome {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding: 1.75rem 2rem;
    background: linear-gradient(135deg, var(--admin-primary) 0%, var(--admin-primary-dark) 100%);
    border-radius: 1rem;
    color: white;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.25);
}

.welcome-title {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.welcome-title i {
    width: 28px;
    height: 28px;
    opacity: 0.85;
}

.welcome-subtitle {
    font-size: 0.9rem;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.ga4-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

.ga4-badge i {
    width: 14px;
    height: 14px;
}

.welcome-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    opacity: 0.8;
    white-space: nowrap;
    margin-top: 0.25rem;
}

.welcome-date i {
    width: 16px;
    height: 16px;
}

@media (max-width: 768px) {
    .dashboard-welcome {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* Section Headers */
.dashboard-section-header {
    margin-bottom: 1rem;
    margin-top: 0.5rem;
}

.dashboard-section-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--admin-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--admin-border);
}

.dashboard-section-header h2 i {
    width: 20px;
    height: 20px;
    color: var(--admin-primary);
}

/* 4-column stat grid */
.dashboard-stats-4 {
    grid-template-columns: repeat(4, 1fr);
}

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

@media (max-width: 640px) {
    .dashboard-stats-4 {
        grid-template-columns: 1fr;
    }
}

/* Stat link arrow */
.stat-link {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--admin-bg);
    color: var(--admin-text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
}

.stat-link:hover {
    background: var(--admin-primary-light);
    color: var(--admin-primary);
}

.stat-link i {
    width: 16px;
    height: 16px;
}

/* Sublabel variants */
.stat-sublabel-new {
    color: var(--admin-success);
    font-weight: 600;
}

.stat-sublabel-alert {
    color: var(--admin-warning);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-sublabel-alert i {
    width: 12px;
    height: 12px;
}

/* Top Pages – improved */
.top-pages-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.top-page-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    background: var(--admin-bg);
    transition: all 0.15s ease;
}

.top-page-item:hover {
    background: var(--admin-primary-light);
}

.page-rank {
    width: 28px;
    height: 28px;
    border-radius: 0.375rem;
    background: var(--admin-text);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.page-info {
    flex: 1;
    min-width: 0;
}

.page-title-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--admin-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-url-path {
    font-size: 0.7rem;
    color: var(--admin-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-views-count {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--admin-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.page-views-count small {
    font-weight: 500;
    font-size: 0.7rem;
    color: var(--admin-text-muted);
    margin-left: 2px;
}

/* Activity Feed – improved */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--admin-border);
    background: white;
    text-decoration: none;
    transition: all 0.15s ease;
}

.activity-item:hover {
    border-color: var(--admin-primary-light);
    background: var(--admin-bg);
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--admin-bg);
    color: var(--admin-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon i {
    width: 18px;
    height: 18px;
}

.activity-icon-contact {
    background: #dbeafe;
    color: var(--admin-info);
}

.activity-icon-newsletter {
    background: #d1fae5;
    color: var(--admin-success);
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-message {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--admin-text);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-time {
    font-size: 0.7rem;
    color: var(--admin-text-muted);
}

.activity-arrow {
    width: 16px;
    height: 16px;
    color: var(--admin-text-muted);
    flex-shrink: 0;
}

/* Quick Actions Grid */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

@media (max-width: 640px) {
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 0.75rem;
    border-radius: 0.75rem;
    border: 1px solid var(--admin-border);
    background: white;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: center;
}

.quick-action:hover {
    border-color: var(--admin-primary);
    background: var(--admin-primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.quick-action span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--admin-text);
}

.qa-icon {
    width: 42px;
    height: 42px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qa-icon i {
    width: 22px;
    height: 22px;
}

.qa-icon-primary {
    background: var(--admin-primary-light);
    color: var(--admin-primary);
}

.qa-icon-success {
    background: #d1fae5;
    color: var(--admin-success);
}

.qa-icon-info {
    background: #dbeafe;
    color: var(--admin-info);
}

.qa-icon-warning {
    background: #fef3c7;
    color: var(--admin-warning);
}

.qa-icon-muted {
    background: var(--admin-bg);
    color: var(--admin-text-muted);
}

/* System Info List */
.system-info-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sys-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--admin-border);
}

.sys-info-row:last-child {
    border-bottom: none;
}

.sys-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--admin-text-muted);
    font-weight: 500;
}

.sys-label i {
    width: 16px;
    height: 16px;
}

.sys-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--admin-text);
}

.sys-value-success {
    color: var(--admin-success);
}

.sys-meta {
    font-weight: 400;
    color: var(--admin-text-muted);
    margin-left: 4px;
}

/* ================================ */
/* Sidebar Overlay (Mobile)         */
/* ================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease;
    opacity: 0;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ================================ */
/* Responsive - Tablet & Mobile     */
/* ================================ */
@media (max-width: 1024px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .admin-main {
        margin-left: 0;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .admin-header {
        padding: 0 1rem;
    }

    .admin-content {
        padding: 1rem;
    }

    .user-info {
        display: none;
    }

    .user-chevron {
        display: none;
    }

    .admin-user {
        padding: 0.5rem;
    }

    .notification-dropdown {
        right: -120px;
        width: 300px;
    }

    .dashboard-stats-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 640px) {
    .admin-page-title {
        font-size: 1rem;
        max-width: 160px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .dashboard-stats-4 {
        grid-template-columns: 1fr !important;
    }

    .quick-actions-grid {
        grid-template-columns: 1fr !important;
    }

    .notification-dropdown {
        position: fixed;
        top: var(--admin-header-height);
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 0 0 1rem 1rem;
    }

    .user-menu {
        position: fixed;
        top: var(--admin-header-height);
        right: 0;
        width: 100%;
        border-radius: 0 0 1rem 1rem;
    }

    .dashboard-grid .dashboard-card {
        grid-column: span 12 !important;
    }
}

/* ================================ */
/* Settings & Forms                 */
/* ================================ */
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.settings-card {
    background: var(--admin-surface);
    border-radius: 1rem;
    border: 1px solid var(--admin-border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.settings-card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--admin-border);
    background: var(--admin-bg);
}

.settings-card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--admin-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.settings-card-header h2 i {
    width: 20px;
    height: 20px;
    color: var(--admin-primary);
}

.settings-card-body {
    padding: 1.5rem;
}

/* Form Layouts */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-left: 0;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    width: 44px;
    height: 24px;
    background: #e5e7eb;
    border-radius: 999px;
    position: relative;
    transition: all 0.2s ease;
    display: inline-block;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--admin-primary);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--admin-text);
}