/**
 * Adventskalender für den guten Zweck
 * Stylesheet
 */

/* ===================================
   CSS Variables & Root
   =================================== */
:root {
    /* Farben */
    --primary: #c41e3a;
    --primary-dark: #9a1830;
    --primary-light: #e63950;
    --secondary: #1a472a;
    --secondary-light: #2d5a3d;
    --gold: #ffd700;
    --gold-dark: #b8860b;
    --cream: #f5f0e6;
    --dark: #1a1a2e;
    --light: #ffffff;
    
    /* Schatten */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.2);
    
    /* Übergänge */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    
    /* Schriften */
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ===================================
   Base Styles
   =================================== */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, var(--dark) 0%, #16213e 100%);
    color: var(--light);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

h1, h2, h3, h4, h5 {
    font-family: var(--font-display);
    font-weight: 700;
    margin-top: 0;
}

a {
    color: var(--gold);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--gold-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* ===================================
   Layout
   =================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 40px 0;
}

/* ===================================
   Header
   =================================== */
.site-header {
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.site-logo img {
    height: 50px;
    width: auto;
}

.site-logo h1 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--light);
}

.main-nav {
    display: flex;
    gap: 25px;
    align-items: center;
}

.main-nav a {
    color: var(--light);
    font-weight: 500;
    padding: 8px 0;
    position: relative;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gold);
    transition: width var(--transition-normal);
}

.main-nav a:hover::after,
.main-nav a.active::after {
    width: 100%;
}

/* ===================================
   Adventskalender
   =================================== */
.calendar-wrapper {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

.calendar-background {
    position: relative;
    width: 100%;
    padding-bottom: 66.67%; /* 3:2 Aspect Ratio für Querformat */
    background: linear-gradient(180deg, 
        #1a472a 0%, 
        #2d5a3d 30%, 
        #1a472a 60%,
        #0d2818 100%
    );
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

.calendar-background.has-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Schneeflocken-Overlay - nur ohne Bild */
.calendar-background:not(.has-image)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.1) 1px, transparent 1px),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.08) 2px, transparent 2px),
        radial-gradient(circle at 40% 70%, rgba(255,255,255,0.06) 1px, transparent 1px),
        radial-gradient(circle at 90% 80%, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 100px 100px, 150px 150px, 80px 80px, 120px 120px;
    pointer-events: none;
    animation: snowfall 20s linear infinite;
}

@keyframes snowfall {
    0% { background-position: 0 0, 0 0, 0 0, 0 0; }
    100% { background-position: 100px 100px, -150px 150px, 80px 80px, -120px 120px; }
}

.calendar-doors {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ===================================
   Türchen (Doors)
   =================================== */
.door {
    position: absolute;
    cursor: pointer;
    perspective: 1000px;
    z-index: 10;
}

.door-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.door.opened .door-inner {
    transform: rotateY(-160deg);
}

.door-front,
.door-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.door-front {
    /* Standard-Stil ohne Hintergrundbild */
    background: linear-gradient(145deg, #8b4513 0%, #5d2f0d 100%);
    border: 3px solid var(--gold);
    box-shadow: 
        inset 0 2px 10px rgba(255,215,0,0.3),
        0 4px 15px rgba(0,0,0,0.4);
    color: var(--gold);
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Türchen mit Hintergrundbild-Ausschnitt */
.calendar-background.has-image .door-front {
    /* Hintergrund wird via JavaScript gesetzt */
    background-size: cover;
    background-position: center;
    border: 3px solid rgba(255,215,0,0.8);
    box-shadow: 
        inset 0 0 0 2px rgba(0,0,0,0.3),
        0 4px 15px rgba(0,0,0,0.5);
}

.calendar-background.has-image .door-front::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.15);
    border-radius: inherit;
    pointer-events: none;
}

.calendar-background.has-image .door-front .door-number {
    position: relative;
    z-index: 1;
    text-shadow: 
        0 0 10px rgba(0,0,0,0.8),
        0 2px 4px rgba(0,0,0,0.9);
}

.door-front::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 1px solid rgba(255,215,0,0.3);
    border-radius: var(--radius-sm);
    pointer-events: none;
}

