/* Base styles to prevent text from being too small */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.content-block {
    font-size: 18px; /* Larger base font size */
}

/* Ensure minimum text size on mobile */
@media screen and (max-width: 600px) {
    .content-block {
        font-size: max(50px, 11vw); /* Doubled from 25px */
    }
    
    .content-block h1 { font-size: max(64px, 14vw) !important; }
    .content-block h2 { font-size: max(56px, 12vw) !important; }
    .content-block h3 { font-size: max(52px, 11vw) !important; }
    .content-block p, 
    .content-block div,
    .content-block span { 
        font-size: inherit !important;
        min-font-size: 50px !important;
    }
}

@media only screen and (max-width: 600px) {
    /* Ensure consistent text sizing on mobile */
    .content-block .content {
        font-size: 50px !important; /* Doubled from 25px */
        line-height: 1.5 !important;
        -webkit-text-size-adjust: 100% !important; /* Prevent iOS auto text sizing */
        text-size-adjust: 100% !important;
    }

    /* Force all text elements to respect relative sizing */
    .content-block .content h1 { font-size: 1.5em !important; }
    .content-block .content h2 { font-size: 1.3em !important; }
    .content-block .content h3 { font-size: 1.2em !important; }
    .content-block .content h4 { font-size: 1.1em !important; }
    .content-block .content p,
    .content-block .content div,
    .content-block .content span,
    .content-block .content li { 
        font-size: inherit !important;
        line-height: inherit !important;
    }

    /* Ensure links and buttons maintain readable size */
    .content-block .content a,
    .content-block .content button {
        font-size: inherit !important;
        line-height: inherit !important;
    }

    /* Reset body and container margins */
    body {
        margin: 0 !important;
        padding: 0 !important;
        overflow-x: hidden !important;
        width: 100% !important;
        position: relative !important;
    }

    /* Navbar specific mobile styles */
    .nav-block .content {
        flex-wrap: wrap !important;
        gap: 5px !important;
        padding: 5px !important;
    }

    .nav-block a {
        font-size: 0.9em !important;
        padding: 3px 6px !important;
        white-space: normal !important;
        text-align: center !important;
        flex: 0 1 auto !important;
    }

    .nav-block .admin-links {
        flex-wrap: wrap !important;
        gap: 5px !important;
        justify-content: flex-start !important;
        width: auto !important;
    }

    /* Target the main containers */
    .content-blocks-container,
    .content-blocks-container > div {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
        box-sizing: border-box !important;
    }

    .content-block-wrapper,
    .content-block .content,
    .nav-block .content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
    }

    /* Handle images and figures */
    .content-block figure,
    .content-block figure.image,
    .content-block .image {
        margin: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        position: relative !important;
    }

    /* Respect custom image sizes */
    .content-block figure img[style*="width"],
    .content-block .image img[style*="width"] {
        height: auto !important;
        max-width: 100% !important;
    }

    /* Default image handling if no custom size */
    .content-block figure img:not([style*="width"]),
    .content-block .image img:not([style*="width"]) {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
    }

    /* Specific logo handling */
    img[src*="logo"],
    .logo img {
        width: 80% !important;
        height: auto !important;
        max-width: 80% !important;
        margin: 0 auto !important;
        display: block !important;
    }

    /* Image captions */
    .content-block figure.image > figcaption,
    .content-block .image figcaption {
        background: none !important;
        min-width: unset !important;
        color: currentColor !important;
        font-size: 0.9em !important;
        background-color: transparent !important;
        width: 100% !important;
        margin: 5px 0 !important;
        padding: 0 !important;
        text-align: center !important;
    }

    /* Navigation */
    .nav-block {
        width: 100% !important;
        margin: 0 !important;
        position: relative !important;
    }

    .nav-block .content {
        flex-direction: row !important; /* Changed to row to allow wrapping */
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
        align-items: center !important;
        width: 100% !important;
        padding: 5px !important;
        position: relative !important;
        gap: 5px !important;
    }

    /* Force all containers to be relative positioned */
    html, body, div {
        position: relative !important;
        overflow-x: hidden !important;
    }

    /* Remove any margins from html and body */
    html, body {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

@media (max-width: 600px), (max-device-width: 600px) {
    /* Mobile-only content overflow prevention */
    .content-block {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }
    
    .content-block img {
        max-width: calc(100% - 40px) !important;
        height: auto !important;
    }
    
    .content-block .content {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
}

/* Full width navbar fixes */
html body .nav-block {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 20px 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

html body .nav-block .content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 20px !important;
    box-sizing: border-box !important;
}

@media (max-width: 600px), (max-device-width: 600px) {
    html body .nav-block,
    html body nav.nav-block {
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
        padding: 20px 0 !important;
        left: 0 !important;
        right: 0 !important;
        position: relative !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    html body .nav-block .content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 20px !important;
        box-sizing: border-box !important;
    }

    /* Ensure no horizontal scroll */
    html, body {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
}

/* Mobile navbar overrides */
@media (max-width: 600px), (max-device-width: 600px) {
    html body .nav-block,
    html body .nav-block *,
    html body .nav-block .content,
    html body .nav-block .nav-links,
    html body .nav-block .admin-links,
    html body .nav-block .nav-links a,
    html body .nav-block .admin-links a,
    html body .nav-block .logout-link {
        font-size: 50px !important;
        line-height: 1.5 !important;
    }

    html body .nav-block {
        padding: 20px 0 !important;
    }

    html body .nav-block .content {
        padding: 0 30px !important;
        flex-direction: column !important;
        gap: 20px !important;
    }

    html body .nav-block .nav-links,
    html body .nav-block .admin-links {
        gap: 30px !important;
        padding: 10px 0 !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
    }

    html body .nav-block .nav-links a,
    html body .nav-block .admin-links a {
        padding: 10px 20px !important;
    }
}

/* Touch device overrides */
@media only screen and (hover: none) and (pointer: coarse) {
    html body .nav-block,
    html body .nav-block *,
    html body .nav-block .content,
    html body .nav-block .nav-links,
    html body .nav-block .admin-links,
    html body .nav-block .nav-links a,
    html body .nav-block .admin-links a,
    html body .nav-block .logout-link {
        font-size: 50px !important;
        line-height: 1.5 !important;
    }

    html body .nav-block {
        padding: 20px 0 !important;
    }

    html body .nav-block .content {
        padding: 0 30px !important;
        flex-direction: column !important;
        gap: 20px !important;
    }

    html body .nav-block .nav-links,
    html body .nav-block .admin-links {
        gap: 30px !important;
        padding: 10px 0 !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
    }

    html body .nav-block .nav-links a,
    html body .nav-block .admin-links a {
        padding: 10px 20px !important;
    }
}

/* Mobile-first base styles */
html, body {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* More specific selectors for mobile */
@media (max-width: 600px), (max-device-width: 600px) {
    body .content-block,
    body .content-block .content,
    body .content-block * {
        font-size: 50px !important;
        line-height: 1.5 !important;
    }

    body .content-block h1,
    body .content-block .content h1 {
        font-size: 64px !important;
    }

    body .content-block h2,
    body .content-block .content h2 {
        font-size: 56px !important;
    }

    body .content-block h3,
    body .content-block .content h3 {
        font-size: 52px !important;
    }

    body .content-block p,
    body .content-block div:not(.content-block),
    body .content-block span,
    body .content-block a,
    body .content-block li {
        font-size: 50px !important;
        min-height: 1.5em;
    }

    /* Navbar text sizing */
    body nav.navbar,
    body nav.navbar a,
    body nav.navbar span,
    body nav.navbar div,
    body .navbar-links a,
    body .admin-links a {
        font-size: 50px !important;
        line-height: 1.5 !important;
    }

    /* Adjust navbar padding for larger text */
    body nav.navbar {
        padding: 20px !important;
    }

    body nav.navbar .navbar-links,
    body nav.navbar .admin-links {
        gap: 20px !important;
        padding: 10px 0 !important;
    }
}

/* Super specific mobile navbar styles */
@media (max-width: 600px), (max-device-width: 600px) {
    body[style] nav.navbar,
    body[style] div.navbar-container,
    html body nav.navbar *,
    html body .navbar-container *,
    html body .navbar-links *,
    html body .admin-links *,
    html body nav.navbar a,
    html body .navbar-links a,
    html body .admin-links a,
    html body nav.navbar span,
    html body nav.navbar div {
        font-size: 50px !important;
        line-height: 1.5 !important;
        -webkit-text-size-adjust: none !important;
        text-size-adjust: none !important;
    }

    /* Override any existing styles */
    html body nav.navbar .navbar-links a,
    html body nav.navbar .admin-links a {
        font-size: 50px !important;
    }

    /* Ensure padding and spacing */
    html body nav.navbar {
        padding: 30px 20px !important;
    }

    html body nav.navbar .navbar-links,
    html body nav.navbar .admin-links {
        gap: 30px !important;
        padding: 15px 0 !important;
    }
}

/* Additional touch device targeting */
@media only screen and (hover: none) and (pointer: coarse) {
    body[style] nav.navbar,
    body[style] div.navbar-container,
    html body nav.navbar *,
    html body .navbar-container *,
    html body .navbar-links *,
    html body .admin-links *,
    html body nav.navbar a,
    html body .navbar-links a,
    html body .admin-links a,
    html body nav.navbar span,
    html body nav.navbar div {
        font-size: 50px !important;
        line-height: 1.5 !important;
        -webkit-text-size-adjust: none !important;
        text-size-adjust: none !important;
    }

    /* Override any existing styles */
    html body nav.navbar .navbar-links a,
    html body nav.navbar .admin-links a {
        font-size: 50px !important;
    }

    /* Ensure padding and spacing */
    html body nav.navbar {
        padding: 30px 20px !important;
    }

    html body nav.navbar .navbar-links,
    html body nav.navbar .admin-links {
        gap: 30px !important;
        padding: 15px 0 !important;
    }
}

/* Ensure these styles apply to all mobile browsers */
@media only screen and (hover: none) and (pointer: coarse) {
    body .content-block,
    body .content-block .content,
    body .content-block * {
        font-size: 50px !important;
        line-height: 1.5 !important;
    }

    body .content-block h1,
    body .content-block .content h1 {
        font-size: 64px !important;
    }

    body .content-block h2,
    body .content-block .content h2 {
        font-size: 56px !important;
    }

    body .content-block h3,
    body .content-block .content h3 {
        font-size: 52px !important;
    }

    body .content-block p,
    body .content-block div:not(.content-block),
    body .content-block span,
    body .content-block a,
    body .content-block li {
        font-size: 50px !important;
        min-height: 1.5em;
    }

    /* Navbar text sizing */
    body nav.navbar,
    body nav.navbar a,
    body nav.navbar span,
    body nav.navbar div,
    body .navbar-links a,
    body .admin-links a {
        font-size: 50px !important;
        line-height: 1.5 !important;
    }

    /* Adjust navbar padding for larger text */
    body nav.navbar {
        padding: 20px !important;
    }

    body nav.navbar .navbar-links,
    body nav.navbar .admin-links {
        gap: 20px !important;
        padding: 10px 0 !important;
    }
}

/* Basic reset */
* {
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Content Blocks */
header, footer {
    background-color: inherit;
}

.content-block {
    width: 100%;
}

.content-block.header,
.content-block.footer {
    width: 100%;
    margin: 0;
    border-radius: 0;
}

.content-block .content {
    background-color: transparent;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    line-height: 1.8;
}

/* Navigation */
.nav-block {
    width: 100%;
    margin-bottom: 20px;
}

.nav-block .content {
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: flex-start;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    gap: 10px;
}

.nav-block a {
    text-decoration: none;
    padding: 5px 10px;
    margin: 0;
    border-radius: 3px;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.nav-block .admin-links {
    margin-left: auto;
    display: flex;
    gap: 10px;
    padding-left: 20px;
}

/* Admin Area Styles */
.admin-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.page-selector {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.page-selector select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

/* Page Selector Styles */
.page-selector {
    margin: 20px;
}

.admin-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background-color: white;
    font-size: 16px;
}

.admin-select:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.admin-select optgroup {
    font-weight: bold;
    color: #495057;
}

.admin-select option {
    padding: 8px;
}

.content-block-wrapper {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    margin-bottom: 30px;
}

.content-form {
    padding: 30px;
    margin: 30px 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.content-divider {
    margin: 40px 0;
    border: none;
    border-top: 1px solid #e0e0e0;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.form-group input[type="color"] {
    width: 100px;
    height: 40px;
    padding: 2px;
    cursor: pointer;
}

.color-preview {
    width: 100px;
    height: 30px;
    border-radius: 4px;
    margin-top: 10px;
    border: 1px solid #e0e0e0;
}

.button-group {
    margin-top: 30px;
    display: flex;
    gap: 15px;
}

.admin-button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.2s;
}

.admin-button:hover {
    opacity: 0.9;
}

.delete-button {
    background-color: #dc3545 !important;
}

.section-header {
    padding: 10px 20px;
    border-radius: 8px 8px 0 0;
    margin: -20px -20px 20px -20px;
}

.error-message {
    color: #dc3545;
    padding: 10px;
    background: #f8d7da;
    border-radius: 4px;
    margin-bottom: 20px;
}

.success-message {
    color: #28a745;
    padding: 10px;
    background: #d4edda;
    border-radius: 4px;
    margin-bottom: 20px;
}

.error-message,
.success-message {
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

optgroup {
    font-weight: bold;
}

/* CKEditor Image Styles */
.content-block .content figure.image {
    margin: 1em 0;
    clear: both;
}

.content-block .content figure.image.image-style-align-left {
    float: left;
    margin-right: 1em;
    max-width: 50%;
}

.content-block .content figure.image.image-style-align-right {
    float: right;
    margin-left: 1em;
    max-width: 50%;
}

.content-block .content figure.image.image-style-align-center {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    display: table;
}

.content-block .content figure.image.image-style-side {
    float: right;
    margin-left: 1em;
    width: 33%;
}

.content-block .content figure.image.image-style-block {
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    display: table;
}

.content-block .content figure.image img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.content-block .content figure.image > figcaption {
    display: table-caption;
    caption-side: bottom;
    text-align: center;
    color: #333;
    background-color: #f7f7f7;
    padding: 0.6em;
    font-size: 0.8em;
}

/* Clear fix for floated images */
.content-block .content::after {
    content: "";
    display: table;
    clear: both;
}

/* Editor Preview Styles */
.trumbowyg-editor {
    min-height: 200px;
}

.preview-block {
    margin-top: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.preview-block-header {
    padding: 10px 15px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    font-weight: bold;
}

.preview-content {
    padding: 20px;
}

/* Table Styles */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    border-radius: 8px;
    overflow: hidden;
}

.admin-table th,
.admin-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.admin-table th {
    background: #f5f5f5;
    font-weight: bold;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

/* Admin Content Wrapper */
.admin-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.content-block-wrapper {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    overflow: hidden;
    margin: 20px 0;
}

.section-header {
    padding: 20px;
    margin-bottom: 20px;
}

.section-header h2 {
    margin: 0;
    font-size: 24px;
}

/* Header and footer specific styles */
header .content-block .content,
footer .content-block .content {
    text-align: left; /* Default alignment */
}

header .content-block .content.center,
footer .content-block .content.center {
    text-align: center;
}

header .content-block .content.right,
footer .content-block .content.right {
    text-align: right;
}

header .content-block img,
footer .content-block img {
    display: block;
    margin: 0 auto;
}

footer {
    text-align: center;
    margin-top: 2rem;
}

/* Navigation styles */
.nav-block .page-links {
    display: inline-block;
}

.nav-block a:hover {
    text-decoration: underline;
}

.block-image {
    max-width: 100%;
    height: auto;
    margin-bottom: 1rem;
}

h1 {
    text-align: center;
    margin-bottom: 2rem;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

pageMotto {
    display: block;
    text-align: center;
    padding: 0.5rem;
    background-color: #333;
    color: white;
    margin-bottom: 1rem;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2rem;
}

nav a {
    text-decoration: none;
    color: #333;
    font-weight: bold;
}

nav a:hover {
    color: #666;
}
