/* ============================
   Anleitung Sardenya 356 — Styles
   Mediterranean warm palette
   ============================ */

:root {
    --terracotta: #C0392B;
    --terracotta-light: #E74C3C;
    --sand: #FDF6EC;
    --sand-dark: #F5E6CC;
    --deep-blue: #2C3E50;
    --warm-gray: #7F8C8D;
    --olive: #6B7D3A;
    --white: #FFFFFF;
    --shadow: 0 2px 15px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 25px rgba(0,0,0,0.12);
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--sand);
    color: var(--deep-blue);
    line-height: 1.7;
    padding-top: 60px;
}

/* ---- Navbar ---- */
.navbar-anleitung {
    background: linear-gradient(135deg, var(--terracotta), var(--terracotta-light));
    box-shadow: 0 2px 20px rgba(192,57,43,0.3);
}
.navbar-anleitung .navbar-brand {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
}
.navbar-anleitung .nav-link {
    color: rgba(255,255,255,0.85) !important;
    font-weight: 500;
    transition: color 0.2s;
}
.navbar-anleitung .nav-link:hover {
    color: #fff !important;
}
.navbar-anleitung .nav-link i {
    margin-right: 5px;
}

/* ---- Hero ---- */
.hero {
    background: linear-gradient(135deg, var(--deep-blue), #34495E);
    color: var(--white);
    padding: 3rem 0 2.5rem;
    text-align: center;
    margin-bottom: 2rem;
}
.hero h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}
.hero .address {
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: 1rem;
}
.hero .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}
.hero .viel-spass {
    display: inline-block;
    margin-top: 1.2rem;
    padding: 0.5rem 1.5rem;
    background: rgba(255,255,255,0.15);
    border-radius: 50px;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 1px;
}
.hero .intro-content {
    max-width: 600px;
    margin: 0.8rem auto 0;
    font-size: 0.95rem;
    opacity: 0.85;
}

/* ---- Sections ---- */
.sections-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem 3rem;
}

.section-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.2rem;
    padding: 1.5rem 1.8rem;
    transition: box-shadow 0.3s, transform 0.2s;
    position: relative;
}
.section-card:hover {
    box-shadow: var(--shadow-hover);
}

.section-card.warning {
    border-left: 4px solid var(--terracotta);
    background: #FFF5F5;
}

.section-card .section-header {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.8rem;
}
.section-card .section-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--sand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--terracotta);
    flex-shrink: 0;
}
.section-card.warning .section-icon {
    background: var(--terracotta);
    color: var(--white);
}
.section-card .section-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    flex-grow: 1;
}
.section-card .section-content {
    font-size: 0.95rem;
    color: #444;
}
.section-card .section-content p:last-child {
    margin-bottom: 0;
}
.section-card .section-content ul {
    margin-bottom: 0.5rem;
    padding-left: 1.3rem;
}
.section-card .section-content a {
    color: var(--terracotta);
    text-decoration: none;
    border-bottom: 1px dotted var(--terracotta);
}
.section-card .section-content a:hover {
    border-bottom-style: solid;
}

/* Section photos */
.section-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.8rem;
}
.section-photos img {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}
.section-photos img:hover {
    transform: scale(1.05);
}
.photo-wrapper {
    position: relative;
    display: inline-block;
}
.photo-delete {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--terracotta);
    color: white;
    border: 2px solid white;
    font-size: 11px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
body.edit-mode .photo-delete {
    display: flex;
}

/* ---- Footer ---- */
.footer-anleitung {
    background: var(--deep-blue);
    color: rgba(255,255,255,0.7);
    padding: 2rem 0;
    text-align: center;
    font-size: 0.9rem;
}
.footer-anleitung strong {
    color: var(--white);
}

/* ---- Edit Mode ---- */
.edit-only {
    display: none !important;
}
body.edit-mode .edit-only {
    display: flex !important;
}
body.edit-mode .view-only {
    display: none !important;
}

.drag-handle {
    position: absolute;
    left: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 40px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: grab;
    color: var(--warm-gray);
    font-size: 1.1rem;
    border-radius: 6px;
    background: var(--white);
    box-shadow: var(--shadow);
}
body.edit-mode .drag-handle {
    display: flex;
}
.drag-handle:active { cursor: grabbing; }

