/* styles.css */
:root {
    /* Light Theme */
    --bg-primary: #f7f9fc;
    --bg-secondary: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #576c7f;
    --accent-primary: #3498db;
    --accent-secondary: #2980b9;
    --border-color: #e1e8f0;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --input-bg: #edf2f7;
    --range-track: #d1d9e6; /* Fallback track color */
    --range-thumb: var(--accent-primary);
    --button-text: #ffffff;
    --warning-text-light: #e53e3e;
    --warning-text-dark: #fc8181;


    /* Sizes & Fonts */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --sidebar-width: 280px;
    --footer-height: 50px;
    --mobile-header-height: 60px;
    --mobile-nav-height: 65px;
    --logo-height-desktop: 30px;
    --logo-height-mobile: 24px;
    --button-icon-size: 1em; /* For desktop button icons */
}

body.dark-mode {
    /* Dark Theme */
    --bg-primary: #1a202c;
    --bg-secondary: #2d3748;
    --text-primary: #e2e8f0;
    --text-secondary: #a0aec0;
    --accent-primary: #4299e1;
    --accent-secondary: #3182ce;
    --border-color: #4a5568;
    --shadow-color: rgba(0, 0, 0, 0.25);
    --input-bg: #4a5568;
    --range-track: #718096;
}

/* Global Resets & Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}
body.mobile-panel-active {
    overflow-y: hidden;
}


#app-container {
    display: flex;
    flex-grow: 1;
    width: 100%;
}

/* --- Desktop Sidebar --- */
#controls {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: fixed;
    top: 20px;
    left: 20px;
    height: calc(100vh - 40px);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0px 5px 20px rgba(0,0,0,0.12);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, width 0.3s ease;
    z-index: 100;
}
#controls header#app-header {
    text-align: center;
    margin-bottom: 0px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}
#controls header#app-header .header-logo {
    height: var(--logo-height-desktop);
    width: auto;
    max-width: 90%;
    transition: filter 0.3s ease;
}

/* --- Logo Dark Mode Styling --- */
body.dark-mode .header-logo {
    filter: invert(1) hue-rotate(180deg) brightness(1.1);
}


.control-section {
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}
#controls header#app-header + .control-section,
.mobile-panel-content .control-section:first-child {
    border-top: none;
}
.control-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}
#effect-selector, #mobile-effect-selector {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}
#effect-selector:focus, #mobile-effect-selector:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}
body.dark-mode #effect-selector:focus,
body.dark-mode #mobile-effect-selector:focus {
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.3);
}
.spacer {
    flex-grow: 1;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
    margin-bottom: -1px;
}
.theme-control-section,
.action-buttons,
.support-section {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}
.support-section {
    border-bottom: none;
    padding-bottom: 0;
}
.control-section h2 {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 15px;
}
.control-group {
    display: grid;
    grid-template-areas:
        "label label"
        "slider value";
    grid-template-columns: 1fr auto;
    gap: 8px 10px;
    margin-bottom: 15px;
}
.control-group label {
    grid-area: label;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 2px;
}
.control-group input[type="range"] { grid-area: slider; }
.control-group .range-value {
    grid-area: value;
    font-size: 0.9rem;
    color: var(--text-secondary);
    min-width: 35px;
    text-align: right;
    align-self: center;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0;
}
#upload { display: none; }
.warning-text {
    color: var(--warning-text-light); font-size: 0.8rem; text-align: center;
    min-height: 1.2em; margin-top: 10px; width: 100%;
}
body.dark-mode .warning-text { color: var(--warning-text-dark); }


/* --- Range Input Styling --- */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: transparent;
    outline: none;
    cursor: pointer;
    margin: 6px 0;
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    border-radius: 5px;
    background: var(--range-track);
    transition: background 0.3s ease;
}

input[type="range"]::-moz-range-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    border-radius: 5px;
    background: var(--range-track);
    transition: background 0.3s ease;
    border: none;
}

/* Hue Slider (Rainbow) */
#hue::-webkit-slider-runnable-track,
#mobile-hue::-webkit-slider-runnable-track {
    background: linear-gradient(to right,
        hsl(0, 100%, 50%), hsl(60, 100%, 50%), hsl(120, 100%, 50%),
        hsl(180, 100%, 50%), hsl(240, 100%, 50%), hsl(300, 100%, 50%),
        hsl(0, 100%, 50%)
    );
}
#hue::-moz-range-track,
#mobile-hue::-moz-range-track {
     background: linear-gradient(to right,
        hsl(0, 100%, 50%), hsl(60, 100%, 50%), hsl(120, 100%, 50%),
        hsl(180, 100%, 50%), hsl(240, 100%, 50%), hsl(300, 100%, 50%),
        hsl(0, 100%, 50%)
    );
}

