/* Google Fonts - Open Sans for body, Montserrat for headings */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&family=Open+Sans:wght@400;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;700&display=swap');

:root {
    --primary-blue: #007bff; /* A vibrant blue, similar to projectcsgirls */
    --secondary-blue: #0056b3; /* Darker blue for hover/accents */
    --light-gray: #f8f9fa;
    --medium-gray: #eceeef;
    --dark-gray-text: #343a40;
    --white-text: #ffffff;
    --border-color: #dee2e6;
    --page-background-color: var(--light-gray); /* New global background color variable */
    --gradient-start-color: #007bff; /* Default start color for gradients */
    --gradient-end-color: #6f42c1;   /* Default end color for gradients (purple) */

    --header-background-color: var(--white-text); /* Header solid background */
    --header-gradient-start-color: #007bff; /* Header gradient start color */
    --header-gradient-end-color: #6f42c1;   /* Default end for header gradients */

    --font-family-default-heading: 'Montserrat', sans-serif;
    --font-family-default-body: 'Open Sans', sans-serif;
    --font-family-serif: 'Playfair Display', serif;
    --font-family-monospace: 'Roboto Mono', monospace;

    --global-font-family-heading: var(--font-family-default-heading);
    --global-font-family-body: var(--font-family-default-body);
}

