/* 
   PuppaSchafe - Modern Vanilla CSS Stylesheet
   Theme: High-end Cyber-Comic Glassmorphism (Dark Mode)
*/

:root {
    --bg-main: #0b0f19;
    --bg-card: rgba(22, 28, 45, 0.45);
    --bg-card-hover: rgba(30, 41, 59, 0.7);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-hover: rgba(255, 255, 255, 0.18);
    
    --primary: #ff5ea0; /* Vibrant Light Pink */
    --primary-hover: #ff85b6;
    --primary-glow: rgba(255, 94, 160, 0.35);
    
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dark: #0f172a;
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

[hidden] {
    display: none !important;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Glassmorphism utility */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.glass:hover {
    border-color: var(--border-glass-hover);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

/* App Header */
.app-header {
    padding: 3rem 1.5rem 1.5rem 1.5rem;
    text-align: center;
    position: relative;
}

.header-container {
    max-width: 800px;
    margin: 0 auto;
}

.brand-title {
    font-family: var(--font-heading);
    font-size: clamp(2.2rem, 11vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.brand-title span {
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary-glow);
}

.brand-subtitle {
    color: var(--text-muted);
    font-size: 1.15rem;
    font-weight: 400;
}

/* Main Layout */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem 1.5rem;
}

/* Hero Section: Comic of the Day */
.hero-section {
    margin-bottom: 3rem;
}

.hero-card {
    padding: 2rem;
    border-radius: var(--radius-lg);
}

.hero-badge {
    display: block;
    text-align: center;
    color: var(--primary);
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.4rem;
    margin-bottom: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: center;
}

@media (min-width: 768px) {
    .hero-body {
        grid-template-columns: 1fr 1fr;
    }
}

.hero-image-wrapper {
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #ffffff; /* White paper color for comic background */
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--border-glass);
    aspect-ratio: 4 / 3;
    cursor: pointer;
    padding: 1.5rem; /* Space around the hero comic */
}

.hero-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: var(--transition);
}

.hero-image-wrapper:hover .hero-img {
    transform: scale(1.02);
}

.hero-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-desc {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.05rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 0 15px var(--primary-glow);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Controls Section */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
}

@media (min-width: 600px) {
    .controls-section {
        flex-direction: row;
        justify-content: space-between;
    }
}

.search-bar {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 450px;
    padding: 0.5rem 1rem;
    border-radius: 50px;
}

.search-icon {
    color: var(--text-muted);
    margin-right: 0.75rem;
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1rem;
    width: 100%;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-clear-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 0.5rem;
    transition: var(--transition);
}

.search-clear-btn:hover {
    color: var(--primary);
}

.stats-counter {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Gallery Section & Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

/* Comic Cards */
.comic-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1; /* Make cards square for a beautiful uniform alignment */
}

.comic-card-img-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #ffffff; /* Matching comic paper color */
}

.comic-card-img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Show complete comic without cropping */
    padding: 1rem; /* Provide space around the comic */
    transition: var(--transition);
}

/* Overlay visible on hover */
.comic-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(11, 15, 25, 0.95) 0%, rgba(11, 15, 25, 0.8) 70%, transparent 100%);
    padding: 1.5rem 1rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transform: translateY(100%);
    transition: var(--transition);
}

.comic-card:hover .comic-card-overlay {
    transform: translateY(0);
}

.comic-card:hover .comic-card-img {
    transform: scale(1.05);
}

.comic-card-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.comic-card-action-text {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* No Results State */
.no-results-container {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 500px;
    margin: 3rem auto 0 auto;
}

.no-results-emoji {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.no-results-container p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Lightbox Modal */
dialog {
    border: none;
    outline: none;
    max-width: 90vw;
    max-height: 90vh;
    margin: auto;
    background: transparent;
}

/* Backdrops styled with glass/blur effect */
dialog::backdrop {
    background-color: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.dialog-wrapper {
    background: #111827;
    border: 1px solid var(--border-glass-hover);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    max-width: 750px;
    width: 100%;
    overflow: hidden;
    position: relative;
    max-height: 85vh;
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-glass);
}

.dialog-heading {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.dialog-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition);
}

.dialog-close-btn:hover {
    color: var(--primary);
}

.dialog-body {
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.1);
    max-height: 60vh;
}

.dialog-body img {
    max-width: 100%;
    max-height: 55vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.dialog-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-glass);
    display: flex;
    justify-content: flex-end;
}

/* Animations for Dialog */
dialog[open] {
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-glass);
    margin-top: 4rem;
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.footer-link:hover {
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

/* Toast Notifications */
.app-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid var(--primary);
    color: var(--text-main);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.95rem;
    z-index: 10000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
    opacity: 0;
    pointer-events: none;
    text-align: center;
    white-space: nowrap;
}

.app-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 4rem);
    max-width: 650px;
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass-hover);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: cookieSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 640px) {
    .cookie-banner {
        flex-direction: row;
        gap: 2rem;
    }
}

.cookie-content p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-main);
}

.cookie-buttons {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

@keyframes cookieSlideUp {
    from {
        transform: translate(-50%, 150px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Responsive visibility rules for the "Nächstes Schaf!" buttons */
.next-btn-desktop {
    display: none !important;
}

.next-btn-mobile {
    display: inline-flex !important;
}

@media (min-width: 768px) {
    .next-btn-mobile {
        display: none !important;
    }
    .next-btn-desktop {
        display: inline-flex !important;
    }
}