.section-card.sortable-ghost {
    opacity: 0.4;
    box-shadow: 0 0 0 2px var(--terracotta);
}
.section-card.sortable-chosen {
    box-shadow: var(--shadow-hover);
}

.edit-controls {
    display: none;
    gap: 0.5rem;
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px solid #eee;
}
body.edit-mode .edit-controls {
    display: flex;
    flex-wrap: wrap;
}

.btn-edit-action {
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: var(--white);
    color: var(--deep-blue);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-edit-action:hover {
    background: var(--sand);
    border-color: var(--terracotta);
    color: var(--terracotta);
}
.btn-edit-action.danger:hover {
    background: #FFF5F5;
    border-color: var(--terracotta);
    color: var(--terracotta);
}

.title-input {
    font-size: 1.15rem;
    font-weight: 700;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    width: 100%;
    display: none;
}
body.edit-mode .section-card.editing .title-input {
    display: block;
}
body.edit-mode .section-card.editing .section-title-text {
    display: none;
}

#add-section-btn {
    display: none;
    width: 100%;
    padding: 1rem;
    border: 2px dashed #ccc;
    border-radius: var(--radius);
    background: transparent;
    color: var(--warm-gray);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 2rem;
}
#add-section-btn:hover {
    border-color: var(--terracotta);
    color: var(--terracotta);
    background: rgba(192,57,43,0.03);
}
body.edit-mode #add-section-btn {
    display: block;
}

/* Edit toolbar */
.edit-toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    box-shadow: 0 -2px 20px rgba(0,0,0,0.1);
    padding: 0.8rem 1rem;
    z-index: 1050;
    display: none;
    justify-content: center;
    gap: 0.8rem;
}
body.edit-mode .edit-toolbar {
    display: flex;
}

/* ---- Modals ---- */
.modal-header {
    background: var(--deep-blue);
    color: var(--white);
}
.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* ---- Intro Edit in Hero ---- */
.hero .trumbowyg-box {
    background: rgba(255,255,255,0.95);
    border-radius: 8px;
    max-width: 600px;
    margin: 0.8rem auto 0;
}
.hero .trumbowyg-editor {
    color: var(--deep-blue);
    min-height: 60px;
}
#btn-edit-intro {
    border-color: rgba(255,255,255,0.4);
}
#btn-edit-intro:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.7);
}

/* ---- Trumbowyg overrides ---- */
.trumbowyg-box {
    margin-top: 0.5rem;
    border-radius: 8px;
    border-color: #ddd;
}
.trumbowyg-editor {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 0.95rem;
    min-height: 120px;
    padding: 0.8rem;
}

/* ---- Markdown Editor ---- */
#markdownModal .modal-body {
    min-height: 500px;
    background: #1e1e1e;
}
#markdownModal .EasyMDEContainer {
    height: 100%;
}
#markdownModal .EasyMDEContainer .CodeMirror {
    min-height: 450px;
    font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.9rem;
}
#markdownModal .editor-toolbar {
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
}
#markdownModal .modal-footer code {
    background: var(--sand-dark);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* ---- Lightbox ---- */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.lightbox-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
}

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 1060;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.6rem; }
    .hero { padding: 2rem 1rem 1.5rem; }
    .section-card { padding: 1.2rem; }
    .section-card .section-icon { width: 32px; height: 32px; font-size: 0.85rem; }
    .section-card .section-title { font-size: 1.05rem; }
    .drag-handle { left: -10px; }
    .navbar-anleitung .navbar-brand { font-size: 1rem; }
    .section-photos img { width: 80px; height: 60px; }
}

/* ---- Print ---- */
@media print {
    .navbar, .edit-toolbar, .edit-only, .edit-controls, .drag-handle, #add-section-btn { display: none !important; }
    body { padding-top: 0; background: white; }
    .hero { background: white !important; color: black !important; padding: 1rem 0; }
    .section-card { box-shadow: none; border: 1px solid #eee; page-break-inside: avoid; }
}