body {
    margin: 0;
    font-family: var(--global-font-family-body);
    color: var(--dark-gray-text);
    line-height: 1.6;
    background: linear-gradient(180deg, #f4f4f5 0%, #d9d9da 100%);
    background-attachment: fixed;
    display: flex; /* Enable flex container */
    flex-direction: column; /* Stack children vertically */
    min-height: 100vh; /* Make body at least viewport height */
}

main {
    flex-grow: 1; /* Allow main content to take up available space */
}

/* Gradient Backgrounds */
.gradient-blue-purple {
    background: linear-gradient(135deg, var(--gradient-start-color), var(--gradient-end-color));
}

.gradient-green-teal {
    background: linear-gradient(135deg, #28a745, #20c997); /* Example: Green to Teal */
}

/* Header-specific Gradient Backgrounds */
.header-gradient-blue-purple {
    background: linear-gradient(135deg, var(--header-gradient-start-color), var(--header-gradient-end-color));
}

.header-gradient-green-teal {
    background: linear-gradient(135deg, #28a745, #20c997);
}

/* Dropdown section styling */
.dropdown-section {
    margin-bottom: 1rem;
}

.dropdown-section summary {
    padding: 1rem;
    background-color: var(--light-gray);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    outline: none;
    transition: background-color 0.3s ease, font-size 0.3s ease;
}

.dropdown-section summary:hover {
    background-color: var(--medium-gray);
}

/* Enlarge text and background slightly when dropdown is open */
.dropdown-section[open] summary {
    background-color: var(--medium-gray); /* Keep hover color on open */
}

.dropdown-section[open] summary h2.editable-text {
    font-size: 1.1em; /* Slightly larger font for heading */
}

.dropdown-section[open] .dropdown-content {
    padding: 1.2rem; /* Slightly enlarge padding/background area */
    background-color: #f0f8ff; /* A slightly lighter blue to show enlargement */
}

.dropdown-section summary h2 {
    margin: 0; /* Remove default margin from h2 inside summary */
}

.dropdown-content {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-top: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    background-color: var(--page-background-color);
    color: var(--dark-gray-text);
    transition: all 0.3s ease-out;
}

/* Soft blue background for text */
.soft-blue-bg {
    background-color: #e0f2f7; /* A soft, light blue */
}

/* Banner transition effect (fading in) */
.banner-transition {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.dropdown-section[open] .banner-transition {
    opacity: 1;
    transform: translateY(0);
}

/* Header and Navigation */
header {
    background-color: var(--header-background-color);
    color: var(--white-text);
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo-area .logo {
    font-family: var(--global-font-family-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-blue);
    text-decoration: none;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

nav ul li {
    margin-left: 30px;
}

nav ul li a {
    color: var(--dark-gray-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.3s ease;
}

nav ul li a:hover {
    color: var(--primary-blue);
}

.donate-button {
    background-color: var(--primary-blue);
    color: var(--white-text) !important;
    padding: 8px 18px;
    border-radius: 5px;
    text-decoration: none !important;
    margin-left: 30px;
    transition: background-color 0.3s ease;
}

.donate-button:hover {
    background-color: var(--secondary-blue);
}

/* Hero Section */
.hero-section {
    background-color: var(--page-background-color);
    padding: 80px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.hero-content h1 {
    font-family: var(--global-font-family-heading);
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 15px;
    line-height: 1.2;
}

.hero-content p {
    font-family: var(--global-font-family-body);
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto 30px auto;
}

.hero-cta {
    background-color: var(--primary-blue);
    color: var(--white-text);
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.hero-cta:hover {
    background-color: var(--secondary-blue);
}

.hero-image-container {
    width: 80%; /* Adjust size as needed */
    max-width: 800px;
    height: 400px; /* Adjust height as needed */
    background-color: var(--page-background-color);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.hero-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Content Sections */
.content-section-new {
    max-width: 1200px;
    margin: 60px auto;
    padding: 40px 20px;
    background-color: var(--white-text);
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,.05);
}

.content-section-new h2 {
    font-family: var(--global-font-family-heading);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark-gray-text);
    text-align: center;
    margin-bottom: 40px;
}

/* Our Story */
#our-story .story-content {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

#our-story .story-content p {
    font-family: var(--global-font-family-body);
    font-size: 1.1rem;
    margin-bottom: 20px;
}

/* Our Sponsors */
#our-sponsors .sponsors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    justify-items: center;
    align-items: center;
    margin-top: 40px;
}

.sponsor-logo-placeholder {
    width: 180px;
    height: 100px;
    background-color: var(--page-background-color);
    border: 1px dashed var(--border-color);
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.sponsor-logo-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

/* Main Calls to Action Grid */
#main-calls-to-action .cta-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.cta-card {
    background-color: var(--white-text);
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,.05);
    padding: 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.cta-image-placeholder {
    width: 100%;
    height: 180px;
    background-color: var(--page-background-color);
    border: 1px dashed var(--border-color);
    border-radius: 5px;
    margin-bottom: 15px;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cta-image-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cta-card h3 {
    font-family: var(--global-font-family-heading);
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 10px;
}

.cta-card p {
    font-family: var(--global-font-family-body);
    font-size: 1rem;
    flex-grow: 1;
    margin-bottom: 20px;
}

.cta-button {
    background-color: var(--primary-blue);
    color: var(--white-text);
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.cta-button:hover {
    background-color: var(--secondary-blue);
}

/* Image Replacement Tool Styles */
.image-replacement-tool {
    cursor: pointer;
    position: relative;
}

.image-replacement-tool .image-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 5; /* Ensure it's clickable */
}

.image-replacement-tool .replace-image-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--dark-gray-text);
    font-size: 0.9rem;
    pointer-events: none; /* Allow clicks to pass through to the input */
    background-color: rgba(255, 255, 255, 0.7);
    padding: 5px 10px;
    border-radius: 3px;
}

.image-replacement-tool.has-image .replace-image-text {
    display: none;
}

/* Footer */
footer {
    background-color: var(--dark-gray-text);
    color: var(--white-text);
    padding: 40px 20px;
    text-align: center;
    margin-top: 60px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.footer-content p {
    font-family: var(--global-font-family-body);
}

.footer-links a {
    color: var(--white-text);
    text-decoration: none;
    margin: 0 15px;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--primary-blue);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    nav {
        flex-direction: column;
        gap: 15px;
    }

    nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }

    nav ul li {
        margin: 5px 15px;
    }

    .donate-button {
        margin-left: 0;
        margin-top: 10px;
    }

    .hero-section {
        padding: 60px 15px;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .hero-image-container {
        width: 95%;
        height: 250px;
    }

    .content-section-new h2 {
        font-size: 2rem;
    }

    #our-sponsors .sponsors-grid {
        grid-template-columns: 1fr;
    }

    .sponsor-logo-placeholder {
        width: 100%;
    }

    #main-calls-to-action .cta-cards-grid {
        grid-template-columns: 1fr;
    }

    .cta-card {
        max-width: 100%;
    }

    .footer-links a {
        margin: 0 10px;
    }
}

/* Color Picker Tool */
#color-picker-tool {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 0 5px 5px 0;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    z-index: 10000; /* Ensure it's above everything else */
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

#text-customization-tool {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(0); /* Adjusted for all three tools to be visible */
    background-color: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 0 5px 5px 0;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    z-index: 10002; /* Higher than color picker, lower than clipart */
    display: none; /* Changed to none */
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    max-width: 250px;
    transition: transform 0.3s ease-in-out;
}

#text-customization-tool h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--dark-gray-text);
    display: inline-block; /* Make heading inline */
    vertical-align: middle; /* Align with button */
}

#text-customization-tool #save-text-changes-btn {
    margin-left: 10px; /* Space between heading and button */
    padding: 5px 10px; /* Adjust padding for smaller button */
    font-size: 0.85rem; /* Smaller font size */
    vertical-align: middle; /* Align with heading */
}