.door-front:hover {
    box-shadow: 
        inset 0 2px 15px rgba(255,215,0,0.5),
        0 6px 20px rgba(0,0,0,0.5);
}

.door-back {
    background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
    transform: rotateY(180deg);
    padding: 10px;
    overflow: hidden;
}

.door.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.door.disabled .door-front {
    filter: grayscale(50%);
}

/* Heutiger Tag - Wackel-Animation */
.door.today {
    animation: wiggle 3s ease-in-out infinite;
}

.door.today .door-front {
    box-shadow: 
        inset 0 2px 15px rgba(255,215,0,0.5),
        0 0 20px rgba(255,215,0,0.4),
        0 6px 20px rgba(0,0,0,0.5);
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    5% { transform: rotate(-2deg); }
    10% { transform: rotate(2deg); }
    15% { transform: rotate(-2deg); }
    20% { transform: rotate(2deg); }
    25% { transform: rotate(0deg); }
}

/* ===================================
   Prize Display (hinter dem Türchen)
   =================================== */
.prize-preview {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #2d5a3d 0%, #1a472a 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    font-size: 2rem;
    border: 2px solid rgba(255,215,0,0.3);
}

.prize-preview .prize-icon {
    font-size: 2.5rem;
}

/* ===================================
   Modal für Gewinn-Details
   =================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: linear-gradient(180deg, #1a472a 0%, #0d2818 100%);
    border: 3px solid var(--gold);
    border-radius: var(--radius-xl);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 40px;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-normal);
    box-shadow: 
        0 0 50px rgba(255,215,0,0.3),
        var(--shadow-xl);
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--light);
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
    line-height: 1;
}

.modal-close:hover {
    opacity: 1;
}

.modal-day {
    text-align: center;
    margin-bottom: 20px;
}

.modal-day-number {
    display: inline-block;
    background: var(--primary);
    color: var(--light);
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    width: 80px;
    height: 80px;
    line-height: 80px;
    border-radius: 50%;
    border: 3px solid var(--gold);
    box-shadow: 0 0 20px rgba(255,215,0,0.3);
}

.modal-prize {
    text-align: center;
}

.modal-prize h2 {
    color: var(--gold);
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.modal-prize-image {
    max-width: 300px;
    margin: 20px auto;
    border-radius: var(--radius-lg);
    border: 2px solid rgba(255,215,0,0.3);
}

.modal-prize-description {
    color: var(--cream);
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.modal-winning-number {
    background: rgba(0,0,0,0.3);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-top: 20px;
}

.modal-winning-number h3 {
    color: var(--gold);
    font-size: 1rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-winning-numbers {
    background: rgba(0,0,0,0.3);
    border-radius: var(--radius-lg);
    padding: 15px 20px;
    margin-top: 15px;
}

.winning-numbers-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.winning-number-display {
    font-family: 'Courier New', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--light);
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 12px 25px;
    border-radius: var(--radius-md);
    display: inline-block;
    border: 2px solid var(--gold);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.modal-prize-item {
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(255,215,0,0.2);
}

.modal-prize-item:last-child {
    margin-bottom: 0;
}

.modal-sponsor {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,215,0,0.2);
    text-align: center;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
}

.modal-sponsor img {
    max-height: 50px;
    margin-top: 10px;
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

/* ===================================
   Ticket Checker
   =================================== */
.ticket-checker {
    background: rgba(0,0,0,0.3);
    border-radius: var(--radius-xl);
    padding: 30px;
    margin-top: 40px;
    border: 1px solid rgba(255,215,0,0.2);
}

.ticket-checker h2 {
    color: var(--gold);
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: center;
}

.ticket-checker-form {
    display: flex;
    gap: 15px;
    max-width: 500px;
    margin: 0 auto;
}

.ticket-checker-form input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid rgba(255,215,0,0.3);
    border-radius: var(--radius-md);
    background: rgba(0,0,0,0.3);
    color: var(--light);
    font-size: 1.1rem;
    font-family: 'Courier New', monospace;
    text-align: center;
    letter-spacing: 2px;
}

