/* Orange-Weiß Farbpalette für Reodental Schützengesellschaft */
:root {
    --orange-primary: #FF6B35;
    --orange-dark: #E85A2B;
    --orange-light: #FF8F66;
    --orange-pale: #FFE5DC;
    --white: #FFFFFF;
    --gray-light: #F5F5F5;
    --gray-medium: #E0E0E0;
    --gray-dark: #757575;
    --text-dark: #333333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    height: -webkit-fill-available;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--orange-primary) 0%, var(--orange-dark) 100%);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    padding: env(safe-area-inset-top, 20px) env(safe-area-inset-right, 20px) env(safe-area-inset-bottom, 20px) env(safe-area-inset-left, 20px);
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--white);
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(255, 107, 53, 0.3);
    padding: 30px;
}

header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

header .logo {
    max-width: 80px;
    height: auto;
}

header h1 {
    text-align: center;
    color: var(--text-dark);
    font-size: 2.5em;
    margin: 0;
}

.navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--orange-pale);
    border-radius: 10px;
    border-left: 4px solid var(--orange-primary);
}

.navigation h2 {
    color: var(--orange-dark);
    font-size: 1.8em;
}

.actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.btn {
    padding: 10px 20px;
    background: var(--orange-primary);
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
}

.btn:hover {
    background: var(--orange-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.4);
}

.btn-primary {
    background: var(--orange-dark);
}

.btn-primary:hover {
    background: #D04F23;
}

.btn-danger {
    background: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.85em;
}

/* Kalender-Stil */
.kalender {
    margin-top: 20px;
}

.wochentage {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 5px;
}

.wochentage div {
    background: var(--orange-primary);
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    border-radius: 5px;
}

