/* Base Styles */
:root {
    --initial-background-image: url('../img/background.webp');
    --body-opacity: 1;
}


/* Seiten-spezifische Styles - Background wird in critical.css definiert */
body {
    font-family: 'Nunito', sans-serif;
    opacity: 0;
    animation: fadeIn 0.5s ease-in-out forwards;
    padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px));
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Utility Classes */
.no-spinners::-webkit-inner-spin-button,
.no-spinners::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Modal Animation */
.modal {
    transition: opacity 0.25s ease;
}

/* Scrollbar hiding */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Hero Section mit zentralisierten Variablen */
.hero-section {
    position: relative;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    margin-bottom: var(--spacing-lg);
    margin-top: var(--spacing-lg);
    background-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 12rem;
    /* Default height */
}

/* Small Hero & Profile Hero - Reduced height */
.small-hero,
.profile-hero,
.register-hero {
    height: 8rem;
    /* ~128px on mobile */
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Fill the box completely */
    object-position: center center;
    /* Focus on the center of the image */
    display: block;
}

/* Page-specific hero backgrounds (deprecated/unused in new img approach but kept for reference) */
/*.sprueche-hero {
    background-image: url('../img/sprueche-hero.jpg');
}

.favoriten-hero {
    background-image: url('../img/favoriten-hero.jpg');
}*/

@media (min-width: 768px) {
    .hero-section {
        height: 16rem;
    }

    .small-hero,
    .profile-hero,
    .register-hero {
        height: 10rem;
    }
}

@media (min-width: 1024px) {
    .hero-section {
        height: 20rem;
    }

    .small-hero,
    .profile-hero,
    .register-hero {
        height: 12rem;
    }
}

@media (min-width: 1280px) {
    .hero-section {
        height: 24rem;
    }

    .small-hero,
    .profile-hero,
    .register-hero {
        height: 14rem;
    }
}

@media (min-width: 1536px) {
    .hero-section {
        height: 28rem;
    }

    .small-hero,
    .profile-hero,
    .register-hero {
        height: 16rem;
    }
}

/* Content Cards - Erweiterte Styles zu critical.css */
.content-card {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.content-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Section Headings mit zentralisierten Variablen */
.section-heading {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: var(--spacing-sm);
    color: var(--black);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-left: 3px solid var(--primary-color);
    background-color: var(--white);
    border-radius: var(--radius-md);
    display: inline-block;
    box-shadow: var(--shadow-sm);
}

@media (min-width: 768px) {
    .section-heading {
        font-size: 1.125rem;
        margin-bottom: var(--spacing-md);
        padding: var(--spacing-sm) var(--spacing-md);
    }
}

/* Text Container */
.text-container {
    background-color: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

/* Categories Styling */
.categories-container {
    background-color: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}

/* Popular Sayings Styling */
.saying-card {
    background-color: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 0.75rem;
    padding: 0.875rem;
    /* Even smaller padding on mobile */
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    cursor: pointer;
    font-size: 0.95rem;
    /* Slightly smaller font on mobile */
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.saying-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: rgba(255, 255, 255, 0.9);
}

.saying-text {
    color: #1e293b;
    /* Dark slate for better readability */
    font-style: italic;
    margin-bottom: 0.75rem;
    line-height: 1.5;
    /* Slightly tighter leading */
    text-align: center;
    /* Center text on cards */
}

.saying-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #64748b;
    /* Slate 500 */
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 0.5rem;
}

.saying-category {
    font-weight: 600;
    color: var(--primary-color);
    background-color: rgba(0, 102, 204, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
}

.saying-stats {
    display: flex;
    gap: 0.75rem;
}

.saying-stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Sticky Card Styling - Optimized for Mobile */
.content-card.sticky {
    position: sticky;
    top: 80px;
    /* Increased from 20px to account for header */
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

/* Kompaktere Darstellung auf sehr kleinen Geräten */
@media (max-width: 767px) {
    .content-card.sticky {
        top: 60px;
        padding: 12px !important;
    }

    .content-card.sticky .flex-col {
        flex-direction: column !important;
    }

    .content-card.sticky .flex-grow,
    .content-card.sticky .md\:w-64,
    .content-card.sticky .md\:w-48 {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 8px !important;
    }

    .content-card.sticky .flex-col>div:last-child {
        margin-bottom: 0 !important;
    }
}

/* Media Queries for larger screens */
@media (min-width: 768px) {
    .h-hero {
        height: 16rem;
    }

    .content-wrapper {
        max-width: 720px;
        margin-left: auto;
        margin-right: auto;
    }

    .content-card {
        padding: 1.5rem;
    }

    .categories-scroll {
        overflow-x: auto;
        padding-bottom: 1rem;
    }

    .sayings-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1rem;
    }

    .category-container {
        padding: 1.5rem;
    }

    .saying-card {
        height: 100%;
    }

    .login-card {
        padding: 2.5rem;
    }
}

@media (min-width: 1024px) {
    .h-hero {
        height: 20rem;
    }

    .content-wrapper {
        max-width: 768px;
    }
}

@media (min-width: 1280px) {
    .content-wrapper {
        max-width: 1024px;
    }
}

@media (min-width: 1536px) {
    .content-wrapper {
        max-width: 1280px;
    }
}

/* Custom CSS für einheitliche Kartenhöhe */
.spruch-item {
    width: 100%;
    /* Responsive width instead of fixed */
    max-width: 350px;
    /* Reduced maximum width for better fit */
    min-height: 220px;
    /* Smaller minimum height for mobile */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin: 0 auto;
    /* Zentriert die Karten */
}

@media (min-width: 1536px) {
    .spruch-item {
        max-width: 450px;
        /* Even wider on very large screens */
    }
}

/* Main content margin adjustments */
.main-content-margin {
    margin-top: 120px;
    margin-bottom: 140px;
}

@media (max-width: 639px) {
    .main-content-margin {
        margin-top: 110px;
        margin-bottom: 110px;
    }
}

@media (min-width: 768px) {
    .main-content-margin {
        margin-top: 130px;
        margin-bottom: 140px;
    }
}

/* Responsive Anpassungen */
.sayings-grid {
    display: grid;
    grid-template-columns: 1fr;
    /* Single column on smallest screens */
    gap: 0.75rem;
    /* Smaller gap on mobile */
}

@media (min-width: 640px) {
    .sayings-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns on medium screens */
        gap: 1rem;
        /* Medium gap */
    }
}

@media (min-width: 1024px) {
    .sayings-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns on larger screens */
        gap: 1.25rem;
        /* Slightly larger gap on desktop */
    }
}

