* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #fafbfc;
    color: #1f2937;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: white;
    padding: 40px 30px;
    margin-bottom: 30px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    text-align: center;
    border: 1px solid #e5e7eb;
}

header h1 {
    font-size: clamp(2em, 5vw, 2.8em);
    margin-bottom: 8px;
    color: #111827;
    font-weight: 700;
    letter-spacing: -0.5px;
}

header p {
    color: #6b7280;
    font-size: clamp(0.9em, 2vw, 1em);
    font-weight: 400;
}

.section {
    background: white;
    padding: clamp(20px, 3vw, 30px);
    margin-bottom: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}

.section h2 {
    margin-bottom: 20px;
    color: #111827;
    font-size: clamp(1.3em, 4vw, 1.7em);
    font-weight: 600;
    letter-spacing: -0.3px;
}

/* Form Styles */
.form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 4px;
    font-weight: 600;
    color: #111827;
    font-size: 0.9em;
}

.form-group input,
.form-group select {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95em;
    transition: all 0.2s;
    background: white;
}

.form-group input[type="date"] {
    padding: 2px 4px;
    font-size: 0.75em;
    height: 26px;
    line-height: 26px;
    max-width: 140px;
}

.date-display {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 0.9em;
    min-height: 32px;
    display: flex;
    align-items: center;
}

.date-display.selected {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #0ea5e9;
}

.date-selection {
    background: #f3f4f6;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 4px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Form Calendar Styles */
.form-calendar-header {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.form-calendar-header h3 {
    font-size: 0.95em;
    font-weight: 600;
    color: #111827;
}

.form-calendar-header .btn {
    padding: 4px 8px;
    font-size: 0.8em;
    height: 28px;
}

.form-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: white;
    border-radius: 6px;
    padding: 8px;
    border: 1px solid #e5e7eb;
}

.form-calendar-grid .weekday {
    text-align: center;
    font-weight: 600;
    font-size: 0.7em;
    color: #6b7280;
    padding: 4px 0;
}

.form-calendar-grid .day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 0.7em;
    cursor: pointer;
    background: white;
    border: 1px solid #e5e7eb;
    padding: 0;
    min-height: 24px;
    transition: all 0.2s;
}

.form-calendar-grid .day:not(.other-month):not(.reserved):hover {
    background: #f0f9ff;
    border-color: #0ea5e9;
}

.form-calendar-grid .day.other-month {
    color: #d1d5db;
    background: #f9fafb;
    cursor: default;
}

.form-calendar-grid .day.reserved {
    color: white;
    font-weight: 600;
    cursor: default;
}

.form-calendar-grid .day.ln {
    background: #e74c3c;
}

.form-calendar-grid .day.md {
    background: #f39c12;
}

.form-calendar-grid .day.drittpartei-ln {
    background: #9b59b6;
}

.form-calendar-grid .day.drittpartei-md {
    background: #1abc9c;
}

.form-calendar-grid .day.gemeinsam {
    background: #8b5cf6;
}

/* Party Selector */
.party-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 0;
}

.party-btn {
    padding: 8px 10px;
    border: 2px solid #d1d5db;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: #374151;
    transition: all 0.2s;
    font-size: 0.9em;
}

.party-btn[data-party="L&N"] {
    border-color: #e74c3c;
    color: #e74c3c;
}

.party-btn[data-party="M&D"] {
    border-color: #f39c12;
    color: #f39c12;
}

.party-btn[data-party="Drittpartei L&N"] {
    border-color: #9b59b6;
    color: #9b59b6;
}

.party-btn[data-party="Drittpartei M&D"] {
    border-color: #1abc9c;
    color: #1abc9c;
}

.party-btn[data-party="Gemeinsam"] {
    border-color: #8b5cf6;
    color: #8b5cf6;
}

.party-btn[data-party="Fremd"] {
    border-color: #6366f1;
    color: #6366f1;
}

.party-btn:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

