/* public/css/main.css */

/* --- 1. Design System & Variables --- */
:root {
    --primary: #4CAF50;
    --primary-dark: #388E3C;
    --secondary: #8BC34A;
    --danger: #e74c3c;
    --warning: #f39c12;
    --success: #2ecc71;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --bg-light: #f9fbfc;
    --white: #ffffff;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --radius: 12px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- 2. Base Resets --- */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    background-color: var(--bg-light);
    color: var(--text-main);
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    color: var(--text-main);
    margin-bottom: 20px;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.4rem; }

p {
    color: var(--text-muted);
    margin-bottom: 15px;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

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

/* --- 3. Layout Containers --- */
.container,
.login-container,
.dashboard-container,
.page-container {
    background-color: var(--white);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 40px auto;
    max-width: 95%;
}

@media (min-width: 768px) {
    .container { max-width: 1100px; }
    .page-container { max-width: 960px; }
}

/* --- 4. Top Header Bar (Public) --- */
.top-header-bar {
    background-color: var(--white);
    padding: 15px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
}

.top-left {
    display: flex;
    align-items: center;
    gap: 25px;
}

.header-logo {
    height: 60px;
    width: auto;
    display: block;
}

.site-slogan {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
    display: block;
    margin-top: 5px;
}

.social-icons a {
    color: var(--text-main);
    font-size: 1.4rem;
    margin-left: 20px;
    opacity: 0.6;
}

.social-icons a:hover {
    color: var(--primary);
    opacity: 1;
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .top-header-bar { flex-direction: column; gap: 15px; text-align: center; padding: 20px; }
    .top-left { flex-direction: column; gap: 10px; }
    .site-slogan { border-left: none; padding-left: 0; font-size: 0.9rem; }
    .social-icons a { margin: 0 10px; }
}

/* --- 5. Main Navigation (Public) --- */
.main-header {
    background-color: var(--white);
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    min-height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.site-nav {
    width: 100%;
    max-width: 1200px;
}

.site-nav > ul {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.site-nav li {
    position: relative;
    list-style: none;
}

.site-nav a {
    padding: 20px 25px;
    color: var(--text-main);
    font-weight: 600;
    display: block;
    font-size: 1.05rem;
    transition: var(--transition);
}

.site-nav a:hover, 
.site-nav a.active {
    color: var(--primary);
}

/* Dropdown Menu (Desktop) */
.sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--white);
    box-shadow: var(--shadow);
    min-width: 240px;
    border-radius: 0 0 12px 12px;
    padding: 10px 0;
    z-index: 1100;
    text-align: left; /* Tving venstrestilling */
}

/* Sørg for at undermenuen IKKE er flex */
.site-nav .sub-menu {
    flex-direction: column;
    display: none;
}

.site-nav li:hover > .sub-menu {
    display: flex; /* Brug flex column for kontrol */
}

.sub-menu li {
    width: 100%;
}

.sub-menu a {
    padding: 12px 25px;
    font-size: 0.95rem;
    font-weight: 500;
    width: 100%;
    border-bottom: 1px solid #f9f9f9;
}

.sub-menu li:last-child a {
    border-bottom: none;
}

/* Burger Button */
.burger-menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 15px;
    cursor: pointer;
    position: absolute;
    right: 15px;
}

.burger-menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--text-main);
    margin: 5px auto;
    transition: var(--transition);
    border-radius: 3px;
}

/* Burger Animation */
.burger-menu-toggle.is-open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.burger-menu-toggle.is-open span:nth-child(2) { opacity: 0; }
.burger-menu-toggle.is-open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 768px) {
    .burger-menu-toggle { display: block; }
    .site-nav {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        background: var(--white);
        box-shadow: var(--shadow);
        padding: 20px 0;
    }
    .site-nav.is-open { display: block; }
    .site-nav ul { flex-direction: column; text-align: center; }
    .site-nav a { padding: 15px; }
    .sub-menu { 
        position: static; 
        transform: none; 
        box-shadow: none; 
        background: #fcfcfc; 
        display: none; /* Skjul som standard på mobil */
        padding-left: 20px;
    }
    /* Vis kun undermenu hvis forælderen er aktiv eller har en specifik klasse (valgfrit) */
    .site-nav li:hover > .sub-menu,
    .site-nav li.active > .sub-menu {
        display: block;
    }
}

