/* General Styles */
:root {
    /* Light Theme Colors */
    --bg-color: #f0f9f4;         /* Light pastel green */
    --text-color: #333;         /* Dark gray */
    --header-bg: #a8dadc;        /* Pastel teal */
    --grid-bg: #fff7ed;          /* Light pastel orange */
    --grid-hover-bg: #fff2e6;    /* Slightly darker pastel orange */
    --button-bg: #f4acb7;        /* Pastel pink */
    --button-hover-bg: #e89aa6;   /* Slightly darker pastel pink */
    --overlay-bg: rgba(0, 0, 0, 0.7); /* Dark overlay */
    --card-shadow: rgba(0, 0, 0, 0.15);
    --stronger-shadow: rgba(0, 0, 0, 0.2);
    --filename-color: #777;      /* Medium gray */
    --white: #fff;
}

/* Dark Theme Colors (applied via data-theme attribute) */
[data-theme="dark"] {
    --bg-color: #222;          /* Dark gray */
    --text-color: #eee;          /* Light gray */
    --header-bg: #333;         /* Darker gray */
    --grid-bg: #444;           /* Slightly lighter dark gray */
    --grid-hover-bg: #555;      /* Lighter dark gray on hover */
    --button-bg: #888;         /* Gray button */
    --button-hover-bg: #999;    /* Lighter gray button on hover */
    --overlay-bg: rgba(0, 0, 0, 0.9); /* Even darker overlay */
    --card-shadow: rgba(255, 255, 255, 0.1);
    --stronger-shadow: rgba(255, 255, 255, 0.2);
    --filename-color: #ccc;      /* Light gray */
    --white: #333;
}

[data-theme="dark"] header h1 {
    color: white;
}

body {
    font-family: 'Nunito', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600&display=swap');

header {
    background-color: var(--header-bg);
    color: var(--white);
    text-align: center;
    padding: 1.5em 0;
    box-shadow: 0 2px 5px var(--card-shadow);
}

header h1 {
    font-size: 2.5em;
    font-weight: 600;
    margin: 0;
    color: #333;
    padding: 1em 0;
}

#grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.2em;
    padding: 1.5em;
}

.grid-item {
    background-color: var(--grid-bg);
    border: none;
    padding: 1.2em;
    text-align: center;
    cursor: pointer;
    border-radius: 10px;
    box-shadow: 0 3px 7px var(--card-shadow);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.grid-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 10px var(--stronger-shadow);
    background-color: var(--grid-hover-bg);
}

#fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#fullscreen-content {
    background-color: var(--white);
    padding: 2em;
    border-radius: 15px;
    text-align: center;
    width: 85%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    box-shadow: 0 7px 15px var(--stronger-shadow);
}

#fullscreen-scrollable-area {
    max-height: 75vh;
    overflow: auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#fullscreen-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

#filename-display {
    margin-top: 15px;
    font-style: italic;
    color: var(--filename-color);
    text-align: center;
    padding-bottom: 15px;
    font-size: 0.9em;
}

#fullscreen-content button {
    margin: 15px;
    padding: 10px 20px;
    cursor: pointer;
    background-color: var(--button-bg);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 1em;
    transition: background-color 0.2s ease-in-out, transform 0.2s ease-in-out;
}

#fullscreen-content button:hover {
    background-color: var(--button-hover-bg);
    transform: scale(1.05);
}

.hidden {
    display: none !important;
}

/* Theme Switch Styles */
.theme-switch {
    display: inline-block;
    height: 34px;
    position: relative;
    width: 60px;
    margin-left: auto;
    margin-right: 1em;
}

/* Media Query for Mobile View */
@media (max-width: 600px) {
    .theme-switch {
        margin-right: 0.5em; /* Reduce margin on small screens */
    }
}
body[data-theme='dark'] h1 {
    color: white;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: #ccc;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
}

.slider:before {
    background-color: white;
    bottom: 4px;
    content: "";
    left: 4px;
    position: absolute;
    transition: .4s;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
    height: 26px;
    width: 26px;
}

header {
    background-color: var(--header-bg);
    color: var(--white);
    text-align: center;
    padding: 1.5em 0;
    box-shadow: 0 2px 5px var(--card-shadow);
    display: flex;              /* Use flexbox */
    align-items: center;        /* Align items vertically */
    justify-content: center;   /* Distribute items evenly */
}

header h1 {
    font-size: 2.5em;
    font-weight: 600;
    margin: 0;
    margin-right: auto;   /* Push header to the left */
}

#iframe-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

#iframe-content {
    background: white;
    padding: 1rem;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#iframe-viewer {
    width: 100%;
    height: 70vh;
    border: none;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.hidden {
    display: none;
}