/* Saturation Slider (Grayscale to Accent Color) */
#saturation::-webkit-slider-runnable-track,
#mobile-saturation::-webkit-slider-runnable-track {
    background: linear-gradient(to right, #808080, var(--accent-primary));
}
#saturation::-moz-range-track,
#mobile-saturation::-moz-range-track {
    background: linear-gradient(to right, #808080, var(--accent-primary));
}

/* Brightness Slider (Black to White) */
#brightness::-webkit-slider-runnable-track,
#mobile-brightness::-webkit-slider-runnable-track {
    background: linear-gradient(to right, black, white);
}
#brightness::-moz-range-track,
#mobile-brightness::-moz-range-track {
    background: linear-gradient(to right, black, white);
}

/* Zoom, Circle Size, Brick Size, Dither Block Size Sliders (Subtle Accent Gradient) */
#zoom-slider::-webkit-slider-runnable-track, #mobile-zoom-slider::-webkit-slider-runnable-track,
#circle-size::-webkit-slider-runnable-track, #mobile-circle-size::-webkit-slider-runnable-track,
#brick-size::-webkit-slider-runnable-track, #mobile-brick-size::-webkit-slider-runnable-track,
#dither-block-size::-webkit-slider-runnable-track, /* Added dither block size */
#mobile-dither-block-size::-webkit-slider-runnable-track { /* Added mobile dither block size */
    background: linear-gradient(to right, color-mix(in srgb, var(--accent-primary) 30%, var(--input-bg)), var(--accent-primary));
    background: linear-gradient(to right, var(--input-bg), var(--accent-primary)); /* Fallback */
}
#zoom-slider::-moz-range-track, #mobile-zoom-slider::-moz-range-track,
#circle-size::-moz-range-track, #mobile-circle-size::-moz-range-track,
#brick-size::-moz-range-track, #mobile-brick-size::-moz-range-track,
#dither-block-size::-moz-range-track, /* Added dither block size */
#mobile-dither-block-size::-moz-range-track { /* Added mobile dither block size */
    background: linear-gradient(to right, color-mix(in srgb, var(--accent-primary) 30%, var(--input-bg)), var(--accent-primary));
    background: linear-gradient(to right, var(--input-bg), var(--accent-primary));  /* Fallback */
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--range-thumb);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--bg-secondary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    margin-top: -6px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--range-thumb);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--bg-secondary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* --- Buttons and Actions --- */
.action-buttons { display: flex; flex-direction: column; gap: 10px; }
button, .button-like-link {
    padding: 12px 15px; border-radius: 8px; cursor: pointer; font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
    border: 1px solid transparent; text-decoration: none; display: inline-flex; /* Changed to inline-flex */
    align-items: center; /* Vertically align icon and text */
    justify-content: center; /* Horizontally center icon and text */
    text-align: center; width: 100%;
    gap: 8px; /* Space between icon and text */
}
button .btn-icon, .button-like-link .btn-icon { /* Style for icons inside buttons */
    width: var(--button-icon-size);
    height: var(--button-icon-size);
    display: inline-block;
    vertical-align: middle;
    fill: currentColor; /* For SVG fill */
    stroke: currentColor; /* For SVG stroke */
}

.primary-button { background-color: var(--accent-primary); color: var(--button-text); }
.primary-button:hover { background-color: var(--accent-secondary); }
.secondary-button {
    background-color: transparent; color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
}
.secondary-button:hover { background-color: var(--accent-primary); color: var(--button-text); }
.secondary-button .btn-icon { /* Specific icon color for secondary */
    fill: var(--accent-primary);
    stroke: var(--accent-primary);
}
.secondary-button:hover .btn-icon {
    fill: var(--button-text);
    stroke: var(--button-text);
}


#theme-toggle, #mobile-theme-toggle {
    background-color: var(--input-bg); color: var(--text-secondary);
    border: 1px solid var(--border-color); width: auto;
    font-size: 0.9rem; padding: 8px 12px; border-radius: 6px;
    display: inline-flex; align-items: center; gap: 6px;
}
#theme-toggle .theme-toggle-text, #mobile-theme-toggle .theme-toggle-text {
    display: inline;
}
#theme-toggle:hover, #mobile-theme-toggle:hover {
    background-color: var(--border-color); border-color: var(--text-secondary);
}
body.dark-mode #theme-toggle, body.dark-mode #mobile-theme-toggle {
    background-color: var(--input-bg); color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