/* --- 6. Hero & Content Sections --- */
.hero-section {
    width: 100%;
    background: #fff;
    height: 500px; /* Fast højde på desktop */
    overflow: hidden;
}

.hero-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover; /* Sikrer at billedet udfylder uden at strække */
    object-position: center;
}

@media (max-width: 768px) {
    .hero-section {
        height: 300px; /* Lavere højde på mobil */
    }
}

.focus-section {
    padding: 80px 5%;
    background-color: var(--bg-light);
}

.focus-section h4 {
    max-width: 900px;
    margin: 0 auto 60px;
    font-size: 1.3rem;
    line-height: 1.6;
    color: var(--text-main);
    text-align: center;
}

.focus-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    max-width: 1250px;
    margin: 0 auto;
}

@media (min-width: 1100px) {
    .focus-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

.focus-box {
    background: var(--white);
    padding: 40px 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid transparent;
}

.focus-box:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
}

.focus-box h3 {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--primary-dark);
    margin-bottom: 25px;
}

.focus-title-icon {
    width: 45px;
    height: auto;
}

/* --- 6b. Page Content (CMS) --- */
.page-container ul,
.page-container ol {
    margin-left: 25px;
    margin-bottom: 15px;
}

.page-container li {
    margin-bottom: 6px;
    color: var(--text-main);
    line-height: 1.7;
}

.page-container p {
    color: var(--text-main);
}

/* --- 7. Kontakt Side --- */
.contact-page-content {
    display: flex;
    flex-wrap: wrap;
    gap: 50px;
    align-items: flex-start;
}

.contact-info, .contact-form {
    flex: 1;
    min-width: 300px;
}

.contact-info h1 { margin-bottom: 30px; }
.contact-info p { margin-bottom: 25px; font-size: 1.1rem; }

.contact-form h2 { margin-bottom: 25px; }

.honeypot { display: none !important; }

/* --- 8. Admin Header & Dashboard --- */
.admin-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
    gap: 15px;
}

.admin-logout-form,
.inline-action-form {
    margin: 0;
}

.inline-action-form {
    display: inline-flex;
}

.admin-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-logo {
    height: 45px;
    width: auto;
}

.admin-header-left h1 {
    margin-bottom: 0;
    font-size: 1.6rem;
}

.dashboard-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.dashboard-btn {
    background: var(--white);
    padding: 40px 20px;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    color: var(--text-main) !important;
}

.dashboard-btn:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.dashboard-btn i {
    font-size: 3rem;
    color: var(--primary);
}

/* --- 9. Forms & Buttons (Global) --- */
.form-group { margin-bottom: 20px; }

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.1);
}

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

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.btn {
    padding: 10px 25px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    display: inline-block;
    transition: var(--transition);
    font-size: 0.95rem;
    background-color: var(--primary);
    color: #fff !important;
}

.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }

.btn-black { background-color: #2c3e50; color: #fff !important; }
.btn-black:hover { background-color: #000; }

.btn-back { background-color: #7f8c8d; color: #fff !important; } /* Standard grå men med hvid tekst */
.btn-back:hover { background-color: #2c3e50; }

/* Men brugeren ville have den GRØN med hvid tekst: */
.btn-back { background-color: var(--primary); color: #fff !important; }
.btn-back:hover { background-color: var(--primary-dark); }

.btn-secondary { background-color: #95a5a6; color: #fff !important; }
.btn-secondary:hover { background-color: #7f8c8d; }

.btn-danger { background-color: var(--danger); color: #fff !important; }
.btn-success { background-color: var(--success); color: #fff !important; }
.btn-sm { padding: 6px 15px; font-size: 0.85rem; }

/* --- 10. Admin UI Helpers --- */
.submissions-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #eee;
    margin-top: 20px;
}

.contact-admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    padding: 18px 20px;
    margin-bottom: 18px;
    border: 1px solid #e6ece6;
    border-radius: 14px;
    background: #f8fbf8;
}

.contact-admin-header h2 {
    margin: 0 0 4px;
    color: var(--primary-dark);
    font-size: 1.7rem;
}

.contact-admin-header p {
    margin: 0;
    color: var(--text-muted);
}

.contact-admin-eyebrow {
    margin-bottom: 4px !important;
    color: var(--primary-dark) !important;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.contact-admin-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 14px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff !important;
    font-weight: 800;
    white-space: nowrap;
}

.contact-admin-back:hover {
    background: var(--primary-dark);
    transform: none;
}

.contact-admin-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.contact-admin-stat {
    padding: 16px;
    border: 1px solid #e6ece6;
    border-radius: 12px;
    background: #fff;
}

.contact-admin-stat span {
    display: block;
    margin-bottom: 2px;
    color: var(--primary-dark);
    font-size: 1.6rem;
    font-weight: 900;
    line-height: 1;
}

.contact-admin-stat strong {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.submissions-table th {
    background-color: #f8f9fa;
    padding: 15px;
    text-align: left;
    font-weight: 700;
    border-bottom: 2px solid #eee;
    color: var(--text-main);
}

.submissions-table td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.submissions-table tr:nth-child(even) { background-color: #fcfdf9; }

.submissions-table tr.unread td { 
    background-color: #fff9f0; /* Svag gul/orange for ulæste */
    font-weight: 600;
}

.submissions-table tr.unread { 
    border-left: 4px solid var(--warning); 
}

/* --- 13. Contact Submissions (Admin) --- */
.filter-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.contact-admin-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 6px;
    margin-bottom: 18px;
    border: 1px solid #e6ece6;
    border-radius: 12px;
    background: #f4f7f4;
}

.contact-admin-filters a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 9px;
    color: #263226;
    font-size: 0.9rem;
    font-weight: 850;
}

.contact-admin-filters a.active {
    background: var(--primary-dark);
    color: #fff;
    box-shadow: 0 6px 16px rgba(46, 125, 50, 0.16);
}

.filter-buttons .btn.active {
    background-color: var(--primary-dark);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.message-row td {
    padding: 0;
    border-bottom: none;
}

.message-row {
    display: none;
}

.message-row.is-open {
    display: table-row;
}

.message-details {
    display: none;
    padding: 25px;
    background: #fdfdfd;
    border-bottom: 1px solid #eee;
    line-height: 1.8;
    color: var(--text-main);
}

.message-details p {
    margin-bottom: 10px;
    color: var(--text-main);
}

.message-details strong {
    color: var(--primary-dark);
    display: block;
    margin-bottom: 5px;
}

.submission-status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 850;
}

.submission-status--read {
    background: #edf3ee;
    color: #536456;
}

.submission-status--unread {
    background: #fff2d7;
    color: #8a5200;
}

.submission-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 36px;
    padding: 8px 11px;
    border: 1px solid #dce7dc;
    border-radius: 9px;
    background: #fff;
    color: #263226;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}

.submission-action--primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.muted-value {
    color: var(--text-muted);
}

.contact-empty-state {
    display: grid;
    place-items: center;
    gap: 10px;
    min-height: 190px;
    padding: 28px;
    border: 1px dashed #dbe5db;
    border-radius: 14px;
    background: #f8fbf8;
    text-align: center;
}

.contact-empty-state i {
    color: var(--primary-dark);
    font-size: 1.7rem;
}

.contact-empty-state p {
    margin: 0;
}

@media (max-width: 900px) {
    .contact-admin-header {
        flex-direction: column;
        padding: 16px;
    }

    .contact-admin-back {
        width: 100%;
        justify-content: center;
    }

    .submissions-table {
        display: block;
        border: 0;
        margin-top: 14px;
    }

    .submissions-table thead {
        display: none;
    }

    .submissions-table tbody {
        display: grid;
        gap: 12px;
    }

    .submissions-table tr.submission-row {
        display: grid;
        gap: 9px;
        margin-bottom: 0;
        padding: 14px;
        border: 1px solid #e6ece6;
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    }

    .submissions-table tr.submission-row.unread {
        border-left: 5px solid var(--warning);
        background: #fffaf0;
    }

    .submissions-table tr.submission-row:nth-child(even) {
        background: #fff;
    }

    .submissions-table tr.submission-row.unread:nth-child(even) {
        background: #fffaf0;
    }

    .submissions-table td {
        display: grid;
        grid-template-columns: minmax(94px, 0.35fr) minmax(0, 0.65fr);
        align-items: start;
        gap: 10px;
        min-height: 0;
        padding: 0;
        border-bottom: 0;
        text-align: left;
        overflow-wrap: anywhere;
    }

    .submissions-table td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.72rem;
        font-weight: 850;
        text-transform: uppercase;
    }

    .submissions-table .action-links {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        padding-left: 0;
        width: 100%;
    }

    .submissions-table .action-links::before {
        display: none;
    }

    .submission-action {
        width: 100%;
        min-height: 42px;
    }

    .inline-action-form {
        width: 100%;
    }

    .message-row {
        display: none;
        margin-top: -4px;
    }

    .message-row.is-open {
        display: block;
    }

    .message-row td {
        display: block;
        padding: 0 !important;
    }

    .message-row td::before {
        display: none;
    }

    .message-details {
        padding: 16px;
        border: 1px solid #e6ece6;
        border-radius: 14px;
        background: #fff;
    }
}

@media (max-width: 560px) {
    .contact-admin-stats {
        grid-template-columns: 1fr;
    }

    .contact-admin-filters {
        grid-template-columns: 1fr;
    }

    .contact-admin-header h2 {
        font-size: 1.45rem;
    }
}

/* --- 11. Footer --- */
.main-footer {
    padding: 60px 5%;
    background-color: var(--white);
    border-top: 1px solid #eee;
    text-align: center;
}

.main-footer p { color: var(--text-muted); margin: 0; }

/* --- 12. Admin Messages --- */
.success-message, .error-message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.success-message {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.error-message {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.success-message::before { content: "\f058"; font-family: "Font Awesome 6 Free"; }
.error-message::before { content: "\f06a"; font-family: "Font Awesome 6 Free"; }

/* --- 13. Contact Submissions (Admin) --- */
.page-actions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: var(--radius);
    border: 1px solid #eee;
}

.page-hierarchy-container {
    margin-top: 20px;
}

.page-tree-level {
    list-style: none;
    padding: 0;
    margin: 0;
}

.page-tree-level .page-tree-level {
    margin-left: 35px;
    border-left: 2px solid #f0f0f0;
    display: none; /* Skjul børn som standard */
}

li.has-children.open > .page-tree-level {
    display: block; /* Vis børn når åben */
}

.page-row {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: var(--white);
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: var(--transition);
}

.page-row:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.toggle-children, .toggle-children-placeholder {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

li.has-children.open > .page-row .toggle-children i {
    transform: rotate(90deg);
}

.page-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 0 10px;
}

.page-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-main);
}

.page-order {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: #f0f2f5;
    padding: 2px 10px;
    border-radius: 20px;
}

.action-links {
    display: flex;
    gap: 10px;
}

@media (max-width: 600px) {
    .page-row { flex-wrap: wrap; gap: 10px; }
    .page-info { width: 100%; order: 1; }
    .action-links { width: 100%; order: 2; justify-content: flex-end; }
    .page-tree-level .page-tree-level { margin-left: 15px; }
}