#text-customization-tool label {
    font-family: var(--global-font-family-body);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark-gray-text);
}

#text-customization-tool input[type="color"] {
    width: 60px;
    height: 30px;
    border: none;
    padding: 0;
    background: none;
    cursor: pointer;
}

#text-customization-tool select {
    width: 100%;
    padding: 5px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.text-style-buttons,
.text-align-buttons {
    display: flex;
    gap: 5px;
    width: 100%;
    justify-content: center;
}

.text-style-buttons button,
.text-align-buttons button {
    background-color: var(--medium-gray);
    color: var(--dark-gray-text);
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.text-style-buttons button:hover,
.text-align-buttons button:hover {
    background-color: var(--primary-blue);
    color: var(--white-text);
}

/* Active state for buttons */
.text-style-buttons button.active,
.text-align-buttons button.active {
    background-color: var(--primary-blue);
    color: var(--white-text);
    border-color: var(--primary-blue);
}

#clipart-tool {
    position: fixed;
    top: 50%; /* Adjusted to be above or below color picker */
    left: 0;
    transform: translateY(200%); /* Move down */
    background-color: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 0 5px 5px 0;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    z-index: 10001; /* Higher z-index than color picker */
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    max-width: 250px;
    transition: transform 0.3s ease-in-out;
}

#clipart-tool h3 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    color: var(--dark-gray-text);
}

#clipart-tool label {
    font-family: var(--global-font-family-body);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark-gray-text);
}

#clipart-tool input[type="text"] {
    width: calc(100% - 20px);
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

#clipart-tool button {
    background-color: var(--primary-blue);
    color: var(--white-text);
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#clipart-tool button:hover {
    background-color: var(--secondary-blue);
}

#clipart-list {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.draggable-clipart {
    position: absolute; /* Allows absolute positioning for dragging */
    cursor: grab;
    border: 2px solid transparent; /* Visual feedback for active/locked state */
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    padding: 5px;
    background-color: rgba(255, 255, 255, 0.7);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.draggable-clipart img {
    width: 100px; /* Default size for clipart */
    height: auto;
    display: block;
}

.draggable-clipart.locked {
    cursor: default; /* No grabbing when locked */
    border-color: var(--primary-blue); /* Blue border when locked */
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.draggable-clipart.resizing {
    border-color: #ffc107; /* Yellow border when resizing */
}

.draggable-text {
    position: absolute; /* Enable absolute positioning for text elements */
    cursor: grab; /* Indicate draggable */
    outline: 2px dashed rgba(0, 123, 255, 0.5); /* Visual cue when draggable */
    z-index: 999; /* Ensure it stays above other content during drag */
}

.draggable-text.locked {
    cursor: default;
    outline: none; /* No outline when locked */
}

.done-button-container {
    position: fixed; /* Fixed position relative to viewport */
    background-color: #28a745; /* Green background */
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    z-index: 10003; /* Above everything else */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: background-color 0.3s ease;
}

.done-button-container:hover {
    background-color: #218838; /* Darker green on hover */
}

.clipart-controls {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 3px;
    display: flex;
    gap: 5px;
    padding: 3px;
}

.clipart-controls button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 5px;
}

.clipart-controls button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

#color-picker-tool input[type="color"] {
    width: 60px;
    height: 30px;
    border: none;
    padding: 0;
    background: none;
    cursor: pointer;
}

.editable-text:focus {
    outline: 2px solid var(--primary-blue);
    padding: 2px 5px;
    border-radius: 3px;
}

/* Styles for draggable text */
.editable-text[contenteditable="true"] {
    cursor: grab; /* Indicates it can be dragged */
    min-width: 50px; /* Ensure a minimum size for dragging */
}

.editable-text.dragging {
    cursor: grabbing;
    position: absolute; /* Make it absolutely positioned when dragging */
    z-index: 9999; /* Ensure it's on top while dragging */
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.editable-text.locked-text {
    cursor: default; /* Not draggable when locked */
    border: 1px dashed var(--primary-blue); /* Visual feedback for locked text */
    position: absolute; /* Must be absolute to maintain position */
    z-index: 1; /* Keep it below other active elements */
}

/* Style for the "Done" button that appears during drag */
#drag-done-button {
    position: absolute;
    background-color: #28a745; /* Green color */
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 10000; /* Ensure it's above other elements */
    display: none; /* Hidden by default */
}

/* Page transition effects */
body.fade-out {
    opacity: 0;
    transition: opacity 1s ease-out; /* Slowed down transition */
}

body.fade-in {
    opacity: 1;
    transition: opacity 1s ease-in; /* Slowed down transition */
}
