/**
 * DOMINO Gruppenraum-Kalender – Stylesheet
 *
 * Farbschema basierend auf domino-giessen.de:
 * Rot #FF0000, Grün #008000, Blau #0000FF, Gelb #FFCC01
 * Olive #32381D, Jet #333333, Grau #999999
 */

/* ============================================================
   RESET & GRUNDLAGEN
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Open Sans', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: #FFFFFF;
    color: #333333;
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: #0000FF;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============================================================
   DOMINO LOGO-FARBEN
   ============================================================ */
.c-red { color: #FF0000; }
.c-yellow { color: #FFCC01; }
.c-green { color: #008000; }
.c-blue { color: #0000FF; }

.logo {
    font-weight: 700;
    font-size: 1.4em;
    letter-spacing: 1px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 0.95em;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
    line-height: 1.4;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #FFCC01;
    color: #333333;
}
.btn-primary:hover {
    background: #e6b800;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333333;
}
.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-success {
    background: #008000;
    color: #FFFFFF;
}
.btn-success:hover {
    background: #006600;
}

.btn-danger {
    background: #FF0000;
    color: #FFFFFF;
}
.btn-danger:hover {
    background: #cc0000;
}

.btn-warning {
    background: #ff8800;
    color: #FFFFFF;
}
.btn-warning:hover {
    background: #e67a00;
}

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

/* ============================================================
   NACHRICHTEN
   ============================================================ */
.msg {
    padding: 12px 16px;
    border-radius: 4px;
    margin: 15px 0;
    font-size: 0.95em;
}

.msg.success {
    background: #e0ffe0;
    color: #006600;
    border-left: 4px solid #008000;
}

.msg.error {
    background: #ffe0e0;
    color: #cc0000;
    border-left: 4px solid #FF0000;
}

.msg.info {
    background: #e0e0ff;
    color: #0000cc;
    border-left: 4px solid #0000FF;
}

/* ============================================================
   FORMULAR-ELEMENTE
   ============================================================ */
label {
    display: block;
    margin-top: 14px;
    font-weight: 600;
    color: #333333;
    font-size: 0.95em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    margin-top: 4px;
    border: 1px solid #cccccc;
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
    color: #333333;
    background: #FFFFFF;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #FFCC01;
    box-shadow: 0 0 0 3px rgba(255, 204, 1, 0.25);
}

textarea {
    min-height: 80px;
    resize: vertical;
}

.hint {
    color: #999999;
    font-size: 0.9em;
    margin-top: 5px;
}

/* ============================================================
   AUTH-SEITEN (Login, Registrierung, Profil)
   ============================================================ */
.auth-container {
    max-width: 550px;
    margin: 40px auto;
    padding: 30px;
    background: #FFFFFF;
    border: 2px solid #FFCC01;
    border-radius: 8px;
}

.auth-header {
    text-align: center;
    padding-bottom: 15px;
    margin-bottom: 20px;
    border-bottom: 3px solid #FFCC01;
}

.auth-title {
    display: block;
    font-size: 1em;
    color: #666666;
    margin-top: 5px;
}

.auth-container h2 {
    color: #333333;
    font-size: 1.3em;
    margin-bottom: 5px;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eeeeee;
    color: #666666;
}

/* Profil-Seite */
.profile-section {
    margin-top: 25px;
    padding: 20px;
    background: #fafafa;
    border-radius: 6px;
    border: 1px solid #eeeeee;
}

.profile-section h3 {
    font-size: 1.1em;
    color: #333333;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #FFCC01;
}

.profile-table {
    width: 100%;
}

.profile-table td {
    padding: 6px 0;
    vertical-align: top;
}

.profile-table .label {
    font-weight: 600;
    width: 130px;
    color: #666666;
}

.danger-zone {
    border-color: #ffcccc;
    background: #fff8f8;
}

.danger-zone h3 {
    border-bottom-color: #FF0000;
    color: #cc0000;
}

.warning-text {
    color: #cc0000;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: normal;
    margin-top: 0;
}

.toggle-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
    accent-color: #FFCC01;
    transform: scale(1.3);
}

.toggle-text {
    font-size: 0.95em;
}

.profile-actions {
    margin-top: 25px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================================================
   ADMIN-BEREICH
   ============================================================ */
.admin-container {
    max-width: 1100px;
    margin: 20px auto;
    padding: 20px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 20px;
    border-bottom: 3px solid #FFCC01;
    flex-wrap: wrap;
    gap: 10px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-header h1 {
    font-size: 1.3em;
    color: #333333;
}

.header-right {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-section {
    margin-top: 30px;
}

.admin-section h2 {
    font-size: 1.2em;
    color: #333333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    background: #f0f0f0;
    color: #666666;
}

.badge-warning {
    background: #FFCC01;
    color: #333333;
}

.badge-admin {
    background: #0000FF;
    color: #FFFFFF;
}

.badge-info {
    background: #e0e0ff;
    color: #0000FF;
}

.table-responsive {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.admin-table th {
    background: #32381D;
    color: #FFFFFF;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
}

.admin-table th:first-child {
    border-radius: 4px 0 0 0;
}

.admin-table th:last-child {
    border-radius: 0 4px 0 0;
}

.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eeeeee;
    vertical-align: middle;
}

.admin-table tr:hover {
    background: #fafafa;
}

.admin-table tr.current-user {
    background: #fffff0;
}

.admin-table .actions {
    white-space: nowrap;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.empty-state {
    color: #999999;
    font-style: italic;
    padding: 20px 0;
}

/* ============================================================
   KALENDER - HAUPTSEITE
   ============================================================ */
.calendar-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

/* Kalender-Header */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 5px;
    border-bottom: 3px solid #FFCC01;
    flex-wrap: wrap;
    gap: 10px;
}

.calendar-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.calendar-header-right {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.calendar-title-section {
    text-align: center;
    margin: 15px 0 20px 0;
}

.calendar-title {
    font-size: 1.5em;
    color: #333333;
    font-weight: 700;
}

.calendar-title .month-name {
    color: #0000FF;
}

/* Navigation */
.calendar-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #FFCC01;
    color: #333333;
    border: none;
    border-radius: 50%;
    font-size: 1.2em;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: bold;
}

.nav-btn:hover {
    background: #e6b800;
}

.nav-today {
    padding: 6px 16px;
    border-radius: 20px;
    width: auto;
    font-size: 0.9em;
}

.calendar-month-year {
    font-size: 1.1em;
    font-weight: 600;
    min-width: 200px;
    text-align: center;
}

/* Kalender-Raster */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(130px, 1fr));
    gap: 1px;
    background: #cccccc;
    border: 1px solid #cccccc;
    border-radius: 6px;
    overflow-x: auto;
}

.calendar-weekday {
    background: #32381D;
    color: #FFFFFF;
    padding: 10px 5px;
    text-align: center;
    font-weight: 600;
    font-size: clamp(0.7em, 1.2vw, 0.9em);
}

.calendar-day {
    background: #FFFFFF;
    height: 130px;
    padding: 5px;
    position: relative;
    cursor: pointer;
    transition: background 0.15s;
    overflow: hidden;
}

.calendar-day:hover {
    background: #fffff0;
}

.calendar-day.other-month {
    background: #f8f8f8;
    cursor: default;
}

.calendar-day.other-month:hover {
    background: #f8f8f8;
}

.calendar-day.today {
    background: #fffff0;
    box-shadow: inset 0 0 0 2px #FFCC01;
}

.calendar-day.past {
    background: #fafafa;
}

.calendar-day.past .day-number {
    color: #999999;
}

.day-number {
    font-weight: 700;
    font-size: clamp(0.75em, 1.3vw, 0.95em);
    color: #333333;
    margin-bottom: 3px;
}

.day-number.weekend {
    color: #FF0000;
}

.day-events-count {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #FFCC01;
    color: #333333;
    font-size: clamp(0.55em, 0.9vw, 0.7em);
    font-weight: 600;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.day-events-count.full {
    background: #FF0000;
    color: #FFFFFF;
}

/* Einträge im Kalender */
.event-item {
    padding: 2px 5px;
    margin: 2px 0;
    border-left: 3px solid #999999;
    border-radius: 0 3px 3px 0;
    font-size: clamp(0.55em, 1vw, 0.8em);
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    transition: background 0.15s;
    background: #f5f5f5;
}

.event-item:hover {
    filter: brightness(0.95);
}

/* Raum-Farben */
.event-item.room-gr {
    background: #fff8e0;
    border-left-color: #FFCC01;
}
.event-item.room-gr:hover {
    background: #fff0c0;
}

.event-item.room-rs {
    background: #ffe0e0;
    border-left-color: #FF0000;
}
.event-item.room-rs:hover {
    background: #ffd0d0;
}

.event-item.room-gz {
    background: #e0e0ff;
    border-left-color: #0000FF;
}
.event-item.room-gz:hover {
    background: #d0d0ff;
}

.event-time {
    font-weight: 600;
    color: #666666;
    font-size: 0.9em;
}

.event-title {
    color: #333333;
}

.add-event-hint {
    display: none;
    position: absolute;
    bottom: 3px;
    right: 5px;
    color: #999999;
    font-size: 0.75em;
}

.calendar-day:hover .add-event-hint {
    display: block;
}

.calendar-day.past .add-event-hint,
.calendar-day.other-month .add-event-hint {
    display: none !important;
}

/* ============================================================
   MODAL (Eintrag erstellen / bearbeiten)
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #FFFFFF;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border-top: 4px solid #FFCC01;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eeeeee;
}

.modal-header h3 {
    font-size: 1.15em;
    color: #333333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #999999;
    padding: 0 5px;
    line-height: 1;
}

.modal-close:hover {
    color: #333333;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eeeeee;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.modal-footer-left {
    display: flex;
    gap: 8px;
}

.modal-footer-right {
    display: flex;
    gap: 8px;
}

/* Allday Toggle */
.allday-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 10px;
    background: #fafafa;
    border-radius: 4px;
}

.allday-toggle label {
    margin-top: 0;
    font-weight: normal;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.allday-toggle input[type="checkbox"] {
    width: auto;
    accent-color: #FFCC01;
    transform: scale(1.2);
    cursor: pointer;
}

.time-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.time-fields.hidden,
.hidden {
    display: none;
}

/* Event-Detail-Modal */
.event-detail {
    padding: 15px 0;
}

.event-detail-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.event-detail-label {
    font-weight: 600;
    color: #666666;
    min-width: 100px;
}

.event-detail-value {
    color: #333333;
}

/* Duplizieren-Formular */
.duplicate-form {
    margin-top: 15px;
    padding: 15px;
    background: #f0f8ff;
    border-radius: 4px;
    border: 1px solid #cce5ff;
}

.duplicate-form h4 {
    margin-bottom: 10px;
    color: #333333;
}

/* ============================================================
   FOOTER
   ============================================================ */
.calendar-footer {
    text-align: center;
    padding: 20px;
    margin-top: 30px;
    color: #999999;
    font-size: 0.85em;
    border-top: 1px solid #eeeeee;
}

/* ============================================================
   LEGENDE
   ============================================================ */
.calendar-legend {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    padding: 10px 15px;
    background: #fafafa;
    border-radius: 4px;
    font-size: 0.85em;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 2px;
}

.legend-color.room-gr {
    background: #fff8e0;
    border-left: 3px solid #FFCC01;
}

.legend-color.room-rs {
    background: #ffe0e0;
    border-left: 3px solid #FF0000;
}

.legend-color.room-gz {
    background: #e0e0ff;
    border-left: 3px solid #0000FF;
}

.legend-color.today-marker {
    box-shadow: inset 0 0 0 2px #FFCC01;
    background: #fffff0;
}

/* ============================================================
   SERIENTERMINE
   ============================================================ */

/* Serie-Button in Navigation (Pill-Form wie "Heute") */
.nav-series {
    width: auto;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9em;
}

/* Wochentag-Checkboxen (7 runde Buttons) */
.weekday-checkboxes {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.weekday-checkbox {
    display: block;
    margin-top: 0;
    cursor: pointer;
}

.weekday-checkbox input[type="checkbox"] {
    display: none;
}

.weekday-checkbox span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid #cccccc;
    font-size: 0.85em;
    font-weight: 600;
    color: #333333;
    background: #FFFFFF;
    transition: all 0.2s;
    user-select: none;
}

.weekday-checkbox input[type="checkbox"]:checked + span {
    background: #FFCC01;
    border-color: #FFCC01;
    color: #333333;
}

.weekday-checkbox span:hover {
    border-color: #FFCC01;
}

/* Serien-Datum-Bereich (2-spaltig) */
.series-date-range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Wiederholungsoptionen-Container */
.series-repeat-options {
    margin-top: 10px;
}

/* Ergebnis-Anzeige nach Serienerstellung */
.series-result {
    margin-top: 15px;
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 0.95em;
}

.series-result.success {
    background: #e0ffe0;
    color: #006600;
    border-left: 4px solid #008000;
}

.series-result.error {
    background: #ffe0e0;
    color: #cc0000;
    border-left: 4px solid #FF0000;
}

/* Serien-Aktions-Buttons (Nur diesen / Alle zukünftigen) */
.series-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.series-action-buttons .btn {
    width: 100%;
    text-align: center;
}

/* Serien-Indikator auf Events im Kalender */
.event-item.series-event::after {
    content: '\21BB';
    margin-left: 4px;
    font-size: 0.85em;
    opacity: 0.5;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .calendar-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-table {
        font-size: 0.8em;
    }

    .admin-table .actions {
        flex-direction: column;
    }

    .modal {
        max-width: 100%;
        margin: 10px;
    }

    .auth-container {
        margin: 20px 10px;
        padding: 20px;
    }

    .profile-actions {
        flex-direction: column;
    }

    .calendar-title {
        font-size: 1.2em;
    }

    .calendar-nav {
        gap: 8px;
    }

    .time-fields {
        grid-template-columns: 1fr;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer-left,
    .modal-footer-right {
        width: 100%;
    }

    .modal-footer-left .btn,
    .modal-footer-right .btn {
        flex: 1;
        text-align: center;
    }

    /* Serientermine responsive */
    .weekday-checkbox span {
        width: 36px;
        height: 36px;
        font-size: 0.8em;
    }

    .series-date-range {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   DRUCK-STYLES
   ============================================================ */
@media print {
    .calendar-header-right,
    .calendar-nav .nav-today,
    .add-event-hint,
    .btn {
        display: none !important;
    }

    .calendar-grid {
        border: 2px solid #000;
    }

    .calendar-day {
        min-height: 80px;
        border: 1px solid #ccc;
    }

    body {
        font-size: 11pt;
    }
}
