@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #080a10;
    --bg-secondary: #0f131e;
    --glass-bg: rgba(18, 22, 33, 0.55);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-hover: rgba(255, 255, 255, 0.09);
    
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.35);
    --primary-hover: #4f46e5;
    
    --accent: #06b6d4;
    --accent-glow: rgba(6, 182, 212, 0.25);
    
    --success: #10b981;
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.2);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.08);
}

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

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.06) 0%, transparent 45%);
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', sans-serif;
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Glassmorphism utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-interactive:hover {
    background: var(--glass-hover);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 40px 0 rgba(99, 102, 241, 0.15);
    transform: translateY(-3px);
}

/* Header styling */
.cms-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 40px;
    background: rgba(8, 10, 16, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 10px var(--primary-glow));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.logo h1 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 30%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo span {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 1px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-badge {
    background: rgba(255, 255, 255, 0.04);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--glass-border);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 24px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
    color: #fff;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.55);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    box-shadow: 0 4px 15px var(--danger-glow);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.form-control {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Dashboard Grid & Filters */
.dashboard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 35px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    gap: 12px;
    flex: 1;
    max-width: 600px;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
}

/* Post Cards */
.post-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 480px;
    animation: fadeInUp 0.5s ease backwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid var(--glass-border);
}

.post-card-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

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

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-urlaub { background: rgba(6, 182, 212, 0.15); color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.3); }
.badge-onepiece { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-garten { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-diy { background: rgba(99, 102, 241, 0.15); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.3); }
.badge-essen { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-alltag { background: rgba(236, 72, 153, 0.15); color: #fbcfe8; border: 1px solid rgba(236, 72, 153, 0.3); }

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

.post-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-excerpt {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.post-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: auto;
}

.author-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.post-card-actions {
    display: flex;
    gap: 8px;
}

/* Login Page Specific */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 90vh;
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 40px;
}

.login-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.login-card p {
    color: var(--text-secondary);
    text-align: center;
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Editor Specific Layout */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 30px;
}

@media (max-width: 1100px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }
}

.editor-main-card {
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.editor-sidebar-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    align-self: start;
    position: sticky;
    top: 100px;
}

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

.editor-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group-full {
    grid-column: span 2;
}

.split-editor-wrapper {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.editor-toolbar {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 16px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.editor-tool-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
}

.editor-tool-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.editor-toolbar-separator {
    width: 1px;
    height: 20px;
    background: var(--border-color);
}

.split-panes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 500px;
}

@media (max-width: 768px) {
    .split-panes {
        grid-template-columns: 1fr;
        height: auto;
    }
}

.editor-pane-container {
    border-right: 1px solid var(--border-color);
}

.textarea-code {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    resize: none;
    padding: 20px;
    color: #e2e8f0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    line-height: 1.6;
}

.textarea-code:focus {
    outline: none;
}

.preview-pane-container {
    height: 100%;
    overflow-y: auto;
    background: #fff;
    color: #333;
}

.preview-pane {
    padding: 24px;
}

.sidebar-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Image Upload and Manager Styles */
.image-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    transition: all 0.2s ease;
}

.image-upload-zone:hover {
    background: rgba(99, 102, 241, 0.03);
    border-color: var(--primary);
}

.image-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 5px;
}

.image-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    height: 90px;
    border: 1px solid var(--border-color);
}

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

.image-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 10, 16, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 6px;
}

.image-item:hover .image-item-overlay {
    opacity: 1;
}

.image-action-btn {
    font-size: 0.7rem;
    padding: 4px 8px;
    width: 100%;
    justify-content: center;
    border-radius: 4px;
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    width: 100%;
    max-width: 700px;
    padding: 30px;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.gallery-modal-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
    max-height: 40vh;
    overflow-y: auto;
    padding-right: 10px;
}

.gallery-modal-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 8px;
}

.gallery-modal-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}
