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

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #151520;
    --bg-elevated: #1e1e2e;
    --border-color: #2a2a3e;
    --text-primary: #e8e8f0;
    --text-secondary: #9898b8;
    --text-tertiary: #68688a;
    --accent-primary: #6366f1;
    --accent-hover: #7c3aed;
    --accent-glow: rgba(99, 102, 241, 0.2);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

body {
    font-family: 'DM Sans', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 2rem 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.logo {
    font-family: 'Crimson Pro', serif;
    font-size: 1.75rem;
    font-weight: 700;
    padding: 0 2rem 2rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.nav-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    padding: 0 2rem;
    margin-bottom: 0.75rem;
}

.nav-item {
    padding: 0.875rem 2rem;
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(99, 102, 241, 0.05);
    color: var(--text-primary);
    border-left-color: var(--accent-primary);
}

.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
    font-weight: 500;
}

.nav-icon {
    font-size: 1.25rem;
}

/* Main Content */
.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 2rem;
    max-width: calc(100vw - 280px);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.page-title {
    font-family: 'Crimson Pro', serif;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9375rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-hover) 100%);
    color: white;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

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

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

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

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

.card-image {
    width: 100%;
    height: 180px;
    background: var(--bg-elevated);
    border-radius: 8px;
    margin-bottom: 1rem;
    object-fit: cover;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-family: 'Crimson Pro', serif;
}

.card-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}

.card-excerpt {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-draft {
    background: rgba(156, 163, 175, 0.1);
    color: #9ca3af;
}

.badge-published {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

/* Editor Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
    overflow-y: auto;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem;
    max-width: 1000px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    margin: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-family: 'Crimson Pro', serif;
    font-size: 2rem;
    font-weight: 700;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.75rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
}

.close-btn:hover {
    color: var(--text-primary);
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

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

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

.form-hint {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-top: 0.375rem;
}

/* Rich Text Editor */
.editor-container {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.ql-toolbar {
    background: var(--bg-primary) !important;
    border: none !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.ql-container {
    background: var(--bg-elevated) !important;
    border: none !important;
    font-size: 1rem;
    min-height: 300px;
}

.ql-editor {
    color: var(--text-primary);
    min-height: 300px;
}

.ql-editor.ql-blank::before {
    color: var(--text-tertiary);
}

.ql-stroke {
    stroke: var(--text-secondary) !important;
}

.ql-fill {
    fill: var(--text-secondary) !important;
}

.ql-picker-label {
    color: var(--text-secondary) !important;
}

.ql-toolbar button:hover .ql-stroke,
.ql-toolbar button.ql-active .ql-stroke {
    stroke: var(--accent-primary) !important;
}

.ql-toolbar button:hover .ql-fill,
.ql-toolbar button.ql-active .ql-fill {
    fill: var(--accent-primary) !important;
}

/* Image Picker */
.image-picker {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.image-preview {
    width: 200px;
    height: 150px;
    border-radius: 8px;
    background: var(--bg-elevated);
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-placeholder {
    color: var(--text-tertiary);
    font-size: 3rem;
}

.image-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Media Grid */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.media-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    border: 2px solid var(--border-color);
    transition: all 0.2s ease;
}

.media-item:hover {
    border-color: var(--accent-primary);
    transform: scale(1.02);
}

.media-item.selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-elevated);
    margin-bottom: 1.5rem;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent-primary);
    background: var(--accent-glow);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 4rem;
    color: var(--text-secondary);
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 6rem 2rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

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

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

    .main-content {
        margin-left: 0;
        max-width: 100vw;
    }

    .image-picker {
        flex-direction: column;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.3s ease;
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 100%);
}

.login-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 3rem;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.login-logo {
    font-family: 'Crimson Pro', serif;
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.9375rem;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.875rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
    display: none;
}

.error-message.show {
    display: block;
}

.hidden {
    display: none !important;
}



/* Additional styles for account page */
.account-container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 2rem;
}

.account-title {
  font-family: 'Crimson Pro', serif;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
  text-align: center;
}

.account-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

.account-card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow);
}

.account-card h3 {
  font-family: 'Crimson Pro', serif;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.account-form label {
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.account-form input {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.account-form input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.account-button {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  border: none;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9375rem;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-hover) 100%);
  color: white;
  box-shadow: 0 4px 12px var(--accent-glow);
  width: 100%;
}

.account-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.account-button-danger {
  background: var(--danger) !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2) !important;
}

.account-button-danger:hover {
  background: #dc2626 !important;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3) !important;
}

.account-info-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
}

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

.account-info-label {
  font-weight: 600;
  min-width: 140px;
  color: var(--text-secondary);
}

.info-text {
  flex: 1;
  color: var(--text-primary);
}

.info-text input {
  flex: 1;
  width: 100%;
}

.edit-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
}

.edit-btn:hover {
  border-color: var(--accent-primary);
  background: var(--accent-glow);
}

.screen-banner {
  position: fixed;
  top: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  background: var(--success);
  color: white;
  font-weight: 500;
  box-shadow: var(--shadow);
  z-index: 1000;
  opacity: 0;
  transform: translateX(100px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.screen-banner.show {
  opacity: 1;
  transform: translateX(0);
}

.screen-banner.error {
  background: var(--danger);
}

.g-recaptcha {
  margin: 1rem 0;
}

/* Back to CMS link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 2rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.back-link:hover {
  color: var(--accent-primary);
  background: var(--accent-glow);
}