@media (min-width: 1280px) {
    .sayings-grid {
        grid-template-columns: repeat(3, 1fr);
        /* 3 columns on extra large screens */
        gap: 1.5rem;
        /* Larger gap on extra large screens */
    }
}

@media (min-width: 1536px) {
    .sayings-grid {
        grid-template-columns: repeat(4, 1fr);
        /* 4 columns on very large screens */
        gap: 1.75rem;
        /* Even larger gap on very large screens */
    }
}

/* ============================================
   TAGS WRAPPING - Erlaubt Tags auf mehrere Zeilen
   ============================================ */

/* Tags können umbrechen */
.flex.flex-wrap.gap-2,
.mt-3.flex.flex-wrap.gap-2 {
    max-width: 100%;
    flex-wrap: wrap !important;
}

/* Container Cards overflow begrenzen */
.bg-white\/90,
article.bg-white\/90 {
    overflow: hidden;
    max-width: 100%;
}

/* Mobile-spezifische Anpassungen */
@media (max-width: 640px) {

    /* Kartenabstände auf Mobile reduzieren */
    .space-y-4>article {
        margin-bottom: 0.75rem;
    }

    /* Container padding auf Mobile */
    main.px-4 {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* ============================================
   CUSTOM UTILITY CLASSES
   Für Konsistenz über alle Seiten hinweg (Login, Profil, etc.)
   ============================================ */

/* Hintergrundfarben */
.bg-primary {
    background-color: var(--primary-color) !important;
}

.hover\:bg-primary-dark:hover {
    background-color: var(--primary-dark) !important;
}

.bg-white {
    background-color: var(--white);
}

/* Red colors for Logout/Danger buttons */
.bg-red-500 {
    background-color: #ef4444 !important;
}

.hover\:bg-red-600:hover {
    background-color: #dc2626 !important;
}

/* Textfarben */
.text-primary {
    color: var(--primary-color) !important;
}

.hover\:text-primary-dark:hover {
    color: var(--primary-dark) !important;
}

.text-white {
    color: #ffffff !important;
}

/* Schatten und Rahmen */
.rounded-lg {
    border-radius: 0.5rem !important;
}

.shadow-md {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
}

.shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
}

.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* Button-spezifische Fixes für Links, die wie Buttons aussehen sollen */
a.bg-primary {
    text-decoration: none !important;
    display: inline-flex !important;
}

a.bg-primary:hover {
    color: #ffffff !important;
    text-decoration: none !important;
}

/* Layout Utilities (falls Tailwind fehlt/überschrieben wird) */
.inline-flex {
    display: inline-flex !important;
}

.flex {
    display: flex !important;
}

.flex-col {
    flex-direction: column !important;
}

.items-center {
    align-items: center !important;
}

.justify-center {
    justify-content: center !important;
}

.gap-2 {
    gap: 0.5rem !important;
}

.mr-2 {
    margin-right: 0.5rem !important;
}

/* Spacing Utilities */
.py-2 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

.px-4 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

.px-6 {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
}

.py-2\.5 {
    padding-top: 0.625rem !important;
    padding-bottom: 0.625rem !important;
}

.px-8 {
    padding-left: 2rem !important;
    padding-right: 2rem !important;
}

/* Toggle Switch Styles */
.toggle-switch-container {
    display: inline-block;
    position: relative;
    margin: 0.5rem 0;
}

/* Toggle Switch - Force styles with !important to override any defaults */
.toggle-switch {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 50px !important;
    height: 25px !important;
    background-color: #ccc !important;
    /* Default grey for unchecked */
    border-radius: 15px !important;
    position: relative !important;
    outline: none !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease !important;
    margin: 0 !important;
}

.toggle-switch:checked {
    background-color: var(--primary-color) !important;
    /* Blue for checked */
}

.toggle-switch::before {
    content: '' !important;
    position: absolute !important;
    width: 21px !important;
    height: 21px !important;
    border-radius: 50% !important;
    top: 2px !important;
    left: 2px !important;
    background-color: white !important;
    transition: transform 0.3s ease !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

.toggle-switch:checked::before {
    transform: translateX(25px) !important;
}

.toggle-switch:focus {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.toggle-switch:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.toggle-label {
    margin-left: 0.5rem;
    font-size: 0.875rem;
    color: #4a5568;
    cursor: pointer;
}

/* ============================================
   CCM19 WIDGET OVERRIDES
   Verschiebt das Widget nach oben, um die Navbar nicht zu verdecken
   ============================================ */
#ccm-widget,
.ccm-widget-trigger,
#ccm19-button,
.ccm19-trigger {
    bottom: 90px !important;
    z-index: 9999 !important;
    transform: scale(0.7) !important;
    transform-origin: bottom right !important;
}