/**
 * OSK Łuczak - Admin Panel Styles
 */

/* ========================================
   CSS VARIABLES (Admin specific)
   ======================================== */
:root {
    --admin-sidebar-width: 260px;
    --admin-header-height: 64px;
    --admin-bg: #f8fafc;
    --admin-card-bg: #ffffff;
    --admin-border: #e2e8f0;
    --admin-text: #334155;
    --admin-text-muted: #64748b;
    --admin-primary: #1a56db;
    --admin-primary-hover: #1e40af;
    --admin-success: #22c55e;
    --admin-warning: #f59e0b;
    --admin-danger: #ef4444;
    --admin-info: #06b6d4;
}

/* ========================================
   BASE STYLES
   ======================================== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--admin-bg);
    color: var(--admin-text);
    line-height: 1.5;
}

/* ========================================
   LOGIN PAGE
   ======================================== */
.login-page {
    min-height: 100vh;
    display: none;
    /* Hidden by default to prevent flash */
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    padding: 20px;
}

.login-page.is-visible {
    display: flex;
}

.login-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(26, 86, 219, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(250, 204, 21, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.login-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo__icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--admin-primary) 0%, #2563eb 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: white;
}

.login-logo__title {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 4px;
}

.login-logo__subtitle {
    font-size: 14px;
    color: var(--admin-text-muted);
    margin: 0;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--admin-text);
}

.form-input {
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    background: white;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

.form-input::placeholder {
    color: #94a3b8;
}

.form-input--error {
    border-color: var(--admin-danger);
}

.form-error {
    font-size: 12px;
    color: var(--admin-danger);
    display: none;
}

.form-error.is-visible {
    display: block;
}

.login-btn {
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    color: white;
    background: linear-gradient(135deg, var(--admin-primary) 0%, #2563eb 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(26, 86, 219, 0.3);
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: wait;
    transform: none;
}

.login-alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    display: none;
}

.login-alert--error {
    background: #fef2f2;
    color: var(--admin-danger);
    border: 1px solid #fecaca;
}

.login-alert.is-visible {
    display: block;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--admin-border);
}

.login-footer__link {
    color: var(--admin-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.login-footer__link:hover {
    text-decoration: underline;
}

/* ========================================
   ADMIN LAYOUT
   ======================================== */
.admin-layout {
    display: none;
    min-height: 100vh;
}

.admin-layout.is-visible {
    display: flex;
}

/* Sidebar */
.admin-sidebar {
    width: var(--admin-sidebar-width);
    background: #0f172a;
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.admin-sidebar__header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-sidebar__logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

.admin-sidebar__logo:hover {
    opacity: 0.8;
}

.admin-sidebar__logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--admin-primary) 0%, #2563eb 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-sidebar__logo-text {
    font-size: 18px;
    font-weight: 700;
}

.admin-sidebar__nav {
    flex: 1;
    padding: 20px 12px;
    overflow-y: auto;
}

.admin-nav__section {
    margin-bottom: 24px;
}

.admin-nav__title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
    padding: 0 12px;
    margin-bottom: 8px;
}

.admin-nav__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
}

.admin-nav__link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.admin-nav__link.is-active {
    background: var(--admin-primary);
    color: white;
}

.admin-nav__link svg {
    flex-shrink: 0;
}

.admin-sidebar__footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-user__avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #0f172a;
}

.admin-user__info {
    flex: 1;
    min-width: 0;
}

