/* YoungEd Media - Admin Dashboard Stylesheet */
/* Design System aligned with YoungEd Portal */

@import url('https://fonts.googleapis.com/css2?family=Zalando+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400;1,500;1,600;1,700;1,800&display=swap');

:root {
    /* Brand Colors */
    --brand-blue: #0D7BB6;
    --brand-blue-light: #4d9dc9;
    --brand-blue-dark: #0a6292;
    --brand-green: #4EA72E;
    --brand-green-light: #6eb850;
    --brand-green-dark: #3e8625;

    /* Slate Color Palette */
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --slate-950: #020617;

    /* Semantic Colors */
    --primary: var(--brand-blue);
    --primary-dark: var(--brand-blue-dark);
    --primary-light: var(--brand-blue-light);
    --secondary: var(--brand-green);
    --dark: var(--slate-900);
    --white: #ffffff;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --info: #3b82f6;

    /* Legacy Gray Mappings */
    --gray-900: var(--slate-900);
    --gray-800: var(--slate-800);
    --gray-700: var(--slate-700);
    --gray-600: var(--slate-600);
    --gray-500: var(--slate-500);
    --gray-400: var(--slate-400);
    --gray-300: var(--slate-300);
    --gray-200: var(--slate-200);
    --gray-100: var(--slate-100);
    --gray-50: var(--slate-50);

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-blue: 0 10px 40px -10px rgba(13, 123, 182, 0.3);

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.625rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;

    /* Layout */
    --sidebar-width: 260px;
}

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

body {
    font-family: 'Zalando Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--slate-100);
    color: var(--slate-800);
    line-height: 1.6;
}

a {
    color: var(--brand-blue);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--brand-blue-dark);
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--slate-900);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--slate-800);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--white);
    font-size: 1.25rem;
    font-weight: 700;
}

.sidebar-brand-sub {
    font-size: 0.75rem;
    color: var(--slate-400);
    font-weight: 400;
}

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

.nav-section {
    padding: 8px 24px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--slate-500);
    letter-spacing: 0.05em;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--slate-400);
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover {
    background: var(--slate-800);
    color: var(--white);
}

.nav-item.active {
    background: var(--brand-blue);
    color: var(--white);
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: var(--white);
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 24px;
    border-top: 1px solid var(--slate-800);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--brand-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
}

.sidebar-user-info {
    flex: 1;
}

.sidebar-user-name {
    color: var(--white);
    font-weight: 500;
    font-size: 0.875rem;
}

.sidebar-user-role {
    color: var(--slate-500);
    font-size: 0.75rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
}

/* Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--slate-900);
}

.page-subtitle {
    color: var(--slate-500);
    margin-top: 4px;
}

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

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

.stat-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, transform 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.stat-card-label {
    font-size: 0.875rem;
    color: var(--slate-500);
    font-weight: 500;
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card-icon.blue {
    background: rgba(13, 123, 182, 0.1);
    color: var(--brand-blue);
}

.stat-card-icon.green {
    background: rgba(78, 167, 46, 0.1);
    color: var(--brand-green);
}

.stat-card-icon.yellow {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-card-icon.purple {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--slate-900);
}

.stat-card-change {
    font-size: 0.875rem;
    margin-top: 4px;
}

.stat-card-change.positive {
    color: var(--success);
}

.stat-card-change.negative {
    color: var(--danger);
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

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

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--slate-900);
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--slate-200);
    background: var(--slate-50);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

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

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

thead {
    background: var(--slate-50);
}

th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--slate-500);
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--slate-200);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--slate-100);
    font-size: 0.875rem;
}

tr:hover {
    background: var(--slate-50);
}

.table-title {
    font-weight: 600;
    color: var(--slate-900);
}

.table-subtitle {
    color: var(--slate-500);
    font-size: 0.75rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-info {
    background: rgba(13, 123, 182, 0.1);
    color: var(--brand-blue);
}

.badge-gray {
    background: var(--slate-100);
    color: var(--slate-600);
}

.badge-primary {
    background: rgba(13, 123, 182, 0.1);
    color: var(--brand-blue);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: inherit;
}

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

.btn-primary:hover {
    background: var(--brand-blue-dark);
    box-shadow: var(--shadow-blue);
}

.btn-secondary {
    background: var(--slate-200);
    color: var(--slate-700);
}

.btn-secondary:hover {
    background: var(--slate-300);
}

.btn-success {
    background: var(--brand-green);
    color: var(--white);
}

.btn-success:hover {
    background: var(--brand-green-dark);
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--slate-300);
    color: var(--slate-700);
}

.btn-outline:hover {
    background: var(--slate-100);
    border-color: var(--slate-400);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--slate-700);
    margin-bottom: 8px;
}

.form-label .required {
    color: var(--danger);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--slate-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--white);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(13, 123, 182, 0.15);
}

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

.form-hint {
    font-size: 0.75rem;
    color: var(--slate-500);
    margin-top: 6px;
}

.form-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 6px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--brand-blue);
}

/* Rich Text Editor Placeholder */
.editor-container {
    border: 1px solid var(--slate-300);
    border-radius: var(--radius);
    overflow: hidden;
}

