/* === APPOINTMENT SYSTEM STYLES === */

/* Modal Styles */
.appointment-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.modal-content {
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--hover-color);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 5px rgba(74, 158, 255, 0.3);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

/* Color Picker */
.color-picker {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 10px currentColor;
}

/* Checkbox Groups */
.reminder-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.reminder-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

#recurring-options {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-primary);
    border-radius: 6px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.btn-cancel,
.btn-save {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
}

.btn-cancel {
    background: var(--hover-color);
    color: var(--text-primary);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-save {
    background: var(--accent-color);
    color: white;
}

.btn-save:hover {
    background: #6bb1ff;
    box-shadow: 0 0 10px rgba(74, 158, 255, 0.5);
}

/* Context Menu */
.context-menu {
    position: absolute;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px;
    display: none;
    z-index: 10001;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    min-width: 200px;
}

.context-menu-item {
    padding: 10px 15px;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.context-menu-item:hover {
    background: var(--hover-color);
}

.context-menu-item[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.context-menu-item[disabled]:hover {
    background: transparent;
}

.context-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 5px 0;
}

.context-menu-submenu {
    position: relative;
}

.context-menu-submenu .submenu {
    position: absolute;
    left: 100%;
    top: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px;
    display: none;
    min-width: 150px;
}

.context-menu-submenu:hover .submenu {
    display: block;
}

/* Sidebar */
.sidebar-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--hover-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.sidebar-toggle svg {
    fill: currentColor;
}

.appointment-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100%;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    z-index: 9999;
}

.appointment-sidebar.active {
    right: 0;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.sidebar-close:hover {
    background: var(--hover-color);
}

.sidebar-controls {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-controls input,
.sidebar-controls select {
    width: 100%;
    padding: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.sidebar-date-group {
    margin-bottom: 20px;
}

.sidebar-date-group h4 {
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.sidebar-appointment {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.sidebar-appointment:hover {
    transform: translateX(-5px);
}

.appointment-color {
    width: 4px;
    height: 40px;
    border-radius: 2px;
    flex-shrink: 0;
}

.appointment-info {
    flex: 1;
}

.appointment-time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.appointment-title {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.appointment-location {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.appointment-actions {
    display: flex;
    gap: 5px;
}

.appointment-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.appointment-actions button:hover {
    opacity: 1;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

.btn-export,
.btn-import {
    flex: 1;
    padding: 8px;
    background: var(--hover-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-export:hover,
.btn-import:hover {
    background: var(--accent-color);
}

.calendar-day {
    position: relative; /* Stelle sicher dass position gesetzt ist */
}

/* Calendar Enhancements - KORRIGIERT */
.calendar-day.has-appointments {
    background: var(--hover-color);
    border: 1px solid var(--accent-color);
}

/* Appointment Badge - Grid-like Design */
.appointment-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;  /* Leicht größer für bessere Lesbarkeit */
    height: 16px;
    border-radius: 2px; /* Eckig wie Grid-Zellen */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: white;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
    z-index: 10;
    pointer-events: none; /* WICHTIG: Verhindert Interferenz mit Klicks */
    user-select: none; /* Verhindert Text-Selektion */
} 

.calendar-day.drag-over {
    background: var(--accent-color);
    transform: scale(1.05);
}

.calendar-day:hover .appointment-badge {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Grid Cell Appointments - KORRIGIERT */
.grid-cell.has-appointment {
    position: relative;
    cursor: pointer;
    /* Farbe wird via JS gesetzt */
}

/* Standard Pulsieren für Termine */
.grid-cell.has-appointment:not(.appointment-soon):not(.appointment-now):not(.appointment-imminent):not(.appointment-past) {
    animation: appointment-pulse 3s infinite !important;
}

@keyframes appointment-pulse {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
        filter: brightness(1.2);
    }
}

/* Termin bald - schnelleres Pulsieren */
.grid-cell.appointment-soon {
    animation: appointment-pulse-fast var(--pulse-speed, 2s) infinite !important;
}

@keyframes appointment-pulse-fast {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.15);
        filter: brightness(1.5);
    }
}

/* Termin läuft gerade */
.grid-cell.appointment-now {
    animation: appointment-glow 1s infinite !important;
}

@keyframes appointment-glow {
    0%, 100% {
        transform: scale(1.1);
        filter: brightness(1.2);
        box-shadow: 0 0 20px var(--appointment-color),
                    0 0 40px var(--appointment-color);
    }
    50% {
        transform: scale(1.2);
        filter: brightness(1.5);
        box-shadow: 0 0 30px var(--appointment-color),
                    0 0 60px var(--appointment-color);
    }
}

/* Termin unmittelbar bevorstehend */
.grid-cell.appointment-imminent {
    animation: appointment-alert 0.5s infinite !important;
    background: red !important;
}

@keyframes appointment-alert {
    0%, 100% {
        transform: scale(1.3);
        box-shadow: 0 0 30px red, 0 0 60px red;
    }
    50% {
        transform: scale(1.5);
        box-shadow: 0 0 40px red, 0 0 80px red;
    }
}

/* Vergangene Termine heute */
.grid-cell.appointment-past {
    opacity: 0.5;
    filter: grayscale(50%);
    animation: none !important;
}

.grid-cell.drag-target {
    background: var(--accent-color) !important;
    opacity: 0.5;
    transform: scale(1.1);
}

/* Drag Image */
.drag-image {
    font-size: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    z-index: 10002;
    transition: transform 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast-success {
    background: #4caf50;
}

.toast-error {
    background: #f44336;
}

.toast-warning {
    background: #ff9800;
}

.toast-info {
    background: #2196f3;
}

/* Dialog */
.appointment-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
}

.dialog-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
}

.dialog-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    min-width: 400px;
    max-width: 500px;
}

.conflict-warning h3 {
    color: #ff9800;
    margin-bottom: 15px;
}

.conflict-details {
    background: var(--bg-primary);
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
}

.conflict-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 20px;
}

.conflict-actions button {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.conflict-actions button:first-child {
    background: var(--hover-color);
    color: var(--text-primary);
}

.conflict-actions button:last-child {
    background: #ff9800;
    color: white;
}

/* Loading States */
.loading,
.no-appointments,
.error {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .appointment-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .color-picker {
        grid-template-columns: repeat(4, 1fr);
    }
}