/**
 * Calendar Modal Styles
 * Modale Kalender-Ansichten mit Blur-Effekt
 */

/* ========================================
   MODAL BASE STYLES
   ======================================== */

.calendar-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

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

/* Backdrop mit Unschärfe */
.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    z-index: 1;
}

.modal-fullscreen .modal-content {
    max-width: 80%;
    width: 80%;
    max-height: 80vh;
    height: 80vh;
}

/* ========================================
   MODAL HEADER
   ======================================== */

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.modal-header h2 {
    margin: 0;
    flex-grow: 1;
    text-align: center;
}

.back-button,
.close-modal {
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    font-size: 18px;
}

.back-button:hover,
.close-modal:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.back-button {
    position: absolute;
    left: 24px;
}

.close-modal {
    position: absolute;
    right: 24px;
}

/* ========================================
   MODAL BODY
   ======================================== */

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

.modal-fullscreen .modal-body {
    display: flex;
    flex-direction: column;
    height: calc(100% - 80px);
}

/* ========================================
   CALENDAR OPTIONS (Selection Modal)
   ======================================== */

.calendar-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.calendar-option {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.calendar-option:hover {
    background: white;
    border-color: #3b82f6;
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.15);
    transform: translateY(-4px);
}

.calendar-option i {
    margin-bottom: 12px;
}

.calendar-option h3 {
    margin: 8px 0;
    color: #1f2937;
}

.calendar-option p {
    margin: 4px 0;
}

/* ========================================
   CALENDAR CONTROLS
   ======================================== */

.calendar-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.btn {
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    text-decoration: none;
}

.btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.btn-primary {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.btn-secondary {
    background: #6b7280;
    border-color: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
    border-color: #4b5563;
}

/* ========================================
   PLATES TOOLBAR (Red Plates)
   ======================================== */

.plates-toolbar {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
    border: 2px dashed #d1d5db;
}

.plate-draggable {
    position: relative;
    display: inline-block;
    cursor: grab;
    transition: all 0.2s ease;
}

.plate-draggable:active {
    cursor: grabbing;
}

.plate-draggable:hover {
    transform: scale(1.05);
}

.plate-counter-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #10b981;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.plate-counter-badge.badge-red {
    background: #ef4444;
}

.plate-counter-badge.badge-orange {
    background: #f97316;
}

.plate-counter-badge.badge-green {
    background: #10b981;
}

.calendar-info-text {
    text-align: center;
    color: #6b7280;
    font-size: 14px;
    margin: 15px 0;
    padding: 10px;
    background: #f0f9ff;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
}

/* ========================================
   FULLCALENDAR CONTAINER
   ======================================== */

.calendar-fullcalendar {
    flex-grow: 1;
    overflow: auto;
    min-height: 500px;
}

.modal-fullscreen .calendar-fullcalendar {
    height: 100%;
}

/* ========================================
   BLUR EFFECT (Background)
   ======================================== */