.editor-toolbar {
    display: flex;
    gap: 4px;
    padding: 10px;
    background: var(--slate-50);
    border-bottom: 1px solid var(--slate-200);
    flex-wrap: wrap;
}

.editor-toolbar button {
    padding: 6px 10px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    color: var(--slate-600);
    transition: all 0.2s;
}

.editor-toolbar button:hover {
    background: var(--slate-200);
}

.editor-toolbar button.active {
    background: var(--brand-blue);
    color: var(--white);
}

.editor-content {
    min-height: 300px;
    padding: 16px;
    outline: none;
}

/* Filters Bar */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--slate-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(13, 123, 182, 0.15);
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--slate-400);
    width: 18px;
    height: 18px;
}

/* Actions */
.actions-cell {
    display: flex;
    gap: 8px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.2s;
    box-shadow: var(--shadow-xl);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--slate-900);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--slate-100);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--slate-500);
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--slate-200);
    color: var(--slate-700);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--slate-200);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

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

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-warning {
    border-left: 4px solid var(--warning);
}

.toast-info {
    border-left: 4px solid var(--brand-blue);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--slate-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--slate-400);
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--slate-900);
    margin-bottom: 8px;
}

.empty-state-text {
    color: var(--slate-500);
    margin-bottom: 24px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination button {
    padding: 8px 14px;
    border: 1px solid var(--slate-300);
    background: var(--white);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled),
.pagination button.active {
    background: var(--brand-blue);
    color: var(--white);
    border-color: var(--brand-blue);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-dark) 100%);
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-xl);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--brand-blue);
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--slate-500);
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-btn {
    width: 100%;
    padding: 14px;
    margin-top: 8px;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
    background: var(--white);
    border-radius: var(--radius-xl);
    border: 1px solid var(--slate-200);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.quick-action:hover {
    border-color: var(--brand-blue);
    box-shadow: var(--shadow-blue);
    transform: translateY(-2px);
}

.quick-action-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 123, 182, 0.1);
    color: var(--brand-blue);
}

.quick-action-label {
    font-weight: 600;
    color: var(--slate-700);
}

/* Newsletter Preview */
.newsletter-preview {
    border: 1px solid var(--slate-300);
    border-radius: var(--radius);
    padding: 24px;
    background: var(--slate-50);
    max-height: 400px;
    overflow-y: auto;
}

.newsletter-preview h1 {
    font-size: 1.5rem;
    margin-bottom: 16px;
    color: var(--slate-900);
}

.newsletter-preview p {
    margin-bottom: 12px;
    color: var(--slate-700);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--slate-200);
    margin-bottom: 24px;
}

.tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--slate-500);
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
    font-family: inherit;
}

.tab:hover {
    color: var(--slate-700);
}

.tab.active {
    color: var(--brand-blue);
    border-bottom-color: var(--brand-blue);
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--slate-100);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon.blue {
    background: rgba(13, 123, 182, 0.1);
    color: var(--brand-blue);
}

.activity-icon.green {
    background: rgba(78, 167, 46, 0.1);
    color: var(--brand-green);
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 500;
    color: var(--slate-900);
    margin-bottom: 4px;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--slate-500);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }
}

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

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .header-actions {
        width: 100%;
    }

    .filters-bar {
        flex-direction: column;
    }

    .search-box {
        width: 100%;
    }
}

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

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