/**
 * Ferienhaus Belegungskalender - Styles
 * 9-Monats-Grid, filigranes Design, iFrame-optimiert
 */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #344120;
    --accent: #4a5d2e;
    --booked: #6b8e4e;
    --booked-text: #ffffff;
    --cancelled: #fecaca;
    --cancelled-text: #991b1b;
    --available: #ffffff;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --bg-body: #f3f4f6;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    --radius: 6px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    font-family: var(--font);
    background: var(--bg-body);
    color: var(--text-dark);
    line-height: 1.4;
    min-height: 100vh;
    margin: 0;
    padding: 12px;
    -webkit-font-smoothing: antialiased;
}

.calendar-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

.calendar-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.nav-btn:hover {
    background: var(--accent);
}

.nav-info {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    min-width: 180px;
    text-align: center;
}

.months-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.month-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.month-header {
    background: var(--primary);
    color: white;
    padding: 6px 8px;
    text-align: center;
}

.month-header h2 {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.1px;
    white-space: nowrap;
}

.weekday-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9fa;
    border-bottom: 1px solid var(--border);
}

.weekday-cell {
    padding: 4px 2px;
    text-align: center;
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
}

.days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
}

.day {
    background: var(--available);
    min-height: 28px;
    padding: 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    cursor: default;
}

.day.empty {
    background: #fafbfc;
}

.day.booked {
    background: var(--booked);
}

.day.booked .day-number {
    color: var(--booked-text);
}

.day.cancelled {
    background: var(--cancelled);
}

.day.cancelled .day-number {
    color: var(--cancelled-text);
}

.day.today {
    box-shadow: inset 0 0 0 1px var(--primary);
}

.day.booked.arrival,
.day.booked.departure {
    background: var(--available);
}

.day.booked.arrival::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 90%;
    height: 90%;
    background: var(--booked);
    clip-path: polygon(100% 0, 100% 100%, 0 0);
}

.day.booked.departure::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 85%;
    height: 85%;
    background: var(--booked);
    clip-path: polygon(0 100%, 100% 100%, 0 0);
}

.day.booked.arrival .day-number,
.day.booked.departure .day-number {
    color: var(--text-dark);
}

.day.booked.arrival .booking-indicator,
.day.booked.departure .booking-indicator {
    opacity: 0;
}

.day-number {
    font-weight: 600;
    font-size: 0.6rem;
    color: var(--text-dark);
    line-height: 1;
}

.booking-indicator {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    margin-top: 2px;
    background: var(--primary);
}

.day.booked .booking-indicator {
    background: rgba(255, 255, 255, 0.7);
}

.day.cancelled .booking-indicator {
    background: var(--cancelled-text);
}

.tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-dark);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--text-dark);
}

.day.booked:hover .tooltip,
.day.cancelled:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 10px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-dark);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-color.available {
    background: var(--available);
    border: 1px solid var(--border);
}

.legend-color.booked {
    background: var(--booked);
}

.embed-mode .calendar-nav,
.embed-mode .legend {
    display: none;
}

.embed-mode body {
    padding: 6px;
}

.embed-mode .months-grid {
    gap: 8px;
    margin-bottom: 0;
}

@media (max-width: 900px) {
    .months-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    body {
        padding: 8px;
    }
    
    .months-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .month-header {
        padding: 4px 6px;
    }
    
    .month-header h2 {
        font-size: 0.55rem;
    }
    
    .weekday-cell {
        font-size: 0.5rem;
        padding: 2px 1px;
    }
    
    .day {
        min-height: 24px;
        padding: 1px;
    }
    
    .day-number {
        font-size: 0.5rem;
    }
    
    .booking-indicator {
        width: 3px;
        height: 3px;
        margin-top: 1px;
    }
    
    .nav-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .nav-info {
        font-size: 0.85rem;
        min-width: 140px;
    }
    
    .legend {
        gap: 12px;
        padding: 8px;
    }
    
    .legend-item {
        font-size: 0.7rem;
    }
    
    .legend-color {
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 420px) {
    .months-grid {
        grid-template-columns: 1fr;
    }
}