.tage {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.tag {
    min-height: 100px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 8px;
    position: relative;
    transition: all 0.3s;
}

.tag:hover {
    background: #e9ecef;
    transform: scale(1.02);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.tag.leer {
    background: #ffffff;
    border: none;
}

.tag.heute {
    background: #fff3cd;
    border: 2px solid #ffc107;
}

.tag.hat-termine {
    background: var(--orange-pale);
    border-color: var(--orange-light);
}

.tag-nummer {
    font-weight: bold;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.termine-liste {
    margin-top: 5px;
    max-height: 90px;
    overflow: hidden;
}

.termin-eintrag {
    padding: 4px 6px;
    margin-bottom: 3px;
    border-radius: 3px;
    font-size: 0.75em;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: all 0.2s;
}

.termin-eintrag:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.mehr-termine-btn {
    padding: 3px 6px;
    margin-top: 2px;
    border-radius: 3px;
    font-size: 0.7em;
    background: rgba(0,0,0,0.15);
    color: var(--text-dark);
    text-align: center;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.mehr-termine-btn:hover {
    background: rgba(0,0,0,0.25);
}

.termin-eintrag.turnier {
    background: var(--orange-dark);
}

.termin-eintrag.wettkampf {
    background: var(--orange-primary);
}

.termin-eintrag.rundenwettkampf {
    background: var(--orange-light);
}

.termin-eintrag.training {
    background: #FFA500;
    color: white;
}

.termin-eintrag.sonstiges {
    background: var(--gray-dark);
}

.zeit {
    font-weight: bold;
}

/* Legende */
.legende {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.legende h3 {
    margin-bottom: 10px;
    color: #333;
}

.legende-items {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.legende-item {
    font-size: 1em;
}

.legende-item.turnier {
    color: var(--orange-dark);
}

.legende-item.wettkampf {
    color: var(--orange-primary);
}

.legende-item.rundenwettkampf {
    color: var(--orange-light);
}

.legende-item.training {
    color: #FFA500;
}

.legende-item.sonstiges {
    color: var(--gray-dark);
}

/* Formulare */
.termin-form {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 10px;
    margin-top: 20px;
}

.form-gruppe {
    margin-bottom: 20px;
}

.form-gruppe label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.form-gruppe input,
.form-gruppe select,
.form-gruppe textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-gruppe input:focus,
.form-gruppe select:focus,
.form-gruppe textarea:focus {
    outline: none;
    border-color: var(--orange-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.form-zeile {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-aktionen {
    margin-top: 30px;
    display: flex;
    gap: 10px;
}

/* Nachrichten */
.nachricht {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: bold;
}

.nachricht.erfolg {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.nachricht.fehler {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Filter */
.filter-bereich {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.filter-form {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-gruppe {
    display: flex;
    flex-direction: column;
}

.filter-gruppe label {
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.filter-gruppe select,
.filter-gruppe input {
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 5px;
}

/* Tabelle */
.termin-tabelle {
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

table thead {
    background: var(--orange-primary);
    color: white;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

table tbody tr:hover {
    background: #f8f9fa;
}

.typ-badge {
    padding: 5px 10px;
    border-radius: 3px;
    color: white;
    font-size: 0.85em;
    font-weight: bold;
}

.typ-badge.turnier {
    background: var(--orange-dark);
}

.typ-badge.wettkampf {
    background: var(--orange-primary);
}

.typ-badge.rundenwettkampf {
    background: var(--orange-light);
}

.typ-badge.training {
    background: #FFA500;
    color: white;
}

.typ-badge.sonstiges {
    background: var(--gray-dark);
}

.aktionen {
    display: flex;
    gap: 5px;
}

.keine-termine {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-size: 1.2em;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
        border-radius: 10px;
    }

    header h1 {
        font-size: 1.5em;
        margin-bottom: 15px;
    }

    .navigation {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }

    .navigation h2 {
        font-size: 1.3em;
    }

    .navigation .btn {
        width: 100%;
        text-align: center;
    }

    .actions {
        flex-direction: column;
        gap: 8px;
    }

    .actions .btn {
        width: 100%;
    }

    .form-zeile {
        grid-template-columns: 1fr;
    }

    .filter-form {
        flex-direction: column;
    }

    .filter-gruppe {
        width: 100%;
    }

    .aktionen {
        flex-direction: column;
    }

    .btn-small {
        width: 100%;
        margin-bottom: 5px;
    }

    /* Kalender Mobile */
    .wochentage div {
        padding: 5px;
        font-size: 0.8em;
    }

    .tag {
        min-height: 70px;
        font-size: 0.85em;
        padding: 5px;
    }

    .tag-nummer {
        font-size: 0.9em;
    }

    .termin-eintrag {
        font-size: 0.65em;
        padding: 3px 4px;
        margin-bottom: 2px;
    }

    .zeit {
        display: block;
    }

    /* Tabellen Mobile */
    table {
        font-size: 0.75em;
        display: block;
        overflow-x: auto;
    }

    table thead {
        display: none;
    }

    table tbody {
        display: block;
    }

    table tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        padding: 10px;
    }

    table td {
        display: block;
        text-align: left;
        padding: 5px 0;
        border: none;
    }

    table td:before {
        content: attr(data-label);
        font-weight: bold;
        margin-right: 10px;
    }

    /* Formulare Mobile */
    .termin-form {
        padding: 15px;
    }

    .form-gruppe label {
        font-size: 0.95em;
    }

    .form-gruppe input,
    .form-gruppe select,
    .form-gruppe textarea {
        font-size: 16px; /* Verhindert Auto-Zoom auf iOS */
    }

    .form-aktionen {
        flex-direction: column;
    }

    .form-aktionen .btn {
        width: 100%;
    }

    /* Legende Mobile */
    .legende {
        padding: 15px;
    }

    .legende-items {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    .container {
        padding: 20px;
        border-radius: 12px;
    }

    header {
        flex-direction: column;
        gap: 15px;
    }

    header .logo {
        max-width: 60px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .navigation {
        flex-direction: column;
        gap: 15px;
        padding: 12px;
    }

    .navigation h2 {
        font-size: 1.5em;
    }

    .actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.9em;
        -webkit-user-select: none;
        user-select: none;
    }

    .btn:active {
        transform: scale(0.98);
    }

    .wochentage div {
        padding: 8px 5px;
        font-size: 0.85em;
    }

    .tag {
        min-height: 80px;
        padding: 6px;
    }

    .termin-eintrag {
        font-size: 0.7em;
        padding: 3px 5px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
        border-radius: 10px;
    }

    header .logo {
        max-width: 50px;
    }

    header h1 {
        font-size: 1.3em;
    }

    .navigation {
        padding: 10px;
    }

    .navigation h2 {
        font-size: 1.2em;
    }

    .btn {
        padding: 8px 12px;
        font-size: 0.85em;
    }

    .kalender {
        margin-top: 10px;
    }

    .wochentage div {
        padding: 6px 2px;
        font-size: 0.7em;
    }

    .tag {
        min-height: 60px;
        font-size: 0.75em;
        padding: 4px;
    }

    .tag-nummer {
        font-size: 0.9em;
        margin-bottom: 3px;
    }

    .termin-eintrag {
        font-size: 0.6em;
        padding: 2px 4px;
        margin-bottom: 2px;
    }
}

/* iPhone SE and smaller */
@media (max-width: 375px) {
    .container {
        padding: 12px;
    }

    header h1 {
        font-size: 1.1em;
    }

    .navigation h2 {
        font-size: 1.1em;
    }

    .btn {
        padding: 7px 10px;
        font-size: 0.8em;
    }

    .wochentage div {
        padding: 5px 1px;
        font-size: 0.65em;
    }

    .tag {
        min-height: 55px;
        padding: 3px;
    }

    .tag-nummer {
        font-size: 0.85em;
    }

    .termin-eintrag {
        font-size: 0.55em;
    }
}

/* Landscape mode for mobile */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding: 8px;
    }

    .container {
        padding: 12px;
    }

    header {
        flex-direction: row;
        gap: 10px;
        margin-bottom: 15px;
    }

    header .logo {
        max-width: 40px;
    }

    header h1 {
        font-size: 1.1em;
    }

    .navigation {
        padding: 8px;
        margin-bottom: 10px;
    }

    .navigation h2 {
        font-size: 1em;
    }

    .actions {
        margin-bottom: 10px;
    }

    .btn {
        padding: 6px 10px;
        font-size: 0.8em;
    }

    .wochentage div {
        padding: 4px 2px;
        font-size: 0.65em;
    }

    .tag {
        min-height: 50px;
        padding: 3px;
    }

    .tag-nummer {
        font-size: 0.8em;
    }

    .termin-eintrag {
        font-size: 0.5em;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    body {
        min-height: -webkit-fill-available;
    }

    .container {
        margin-bottom: env(safe-area-inset-bottom);
    }

    input, button, select, textarea {
        font-size: 16px;
        -webkit-appearance: none;
        appearance: none;
    }
}

/* Watermark / Footer Credits */
.watermark {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 10px 10px calc(env(safe-area-inset-bottom, 10px) + 5px) 10px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--gray-medium);
    color: var(--gray-dark);
    font-size: 0.8em;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    line-height: 1.4;
}

.watermark-author {
    font-weight: 600;
    color: var(--orange-primary);
}

.watermark-version {
    font-size: 0.85em;
    color: var(--gray-dark);
    margin-top: 2px;
    display: block;
}

/* Add padding to container to prevent content from being hidden behind watermark */
.container {
    margin-bottom: 60px;
}

@media (max-width: 768px) {
    .watermark {
        font-size: 0.7em;
        padding: 8px 8px calc(env(safe-area-inset-bottom, 8px) + 4px) 8px;
    }

    .watermark-version {
        font-size: 0.8em;
    }

    .container {
        margin-bottom: 55px;
    }
}

@media (max-width: 480px) {
    .watermark {
        font-size: 0.65em;
        padding: 6px 6px calc(env(safe-area-inset-bottom, 6px) + 3px) 6px;
    }

    .watermark-version {
        font-size: 0.75em;
    }

    .container {
        margin-bottom: 50px;
    }
}