.modal-blur {
    filter: blur(8px);
    -webkit-filter: blur(8px);
    transition: filter 0.3s ease;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 400px;
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-icon {
    font-size: 24px;
}

.toast-success {
    border-left: 4px solid #10b981;
}

.toast-success .toast-icon {
    color: #10b981;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

.toast-error .toast-icon {
    color: #ef4444;
}

.toast-info {
    border-left: 4px solid #3b82f6;
}

.toast-info .toast-icon {
    color: #3b82f6;
}

.toast-message {
    flex-grow: 1;
    color: #374151;
    font-size: 14px;
    line-height: 1.5;
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   APPLE DESIGN INTEGRATION
   ======================================== */

/* Apple Calendar Container */
.apple-calendar-container {
    flex-grow: 1;
    overflow: auto;
    background: #ffffff;
    border-radius: 12px;
    padding: 10px;
}

/* Apple Info Text */
.apple-info-text {
    text-align: center;
    color: #6b7280;
    font-size: 14px;
    margin: 15px 0;
    padding: 12px;
    background: #f0f9ff;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
    font-weight: 500;
}

/* Apple Plate Toolbar */
.apple-plate-toolbar {
    padding: 20px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    border-radius: 12px;
    margin-bottom: 20px;
}

/* Apple Plate Container */
.apple-plate-container {
    position: relative !important;
    display: inline-block;
    padding-top: 30px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.apple-plate-container:hover {
    transform: translateY(-2px);
}

.apple-plate-container .plate-content {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.apple-plate-container:hover .plate-content {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.apple-plate-container:active .plate-content {
    cursor: grabbing !important;
    transform: scale(0.98);
}

.apple-plate-container.exhausted {
    opacity: 0.5 !important;
    filter: grayscale(100%) !important;
    pointer-events: none;
}

/* Apple Counter Badge */
.apple-counter-badge {
    position: absolute !important;
    top: -8px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 4px 12px !important;
    border-radius: 12px !important;
    min-width: 80px !important;
    text-align: center !important;
    z-index: 10 !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12) !important;
    white-space: nowrap !important;
    line-height: 1.4 !important;
    transition: all 0.2s ease !important;
}

.apple-counter-badge:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
}

.apple-counter-badge.badge-red {
    background-color: #ff3b30 !important;
    color: white !important;
    border: 2px solid #ff3b30 !important;
}

.apple-counter-badge.badge-orange {
    background-color: #ff9500 !important;
    color: white !important;
    border: 2px solid #ff9500 !important;
}

.apple-counter-badge.badge-green {
    background-color: #34c759 !important;
    color: white !important;
    border: 2px solid #34c759 !important;
}

/* Apple Admin Section */
.apple-admin-section {
    background-color: #f0f2f5;
    border-radius: 10px;
    padding: 15px;
    margin-top: 20px;
    border: 1px solid #e5e7eb;
}

.apple-admin-section.hidden {
    display: none;
}

.apple-admin-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.apple-admin-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.apple-admin-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.apple-admin-item:last-child {
    border-bottom: none;
}

.apple-admin-item-label {
    font-weight: 500;
    color: #555;
}

.apple-admin-item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.apple-admin-input {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
}

.apple-admin-info {
    font-size: 13px;
    color: #777;
}

.apple-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.apple-btn-primary {
    background-color: #007aff;
    color: white;
    border: 1px solid #007aff;
}

.apple-btn-primary:hover {
    background-color: #005ecb;
    border-color: #005ecb;
}

.apple-btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* Apple Toast Styles */
.apple-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.apple-toast {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 12px 18px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 350px;
    transform: translateX(100%);
    opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.apple-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.apple-toast-icon {
    width: 20px;
    height: 20px;
}

.apple-toast-text {
    flex-grow: 1;
    font-size: 15px;
    color: #333;
}

.apple-toast-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0;
    margin-left: 10px;
}

.apple-toast-close:hover {
    color: #666;
}

.apple-toast-success .apple-toast-icon { color: #34c759; }
.apple-toast-error .apple-toast-icon { color: #ff3b30; }
.apple-toast-info .apple-toast-icon { color: #007aff; }

/* FullCalendar Event Styling */
.fc-event {
    border-radius: 4px !important;
    padding: 4px 6px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
}

.fc-event.event-general {
    background-color: #0078d4 !important;
    border-color: #005a9e !important;
    color: white !important;
}

.fc-event.event-redplates,
.fc-event {
    background-color: #5b89c7 !important;
    border-color: #4a73a8 !important;
    color: white !important;
}

.fc-event.event-own {
    opacity: 1 !important;
}

.fc-event.event-other {
    opacity: 0.85 !important;
    background-color: #6b7280 !important;
    border-color: #4b5563 !important;
}

.fc-event:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    transform: translateY(-1px);
}

.fc-event .fc-event-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.delete-event-icon {
    cursor: pointer;
    color: rgba(255,255,255,0.7);
    margin-left: 4px;
    font-size: 14px;
    font-weight: bold;
    transition: color 0.2s ease;
    padding: 2px 4px;
    border-radius: 3px;
}

.delete-event-icon:hover {
    color: white;
    background-color: rgba(0,0,0,0.2);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-fullscreen .modal-content {
        width: 95%;
        height: 95vh;
        max-width: 95%;
        max-height: 95vh;
    }

    .calendar-options {
        grid-template-columns: 1fr;
    }

    .modal-header {
        padding: 16px;
    }

    .modal-body {
        padding: 16px;
    }

    .plates-toolbar {
        padding: 15px;
    }

    .toast {
        right: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
    }
}

@media (min-width: 769px) and (max-width: 1439px) {
    .modal-fullscreen .modal-content {
        width: 85%;
        height: 85vh;
    }
}

/* ========================================
   LOADING STATE
   ======================================== */

.calendar-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: #6b7280;
}

.calendar-loading i {
    font-size: 48px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

.modal-body::-webkit-scrollbar,
.calendar-fullcalendar::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track,
.calendar-fullcalendar::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb,
.calendar-fullcalendar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover,
.calendar-fullcalendar::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