.admin-user__name {
    font-size: 13px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-user__role {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.admin-user__logout {
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-user__logout:hover {
    background: var(--admin-danger);
    color: white;
}

/* Main Content */
.admin-main {
    flex: 1;
    margin-left: var(--admin-sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.admin-header {
    height: var(--admin-header-height);
    background: white;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.admin-header__title {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.admin-header__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-menu-btn {
    display: none;
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--admin-text);
    cursor: pointer;
}

/* Content */
.admin-content {
    flex: 1;
    padding: 24px;
}

/* ========================================
   DASHBOARD
   ======================================== */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.stat-card__icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card__icon--primary {
    background: rgba(26, 86, 219, 0.1);
    color: var(--admin-primary);
}

.stat-card__icon--success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--admin-success);
}

.stat-card__icon--warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--admin-warning);
}

.stat-card__icon--info {
    background: rgba(6, 182, 212, 0.1);
    color: var(--admin-info);
}

.stat-card__content {
    flex: 1;
}

.stat-card__value {
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

.stat-card__label {
    font-size: 13px;
    color: var(--admin-text-muted);
    margin-top: 4px;
}

/* ========================================
   NEWS LIST
   ======================================== */
.admin-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.admin-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--admin-border);
}

.admin-card__title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.admin-card__actions {
    display: flex;
    gap: 8px;
}

.admin-card__body {
    padding: 0;
}

/* Table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--admin-border);
}

.admin-table th {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--admin-text-muted);
    background: #f8fafc;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: #f8fafc;
}

.admin-table__title {
    font-weight: 600;
    color: #0f172a;
}

.admin-table__date {
    font-size: 13px;
    color: var(--admin-text-muted);
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge--published {
    background: rgba(34, 197, 94, 0.1);
    color: var(--admin-success);
}

.status-badge--draft {
    background: rgba(100, 116, 139, 0.1);
    color: var(--admin-text-muted);
}

.status-badge--scheduled {
    background: rgba(245, 158, 11, 0.1);
    color: var(--admin-warning);
}

.status-badge--success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--admin-success);
}

.status-badge--secondary {
    background: rgba(100, 116, 139, 0.1);
    color: var(--admin-text-muted);
}

.status-badge__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Navigation badge */
.admin-nav__badge {
    background: var(--admin-danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

/* Category badge */
.category-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
}

/* Action buttons */
.action-btns {
    display: flex;
    gap: 4px;
}

.action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    color: var(--admin-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    border-color: var(--admin-primary);
    color: var(--admin-primary);
}

.action-btn--danger:hover {
    border-color: var(--admin-danger);
    color: var(--admin-danger);
    background: rgba(239, 68, 68, 0.05);
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn--primary {
    background: var(--admin-primary);
    color: white;
}

.btn--primary:hover {
    background: var(--admin-primary-hover);
}

.btn--secondary {
    background: white;
    color: var(--admin-text);
    border: 1px solid var(--admin-border);
}

.btn--secondary:hover {
    border-color: var(--admin-primary);
    color: var(--admin-primary);
}

.btn--danger {
    background: var(--admin-danger);
    color: white;
}

.btn--danger:hover {
    background: #dc2626;
}

.btn--success {
    background: var(--admin-success);
    color: white;
}

.btn--success:hover {
    background: #16a34a;
}

.btn--warning {
    background: #f59e0b;
    color: white;
}

.btn--warning:hover {
    background: #d97706;
}

.btn--icon {
    padding: 8px;
    min-width: 36px;
    min-height: 36px;
}

.btn--sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn--lg {
    padding: 14px 24px;
    font-size: 15px;
}

/* ========================================
   EDITOR
   ======================================== */
.editor-container {
    display: none;
}

.editor-container.is-visible {
    display: block;
}

.editor-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}

.editor-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.editor-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: calc(var(--admin-header-height) + 24px);
}

/* Input styling */
.editor-title-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 24px;
    font-weight: 700;
    font-family: inherit;
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    background: white;
    transition: all 0.2s ease;
}

.editor-title-input:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

.editor-title-input::placeholder {
    color: #94a3b8;
}

.editor-slug {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--admin-text-muted);
    padding: 0 4px;
}

.editor-slug__prefix {
    color: var(--admin-text-muted);
}

.editor-slug__value {
    color: var(--admin-primary);
    font-weight: 600;
}

/* Quill Editor */
.editor-content {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--admin-border);
    overflow: hidden;
}

.ql-toolbar {
    border: none !important;
    border-bottom: 1px solid var(--admin-border) !important;
    background: #f8fafc;
}

