/* Admin Panel Styles */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --success-hover: #15803d;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Navigation */
.admin-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 0.75rem 1.5rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.nav-brand a {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-links a {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s;
}

.nav-links a:hover {
    background: var(--bg);
    color: var(--text);
}

.nav-links a.active {
    background: var(--primary);
    color: white;
}

.nav-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-logout {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
}

.btn-logout:hover {
    background: var(--bg);
    color: var(--text);
}

/* Main Content */
.admin-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

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

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

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

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

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

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

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

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

.btn-small {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
}

/* Dashboard */
.dashboard h1 {
    margin-bottom: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
}

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

.quick-actions {
    margin-bottom: 2rem;
}

.quick-actions h2 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.recent-posts h2 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.post-list {
    list-style: none;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.post-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.post-list li:last-child {
    border-bottom: none;
}

.post-list a {
    color: var(--text);
    text-decoration: none;
}

.post-list a:hover {
    color: var(--primary);
}

.post-date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Content List */
.content-list {
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 1.5rem;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.list-header h1 {
    font-size: 1.5rem;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table td a {
    color: var(--text);
    text-decoration: none;
}

.data-table td a:hover {
    color: var(--primary);
}

.data-table code {
    background: var(--bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.description-cell {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
}

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

.empty-state p {
    margin-bottom: 1rem;
}

/* Editor Page */
.editor-page {
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 1.5rem;
}

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

.editor-header h1 {
    font-size: 1.5rem;
}

.editor-actions {
    display: flex;
    gap: 0.75rem;
}

.editor-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Jodit Editor Adjustments */
.jodit-container {
    border-radius: 6px;
    border-color: var(--border) !important;
}

.jodit-workplace {
    min-height: 400px;
}

/* Content styling inside Jodit */
.jodit-wysiwyg a {
    color: #3366cc;
}

.jodit-wysiwyg a:visited {
    color: #795cb2;
}

.jodit-wysiwyg p {
    margin: 0 0 1em 0;
}

.jodit-wysiwyg ul,
.jodit-wysiwyg ol {
    margin: 0 0 1em 0;
    padding-left: 2em;
}

.jodit-wysiwyg ul {
    list-style-type: disc;
}

.jodit-wysiwyg ol {
    list-style-type: decimal;
}

.jodit-wysiwyg li {
    margin: 0.25em 0;
}

.jodit-wysiwyg h2,
.jodit-wysiwyg h3,
.jodit-wysiwyg h4 {
    margin: 1.5em 0 0.5em 0;
}

.jodit-wysiwyg img {
    max-width: 100%;
    height: auto;
}

.jodit-wysiwyg blockquote {
    margin: 1em 0;
    padding: 0.5em 1em;
    border-left: 3px solid var(--border);
    background: var(--bg);
}

/* Status Message */
.status-message {
    display: none;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.status-message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.status-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    background: var(--card-bg);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.login-container h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.login-container .subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.dev-mode-notice {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: left;
}

.dev-mode-notice strong {
    color: #92400e;
}

.dev-mode-notice p {
    color: #78350f;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.btn-github {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.8rem 1.5rem;
    background: #24292e;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.btn-github:hover {
    background: #1a1e22;
}

/* Navigation Management */
.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    padding: 0 0.5rem;
    font-size: 1.1rem;
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

tr.dragging {
    opacity: 0.4;
}

tr.drag-over td {
    border-top: 2px solid var(--primary);
}

.nav-label-input {
    border: 1px solid var(--border);
    background: var(--card-bg);
    font: inherit;
    width: 100%;
    color: var(--text);
    border-radius: 4px;
    padding: 4px 8px;
}

.nav-label-input:hover {
    border-color: #93c5fd;
}

.nav-label-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

tr.nav-row-hidden .nav-label-input,
tr.nav-row-hidden code {
    opacity: 0.45;
}

.nav-add-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.nav-add-section h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* Font Theme Cards */
.font-themes {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.font-theme-card {
    display: block;
    cursor: pointer;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: var(--card-bg);
}

.font-theme-card:hover {
    border-color: #93c5fd;
}

.font-theme-card:has(input:checked) {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.font-theme-card input[type="radio"] {
    display: none;
}

.font-theme-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.font-theme-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.font-theme-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.font-theme-fonts {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.font-theme-preview {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 6px;
}

.preview-heading {
    color: var(--text);
    line-height: 1.3;
}

.preview-body {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-nav {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .nav-links {
        order: 3;
        width: 100%;
        overflow-x: auto;
    }

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

    .editor-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .editor-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .data-table {
        font-size: 0.85rem;
    }

    .actions-cell {
        flex-direction: column;
    }
}