body.dark-mode #theme-toggle:hover, body.dark-mode #mobile-theme-toggle:hover {
    background-color: var(--border-color); border-color: var(--text-primary);
}

#donate-button {
    background-color: #ffde65; color: #333; font-weight: 600; border: none;
}
#donate-button:hover { background-color: #f9c74f; }
body.dark-mode #donate-button { background-color: #f9c74f;  color: #1A202C; }
body.dark-mode #donate-button:hover { background-color: #e0ac35; }

button:disabled, #mobile-bottom-nav button.disabled {
    background-color: var(--input-bg) !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-color) !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
}
button:disabled .btn-icon { /* Disabled icon state */
    fill: var(--text-secondary) !important;
    stroke: var(--text-secondary) !important;
    opacity: 0.7 !important;
}
#mobile-bottom-nav button.disabled .nav-icon {
    stroke: var(--text-secondary) !important;
    opacity: 0.5;
}
#mobile-bottom-nav button.disabled span {
    opacity: 0.5;
}


/* --- Main Content (Canvas Area) --- */
#canvas-container {
    flex-grow: 1; display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    padding: 30px; background-color: var(--bg-primary);
    margin-left: calc(var(--sidebar-width) + 20px + 20px);
    transition: background-color 0.3s ease, margin-left 0.3s ease;
    overflow: auto;
    height: calc(100vh - var(--footer-height));
}
#imageCanvas {
    display: none; border-radius: 8px;
    box-shadow: 0 4px 15px var(--shadow-color);
    background-color: var(--bg-secondary);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}
.placeholder {
    color: var(--text-secondary); font-size: 1.2rem; text-align: center;
    cursor: pointer; padding: 30px 40px; border: 2px dashed var(--border-color);
    border-radius: 12px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 15px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    min-width: 250px; max-width: 350px; min-height: 150px;
    background-color: var(--bg-secondary); box-shadow: 0 2px 8px var(--shadow-color);
}
.placeholder:hover {
    border-color: var(--accent-primary); background-color: var(--input-bg);
}
body.dark-mode .placeholder { background-color: var(--bg-secondary); }
body.dark-mode .placeholder:hover { background-color: var(--input-bg); }
.placeholder svg.placeholder-icon {
    width: 40px; height: 40px; stroke: var(--text-secondary);
    transition: stroke 0.2s ease;
}
.placeholder:hover svg.placeholder-icon { stroke: var(--accent-primary); }
.placeholder span { font-size: 1rem; color: var(--text-secondary); }


/* --- Footer --- */
#app-footer {
    text-align: center; padding: 15px; font-size: 0.9rem;
    color: var(--text-secondary); background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color); width: 100%;
    height: var(--footer-height);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}
#app-footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
}
#app-footer a:hover {
    text-decoration: underline;
    color: var(--accent-secondary);
}


/* --- Mobile Specific UI --- */
#mobile-header, #mobile-bottom-nav, .mobile-panel {
    display: none;
}


/* --- Responsive Design --- */
@media (max-width: 900px) { /* Tablet */
    #controls {
        left: 15px; top: 15px; height: calc(100vh - 30px);
        max-height: calc(100vh - 30px);
    }
    #canvas-container {
        margin-left: calc(var(--sidebar-width) + 15px + 15px);
        padding: 20px;
    }
}