.ql-container {
    border: none !important;
    font-family: inherit !important;
    font-size: 16px !important;
}

.ql-editor {
    min-height: 400px;
    padding: 24px !important;
    line-height: 1.8 !important;
}

.ql-editor p {
    margin-bottom: 16px;
}

/* Excerpt textarea */
.editor-excerpt {
    width: 100%;
    padding: 16px 20px;
    font-size: 15px;
    font-family: inherit;
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    background: white;
    resize: vertical;
    min-height: 100px;
    transition: all 0.2s ease;
}

.editor-excerpt:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

/* Sidebar panels */
.editor-panel {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--admin-border);
    overflow: hidden;
}

.editor-panel__header {
    padding: 14px 16px;
    background: #f8fafc;
    border-bottom: 1px solid var(--admin-border);
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}

.editor-panel__body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Image upload */
.image-upload {
    border: 2px dashed var(--admin-border);
    border-radius: 10px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fafafa;
}

.image-upload:hover {
    border-color: var(--admin-primary);
    background: rgba(26, 86, 219, 0.02);
}

.image-upload.has-image {
    padding: 0;
    border-style: solid;
}

.image-upload__preview {
    width: 100%;
    border-radius: 8px;
    display: none;
}

.image-upload.has-image .image-upload__preview {
    display: block;
}

.image-upload__placeholder {
    color: var(--admin-text-muted);
}

.image-upload.has-image .image-upload__placeholder {
    display: none;
}

.image-upload__icon {
    margin-bottom: 8px;
    color: #94a3b8;
}

.image-upload__text {
    font-size: 13px;
    margin-bottom: 4px;
}

.image-upload__hint {
    font-size: 11px;
    color: #94a3b8;
}

.image-upload__remove {
    display: none;
    margin-top: 8px;
}

.image-upload.has-image .image-upload__remove {
    display: block;
}

/* Select inputs */
.editor-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    background: white;
    cursor: pointer;
}

.editor-select:focus {
    outline: none;
    border-color: var(--admin-primary);
}

/* Date input */
.editor-datetime {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    background: white;
}

.editor-datetime:focus {
    outline: none;
    border-color: var(--admin-primary);
}

/* Editor actions */
.editor-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.editor-actions .btn {
    width: 100%;
}

/* Auto-save indicator */
.autosave-indicator {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 12px;
    color: var(--admin-success);
    opacity: 0;
    transition: opacity 0.3s ease;
    margin-top: 8px;
}

.autosave-indicator.is-visible {
    opacity: 1;
}

/* ========================================
   CATEGORY MANAGER
   ======================================== */
.category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 10px;
}

.category-item__color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.category-item__name {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
}

.category-item__count {
    font-size: 12px;
    color: var(--admin-text-muted);
}

.category-item__actions {
    display: flex;
    gap: 4px;
}

/* ========================================
   MODALS
   ======================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.is-visible .modal {
    transform: scale(1);
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--admin-border);
}

.modal__title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.modal__close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--admin-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal__close:hover {
    background: #f1f5f9;
    color: var(--admin-text);
}

.modal__body {
    padding: 24px;
}

.modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--admin-border);
    background: #f8fafc;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
    max-width: 360px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast--success {
    border-left: 4px solid var(--admin-success);
}

.toast--error {
    border-left: 4px solid var(--admin-danger);
}

.toast--warning {
    border-left: 4px solid var(--admin-warning);
}

.toast__icon {
    flex-shrink: 0;
}

.toast__icon--success {
    color: var(--admin-success);
}

.toast__icon--error {
    color: var(--admin-danger);
}

.toast__icon--warning {
    color: var(--admin-warning);
}

.toast__content {
    flex: 1;
}

.toast__title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.toast__message {
    font-size: 13px;
    color: var(--admin-text-muted);
    margin-top: 2px;
}

.toast__close {
    padding: 4px;
    background: transparent;
    border: none;
    color: var(--admin-text-muted);
    cursor: pointer;
    border-radius: 4px;
}

.toast__close:hover {
    background: #f1f5f9;
}

/* ========================================
   EMPTY STATES
   ======================================== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
}

.empty-state__icon {
    width: 80px;
    height: 80px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: #94a3b8;
}

.empty-state__title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.empty-state__text {
    font-size: 14px;
    color: var(--admin-text-muted);
    margin-bottom: 24px;
}

/* ========================================
   LOADING STATES
   ======================================== */