.ticket-checker-form input::placeholder {
    color: rgba(255,255,255,0.4);
    letter-spacing: normal;
}

.ticket-checker-form input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 15px rgba(255,215,0,0.2);
}

.ticket-checker-result {
    margin-top: 20px;
    padding: 20px;
    border-radius: var(--radius-lg);
    text-align: center;
    display: none;
}

.ticket-checker-result.winner {
    display: block;
    background: linear-gradient(135deg, #2d5a3d 0%, #1a472a 100%);
    border: 2px solid var(--gold);
    animation: celebrate 0.5s ease;
}

.ticket-checker-result.no-win {
    display: block;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
}

@keyframes celebrate {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* ===================================
   Buttons
   =================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 25px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--light);
    border: 2px solid var(--gold);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(196,30,58,0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--gold);
    border: 2px solid var(--gold);
}

.btn-secondary:hover {
    background: var(--gold);
    color: var(--dark);
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--dark);
    border: none;
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255,215,0,0.4);
}

.btn-lg {
    padding: 15px 35px;
    font-size: 1.1rem;
}

/* ===================================
   Forms
   =================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--light);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: var(--radius-md);
    background: rgba(0,0,0,0.3);
    color: var(--light);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 10px rgba(255,215,0,0.2);
}

.form-control::placeholder {
    color: rgba(255,255,255,0.4);
}

/* ===================================
   Cards
   =================================== */
.card {
    background: rgba(0,0,0,0.3);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255,255,255,0.1);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: rgba(255,215,0,0.3);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 20px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    background: rgba(0,0,0,0.2);
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* ===================================
   Footer
   =================================== */
.site-footer {
    background: rgba(0,0,0,0.5);
    padding: 40px 0 20px;
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 30px;
}

.footer-section h4 {
    color: var(--gold);
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.footer-section p,
.footer-section a {
    color: rgba(255,255,255,0.7);
    font-size: 0.95rem;
    line-height: 1.8;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5);
    font-size: 0.9rem;
}

/* ===================================
   Alerts
   =================================== */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: rgba(45, 90, 61, 0.5);
    border: 1px solid #2d5a3d;
    color: #a8e6a3;
}

.alert-error {
    background: rgba(196, 30, 58, 0.3);
    border: 1px solid var(--primary);
    color: #ffb3b3;
}

.alert-warning {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid var(--gold);
    color: var(--gold);
}

.alert-info {
    background: rgba(100, 150, 255, 0.2);
    border: 1px solid #6496ff;
    color: #a8c8ff;
}

/* ===================================
   Utilities
   =================================== */
.text-center { text-align: center; }
.text-gold { color: var(--gold); }
.text-muted { color: rgba(255,255,255,0.6); }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mt-4 { margin-top: 40px; }

.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }
.mb-4 { margin-bottom: 40px; }

.hidden { display: none !important; }

/* ===================================
   Responsive
   =================================== */
@media (max-width: 992px) {
    .calendar-background {
        padding-bottom: 100%; /* 1:1 auf Tablets */
    }
    
    .door-front {
        font-size: 1.4rem;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .main-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .calendar-background {
        padding-bottom: 120%;
    }
    
    .door-front {
        font-size: 1.2rem;
    }
    
    .ticket-checker-form {
        flex-direction: column;
    }
    
    .modal-content {
        padding: 25px;
    }
    
    .modal-day-number {
        font-size: 2rem;
        width: 60px;
        height: 60px;
        line-height: 60px;
    }
    
    .winning-number-display {
        font-size: 1.8rem;
        padding: 12px 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .calendar-background {
        padding-bottom: 150%;
    }
    
    .door-front {
        font-size: 1rem;
        border-width: 2px;
    }
    
    .btn {
        width: 100%;
    }
}

/* ===================================
   Animations
   =================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.animate-pulse {
    animation: pulse 2s ease infinite;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,215,0,0.3);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===================================
   Print Styles
   =================================== */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .site-header,
    .site-footer,
    .ticket-checker,
    .btn {
        display: none;
    }
}