.party-btn.active {
    color: white;
    border: none;
}

.party-btn[data-party="L&N"].active {
    background: #e74c3c;
}

.party-btn[data-party="M&D"].active {
    background: #f39c12;
}

.party-btn[data-party="Drittpartei L&N"].active {
    background: #9b59b6;
}

.party-btn[data-party="Drittpartei M&D"].active {
    background: #1abc9c;
}

.party-btn[data-party="Gemeinsam"].active {
    background: #8b5cf6;
}

.party-btn[data-party="Fremd"].active {
    background: #6366f1;
}

/* Button Styles */
.btn {
    padding: clamp(8px, 2vw, 12px) clamp(16px, 3vw, 24px);
    border: none;
    border-radius: 6px;
    font-size: clamp(0.85em, 1.5vw, 1em);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
    background: #f3f4f6;
    color: #1f2937;
    border: 1px solid #d1d5db;
}

.btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.btn-primary {
    background: #f3f4f6;
    color: #1f2937;
    border: 1px solid #d1d5db;
}

.btn-primary:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.btn-secondary {
    background: #f3f4f6;
    color: #1f2937;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.btn-danger {
    background: #f3f4f6;
    color: #1f2937;
    border: 1px solid #d1d5db;
}

.btn-danger:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 18px;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    margin-bottom: -1px;
    font-size: 0.95em;
}

.tab-btn.active {
    color: #1f2937;
    border-bottom-color: #1f2937;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Reservation List */
.reservation-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reservation-list.scrollable {
    max-height: 400px;
    overflow-y: auto;
}

.reservation-item {
    background: #f9fafb;
    padding: 12px 14px;
    border-radius: 8px;
    border-left: 3px solid #d1d5db;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    border: 1px solid #e5e7eb;
    border-left: 3px solid #d1d5db;
}

.reservation-item.latest-reservation {
    background: #ecfdf5;
    border-color: #a7f3d0;
    border-left-color: #10b981;
    box-shadow: 0 0 0 1px #10b981 inset;
}

.reservation-item.ln {
    border-left-color: #e74c3c;
}

.reservation-item.md {
    border-left-color: #f39c12;
}

.reservation-item.drittpartei-ln {
    border-left-color: #9b59b6;
}

.reservation-item.drittpartei-md {
    border-left-color: #1abc9c;
}

.reservation-info {
    flex: 1;
    min-width: 200px;
}

.reservation-dates {
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
    font-size: 0.95em;
}

.reservation-party {
    color: #6b7280;
    font-size: 0.9em;
}

.reservation-guest {
    color: #6b7280;
    font-size: 0.9em;
}

.new-badge {
    display: inline-block;
    background: #10b981;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.7em;
    font-weight: 700;
    margin-left: 8px;
}

.empty-state {
    text-align: center;
    color: #9ca3af;
    padding: 24px;
    font-style: italic;
}

/* Calendar Styles */
.calendar-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

#yearInput {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    width: 90px;
    font-size: 1em;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.month-calendar {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    background: white;
}

.month-calendar h3 {
    text-align: center;
    margin-bottom: 10px;
    color: #111827;
    font-size: 0.9em;
    font-weight: 600;
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 4px;
}

.weekday {
    text-align: center;
    font-weight: 600;
    font-size: 0.65em;
    color: #6b7280;
    padding: 2px;
}

.days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 0.65em;
    cursor: default;
    background: white;
    border: 1px solid #e5e7eb;
    padding: 0;
    min-height: 0;
}

.day:not(.other-month):not(.reserved) {
    cursor: pointer;
}

.day:not(.other-month):not(.reserved):hover {
    background: #f0f9ff;
    border-color: #0ea5e9;
}

.day.other-month {
    color: #d1d5db;
    background: #f9fafb;
    font-size: 0.6em;
}

.day.reserved {
    color: white;
    font-weight: 600;
}

.day.ln {
    background: #e74c3c;
}