.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--admin-border);
    border-top-color: var(--admin-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    .editor-grid {
        grid-template-columns: 1fr;
    }

    .editor-sidebar {
        position: static;
    }
}

@media (max-width: 768px) {

    /* Sidebar */
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.is-open {
        transform: translateX(0);
    }

    /* Overlay when sidebar is open */
    .admin-sidebar.is-open+.admin-main::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 40;
    }

    /* Main content */
    .admin-main {
        margin-left: 0;
    }

    .admin-menu-btn {
        display: flex;
    }

    .admin-header {
        padding: 0 16px;
    }

    .admin-header__title {
        font-size: 16px;
    }

    .admin-header__actions .btn span {
        display: none;
    }

    .admin-header__actions .btn {
        padding: 10px;
    }

    .admin-content {
        padding: 16px;
    }

    /* Dashboard stats - 2 columns on tablet, 1 on phone */
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card__icon {
        width: 40px;
        height: 40px;
    }

    .stat-card__value {
        font-size: 22px;
    }

    .stat-card__label {
        font-size: 11px;
    }

    /* Dashboard grid - single column on mobile */
    .dashboard-grid,
    #view-dashboard>div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* Card header */
    .admin-card__header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        padding: 16px;
    }

    .admin-card__actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .admin-card__actions .editor-select,
    .admin-card__actions input {
        flex: 1;
        min-width: 120px;
    }

    /* Table - convert to card layout on mobile */
    .admin-table {
        display: block;
    }

    .admin-table thead {
        display: none;
    }

    .admin-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }

    .admin-table tr {
        display: flex;
        flex-direction: column;
        background: #f8fafc;
        border-radius: 12px;
        padding: 16px;
        gap: 8px;
        border: 1px solid var(--admin-border);
    }

    .admin-table tr:hover td {
        background: transparent;
    }

    .admin-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0;
        border: none;
    }

    .admin-table td::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--admin-text-muted);
        margin-right: 12px;
    }

    /* First cell (title) - full width, no label */
    .admin-table td:first-child {
        font-size: 15px;
        font-weight: 600;
        color: #0f172a;
        padding-bottom: 8px;
        border-bottom: 1px solid var(--admin-border);
        margin-bottom: 4px;
    }

    .admin-table td:first-child::before {
        display: none;
    }

    /* Actions row - full width */
    .admin-table td:last-child {
        justify-content: flex-end;
        padding-top: 8px;
        border-top: 1px solid var(--admin-border);
        margin-top: 4px;
    }

    .admin-table td:last-child::before {
        display: none;
    }

    .action-btns {
        gap: 8px;
    }

    .action-btn {
        width: 36px;
        height: 36px;
    }

    /* Toast notifications */
    .toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }

    .toast {
        max-width: none;
    }

    /* Modal */
    .modal {
        margin: 16px;
        max-height: calc(100vh - 32px);
    }

    /* Editor */
    .editor-title-input {
        font-size: 18px;
        padding: 12px 16px;
    }

    .editor-panel__header {
        padding: 12px 16px;
        font-size: 13px;
    }

    .editor-panel__body {
        padding: 12px 16px;
    }

    .editor-actions {
        flex-direction: column;
    }

    .editor-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {

    /* Even smaller phones */
    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex-direction: row;
        align-items: center;
    }

    .admin-header__title {
        font-size: 14px;
    }

    .login-card {
        padding: 24px;
    }

    .login-logo__title {
        font-size: 20px;
    }

    .category-badge {
        font-size: 10px;
        padding: 3px 8px;
    }

    .status-badge {
        font-size: 11px;
        padding: 3px 8px;
    }
}