@media (max-width: 768px) { /* Mobile */
    body { overflow-y: auto; }
    #app-container { flex-direction: column; }

    #controls { display: none !important; }

    #mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 15px;
        height: var(--mobile-header-height);
        background-color: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 200;
        box-shadow: 0 2px 5px var(--shadow-color);
    }
    #mobile-header .header-logo {
        height: var(--logo-height-mobile);
        width: auto;
        max-width: 70%;
        transition: filter 0.3s ease;
    }
    #mobile-theme-toggle .theme-toggle-text {
        display: none;
    }

    #canvas-container {
        margin-left: 0;
        flex-grow: 1;
        padding: 15px;
        padding-top: calc(var(--mobile-header-height) + 15px);
        padding-bottom: calc(var(--mobile-nav-height) + 15px);
        height: auto;
        min-height: calc(100vh - var(--mobile-header-height) - var(--mobile-nav-height) - var(--footer-height));
        width: 100%;
    }
    .placeholder { padding: 20px; min-width: 80%; }
    .placeholder svg.placeholder-icon { width: 32px; height: 32px; }
    .placeholder span { font-size: 0.9rem; }

    .mobile-panel {
        display: flex;
        flex-direction: column;
        position: fixed;
        bottom: var(--mobile-nav-height);
        left: 0;
        width: 100%;
        max-height: calc(60vh - var(--mobile-nav-height));
        background-color: var(--bg-secondary);
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -2px 10px var(--shadow-color);
        transform: translateY(100%);
        transition: transform 0.3s ease-in-out;
        z-index: 150;
        border-top-left-radius: 12px;
        border-top-right-radius: 12px;
    }
    .mobile-panel.active {
        transform: translateY(0);
    }
    .mobile-panel-header {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 12px 15px;
        border-bottom: 1px solid var(--border-color);
    }
    .mobile-panel-header h2 {
        font-size: 1.1rem;
        margin-bottom: 0;
        font-weight: 500;
    }

    .mobile-panel-content {
        padding: 15px;
        overflow-y: auto;
        flex-grow: 1;
    }
    .mobile-panel-content .control-section {
       border-bottom: 1px solid var(--border-color);
       padding-bottom: 15px;
       margin-bottom: 15px;
    }
     .mobile-panel-content .control-section:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }

    #mobile-bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: var(--mobile-nav-height);
        background-color: var(--bg-secondary);
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -2px 5px var(--shadow-color);
        z-index: 200;
        padding: 0 5px;
    }
    #mobile-bottom-nav button {
        background: none;
        border: none;
        color: var(--text-secondary);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 6px 3px;
        font-size: 0.65rem;
        flex-grow: 1;
        flex-basis: 0;
        height: 100%;
        gap: 3px;
        border-radius: 0;
        text-align: center;
        min-width: 0;
    }
    #mobile-bottom-nav button .nav-icon {
        width: 20px;
        height: 20px;
        stroke: var(--text-secondary);
        transition: stroke 0.2s ease;
        margin-bottom: 2px;
    }
    #mobile-bottom-nav button:hover .nav-icon,
    #mobile-bottom-nav button.active .nav-icon {
        stroke: var(--accent-primary);
    }
    #mobile-bottom-nav button:hover span,
    #mobile-bottom-nav button.active span {
        color: var(--accent-primary);
    }
    #mobile-bottom-nav button.disabled .nav-icon {
        stroke: var(--text-secondary) !important;
        opacity: 0.5;
    }
     #mobile-bottom-nav button.disabled span {
        color: var(--text-secondary) !important;
        opacity: 0.5;
    }

    #app-footer {
        position: relative;
        padding-bottom: 15px;
    }
}

/* Scrollbar styling */
@media (min-width: 769px) {
    #controls::-webkit-scrollbar { width: 8px; }
    #controls::-webkit-scrollbar-track { background: transparent; }
    #controls::-webkit-scrollbar-thumb {
        background-color: var(--range-track); border-radius: 10px;
        border: 2px solid var(--bg-secondary);
    }
    body.dark-mode #controls::-webkit-scrollbar-thumb { border: 2px solid var(--bg-secondary); }
    #controls { scrollbar-width: thin; scrollbar-color: var(--range-track) transparent; }
}
.mobile-panel-content::-webkit-scrollbar { width: 6px; }
.mobile-panel-content::-webkit-scrollbar-track { background: transparent; }
.mobile-panel-content::-webkit-scrollbar-thumb {
    background-color: var(--range-track); border-radius: 10px;
    border: 1px solid var(--bg-secondary);
}
body.dark-mode .mobile-panel-content::-webkit-scrollbar-thumb { border: 1px solid var(--bg-secondary); }
.mobile-panel-content { scrollbar-width: thin; scrollbar-color: var(--range-track) transparent; }

/* styles.css */
/* ... (Keep all existing styles unless specified) ... */

/* --- Floating Action Buttons (Desktop) --- */
#floating-action-buttons {
    position: fixed;
    bottom: 25px; /* Adjusted for footer */
    right: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1000; /* Ensure it's above most content */
}