.day.md {
    background: #f39c12;
}

.day.drittpartei-ln {
    background: #9b59b6;
}

.day.drittpartei-md {
    background: #1abc9c;
}

.day.gemeinsam {
    background: #8b5cf6;
}

.calendar-legend {
    display: flex;
    gap: clamp(10px, 2vw, 20px);
    flex-wrap: wrap;
    justify-content: center;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    color: #374151;
}

.color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
}

.color.ln {
    background: #e74c3c;
}

.color.md {
    background: #f39c12;
}

.color.drittpartei-ln {
    background: #9b59b6;
}

.color.drittpartei-md {
    background: #1abc9c;
}

.color.gemeinsam {
    background: #8b5cf6;
}

.color.gemeinsam {
    background: #8b5cf6;
}

/* Statistics Styles */
.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

.stats-chart {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.stats-chart canvas {
    max-width: 100%;
    max-height: 400px;
}

.table-wrapper {
    overflow-x: auto;
}

.stats-table {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

table th {
    background: #f9fafb;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #111827;
    border-bottom: 1px solid #e5e7eb;
}

table td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    color: #374151;
}

table tbody tr:hover {
    background: #f9fafb;
}

/* Export Section */
.export-section {
    text-align: center;
}

.export-section h2 {
    margin-bottom: 24px;
}

.export-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.2s;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    padding: 32px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.2s;
    border: 1px solid #e5e7eb;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 16px;
}

.modal-header h2 {
    margin: 0;
    color: #111827;
    font-size: 1.3em;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5em;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #374151;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.form-actions .btn {
    flex: 1;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .calendar-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .section {
        padding: clamp(12px, 2vw, 20px);
        margin-bottom: 15px;
    }

    .section h2 {
        margin-bottom: 12px;
    }

    .party-selector {
        grid-template-columns: repeat(2, 1fr);
    }

    header {
        padding: 15px 10px;
        margin-bottom: 15px;
    }

    header h1 {
        font-size: 1.5em;
    }

    header p {
        font-size: 0.85em;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .calendar-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .month-calendar {
        padding: 8px;
    }

    .month-calendar h3 {
        font-size: 0.85em;
        margin-bottom: 6px;
    }

    .day {
        font-size: 0.6em;
    }


    .weekday {
        font-size: 0.6em;
    }

    .calendar-legend {
        gap: 8px;
        padding: 10px;
    }

    .legend-item {
        font-size: 0.8em;
    }

    .color {
        width: 14px;
        height: 14px;
    }

    .reservation-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .tabs {
        gap: 0;
    }

    .tab-btn {
        padding: 6px 12px;
        font-size: 0.85em;
    }

    .stats-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .stats-chart {
        min-height: 250px;
    }

    .stats-chart canvas {
        max-height: 300px;
    }

    table {
        font-size: 0.85em;
    }

    table th,
    table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .calendar-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .month-calendar {
        padding: 6px;
    }

    .month-calendar h3 {
        font-size: 0.75em;
        margin-bottom: 4px;
    }

    .party-selector {
        grid-template-columns: repeat(1, 1fr);
    }    .days {
        gap: 1px;
    }

    .weekdays {
        gap: 1px;
        margin-bottom: 2px;
    }

    .day {
        font-size: 0.6em;
    }

    .weekday {
        font-size: 0.6em;
    }

    .btn {
        padding: 6px 12px;
        font-size: 0.8em;
    }

    .tab-btn {
        padding: 6px 10px;
        font-size: 0.8em;
    }

    .reservation-item {
        padding: 10px;
        font-size: 0.85em;
    }

    .calendar-controls {
        flex-direction: column;
        gap: 8px;
    }

    .calendar-controls .btn {
        width: 100%;
    }

    #yearInput {
        width: 100%;
    }

    table {
        font-size: 0.8em;
    }

    table th,
    table td {
        padding: 6px;
    }
}