.fab-button {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px; /* Rounded square, or 50% for circle */
    width: auto; /* Auto width based on content */
    min-width: 56px; /* Minimum touch target / visual size */
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center; /* Center icon and text if side-by-side */
    padding: 0 16px; /* Padding for text */
    box-shadow: 0 4px 12px var(--shadow-color);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-decoration: none; /* For the <a> tag */
    font-size: 0.9rem;
    font-weight: 500;
    gap: 8px; /* Space between icon and text */
}

.fab-button svg {
    width: 22px; /* Icon size */
    height: 22px;
    fill: currentColor;
}

.fab-button:hover {
    background-color: var(--input-bg);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 16px var(--shadow-color);
}

/* Specific style for the donate button if it's different */
#donate-button.fab-button {
    /* Keep existing special colors or let it inherit .fab-button default */
    /* Example: if you want it to stand out */
    /* background-color: #ffde65; color: #333; */
}
/* body.dark-mode #donate-button.fab-button {
    background-color: #f9c74f;  color: #1A202C;
} */


/* --- About Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1050; /* Above FABs */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0s linear 0s;
}

.modal-content {
    background-color: var(--bg-secondary);
    padding: 25px 30px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 480px;
    position: relative;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s ease, opacity 0.25s ease;
    opacity: 0;
}
.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 600;
}

.modal-content p {
    margin-bottom: 10px;
    line-height: 1.65;
    color: var(--text-secondary);
    font-size: 0.95rem;
}
.modal-content p:last-of-type {
    margin-bottom: 0;
}

.modal-close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.8rem;
    font-weight: 300;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 5px;
    z-index: 1061; /* Higher than modal overlay */
    width: auto; /* Ensure width doesn't get stretched */
    height: auto; /* Ensure height doesn't get stretched */
}

.modal-close-button:hover {
    color: var(--text-primary);
}


/* --- Mobile Dropdown Panels --- */
.mobile-dropdown-panel {
    display: none; /* Hidden by default, JS will toggle */
    position: fixed;
    /* Position will be dynamically adjusted by JS or relative to nav item */
    /* For now, a general bottom positioning that JS can override if needed */
    bottom: calc(var(--mobile-nav-height) + 5px); /* Above nav bar */
    left: 50%; /* Will be fine-tuned based on which button it's for */
    transform: translateX(-50%) translateY(10px); /* Start slightly below and centered */
    width: auto;
    min-width: 160px;
    max-width: 220px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 -3px 15px rgba(0,0,0,0.1);
    z-index: 210; /* Above mobile nav, below modal */
    transition: transform 0.2s ease-in-out, opacity 0.2s ease-in-out;
    opacity: 0;
    padding: 6px;
}

.mobile-dropdown-panel.active {
    display: flex; /* Use flex for items inside */
    flex-direction: column;
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.mobile-dropdown-panel button {
    background-color: transparent;
    border: none;
    color: var(--text-primary);
    padding: 10px 15px;
    text-align: left;
    width: 100%;
    font-size: 0.9rem;
    font-weight: 400;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.15s ease;
    white-space: nowrap;
}

.mobile-dropdown-panel button:hover {
    background-color: var(--input-bg);
}
body.dark-mode .mobile-dropdown-panel button:hover {
    background-color: color-mix(in srgb, var(--input-bg) 90%, #000);
}


/* Modify existing #mobile-bottom-nav button styles if needed */
/* For example, to ensure they are evenly spaced */
#mobile-bottom-nav {
    justify-content: space-evenly; /* Or space-around for more space */
}


/* --- Responsive Design --- */
@media (max-width: 768px) { /* Mobile */
    /* ... (previous mobile styles) ... */

    #floating-action-buttons {
        display: none; /* Hide desktop FABs on mobile */
    }

    /* Footer padding to avoid overlap with mobile nav */
    #app-footer {
        padding-bottom: calc(var(--mobile-nav-height) + 15px);
    }
    /* Ensure canvas container has enough bottom padding too */
     #canvas-container {
        padding-bottom: calc(var(--mobile-nav-height) + 15px + 15px); /* nav + its own padding */
    }
}

@media (min-width: 769px) { /* Desktop and larger */
    .mobile-dropdown-panel {
        display: none !important; /* Ensure mobile dropdowns are hidden on desktop */
    }
}

/* Ensure footer doesn't overlap FABs on desktop */
@media (min-width: 769px) {
    #app-footer {
        /* Adjust padding-right if FABs are very wide, or use margin on FABs */
        /* margin-bottom: 70px; /* If FABs are tall and footer is fixed/sticky */
    }
}