* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #1a1a1a;
    color: #e0e0e0;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.container {
    width: 100vw;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}

h1, h2 {
    color: #ffffff;
    margin-bottom: 20px;
}

/* Main Layout - Kalender Grid nimmt vollen Platz */
.main-layout {
    display: block;
    height: calc(100vh - 120px);
}

/* Foto-Bibliothek */
.photo-library {
    background: #2d2d2d;
    padding: 20px;
    border-radius: 8px 0 0 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    border: 1px solid #404040;
    width: 350px;
    height: 100%;
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%) translateX(320px);
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow: hidden;
}

.photo-library:hover,
.photo-library.show-on-empty-hover,
.photo-library.active {
    transform: translateY(-50%) translateX(0);
}

.photo-library.active {
    box-shadow: 0 4px 20px rgba(0, 120, 212, 0.5);
    border-color: #0078d4;
}

.photo-library::before {
    content: '📸';
    position: absolute;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    background: #0078d4;
    color: white;
    width: 30px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px 0 0 6px;
    font-size: 16px;
    cursor: pointer;
}

.photo-collection {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: calc(100% - 60px);
    overflow-y: auto;
    padding: 10px;
    border: 2px dashed #555;
    border-radius: 4px;
    background: #1f1f1f;
}

.photo-item {
    width: 100%;
    height: 120px;
    border-radius: 4px;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
    object-fit: cover;
    border: 2px solid transparent;
}

.photo-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255,255,255,0.1);
    border-color: #0078d4;
}

.photo-library.active .photo-item {
    cursor: pointer;
}

.photo-library.active .photo-item:hover {
    border-color: #28a745;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.photo-item:active {
    cursor: grabbing;
}

.photo-library.active .photo-item:active {
    cursor: pointer;
}

/* Kalender Grid */
.calendar-grid {
    background: #2d2d2d;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    border: 1px solid #404040;
    width: 100%;
    height: 100%;
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 20px;
    height: calc(100% - 60px);
}

.grid-slot {
    border: 2px dashed #555;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: border-color 0.3s, background-color 0.3s;
    background: #1f1f1f;
    aspect-ratio: 3/2;
}

.grid-slot:hover {
    border-color: #0078d4;
    background-color: #262626;
}

.grid-slot.empty-hover:hover {
    border-color: #28a745;
    background-color: #1a3326;
    animation: pulse-border 1.5s ease-in-out infinite;
}

.grid-slot.active-target {
    border-color: #0078d4;
    background-color: #1a3a5c;
    box-shadow: 0 0 20px rgba(0, 120, 212, 0.4);
    animation: pulse-border-blue 1.5s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% {
        border-color: #28a745;
    }
    50% {
        border-color: #20c997;
    }
}

@keyframes pulse-border-blue {
    0%, 100% {
        border-color: #0078d4;
        box-shadow: 0 0 20px rgba(0, 120, 212, 0.4);
    }
    50% {
        border-color: #20a8ff;
        box-shadow: 0 0 30px rgba(32, 168, 255, 0.6);
    }
}

.grid-slot.drag-over {
    border-color: #0078d4;
    background-color: #1a3a5c;
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(0, 120, 212, 0.3);
}

.grid-slot img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    border-radius: 4px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.grid-slot img:hover {
    transform: scale(1.02);
}

.grid-slot img[draggable="true"] {
    cursor: grab;
}

.grid-slot img[draggable="true"]:active {
    cursor: grabbing;
}

.slot-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 120, 212, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
}

.empty-slot {
    color: #888;
    font-style: italic;
}

.remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.remove-btn:hover {
    background: rgba(220, 53, 69, 1);
}

/* Titel-Anzeige unterhalb des Fotos im Grid */
.photo-title-display {
    position: absolute;
    bottom: 40px; /* Über dem Monatslabel */
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0.4));
    color: white;
    padding: 18px 16px 26px 16px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    line-height: 1.4;
    letter-spacing: 0.3px;
}

/* Titel anzeigen wenn showTitles aktiv ist */
.grid-slot.show-titles .photo-title-display {
    opacity: 1;
}

/* Titel beim Hover immer anzeigen (auch wenn global ausgeblendet) */
.grid-slot:hover .photo-title-display {
    opacity: 1;
}

/* Scrollbar Styling für Dark Theme */
.photo-collection::-webkit-scrollbar {
    width: 8px;
}

.photo-collection::-webkit-scrollbar-track {
    background: #1f1f1f;
    border-radius: 4px;
}

.photo-collection::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.photo-collection::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 10px;
    }
    
    .main-layout {
        height: auto;
    }
    
    .photo-library {
        width: 280px;
        transform: translateY(-50%) translateX(250px);
        height: 80vh;
    }
    
    .photo-library:hover {
        transform: translateY(-50%) translateX(0);
    }
    
    .photo-library::before {
        left: -25px;
        width: 25px;
        height: 50px;
        font-size: 14px;
    }
    
    .photo-collection {
        flex-direction: column;
        height: calc(100% - 60px);
    }
    
    .photo-item {
        width: 100%;
        height: 120px;
    }
    
    .calendar-grid {
        height: auto;
        width: 100%;
    }
    
    .grid {
        height: 80vh;
        min-height: 600px;
    }
    
    .grid-slot {
        aspect-ratio: 3/2;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 5px;
    }
    
    .photo-library {
        padding: 15px;
        width: 250px;
        transform: translateY(-50%) translateX(220px);
        height: 70vh;
    }
    
    .photo-library:hover {
        transform: translateY(-50%) translateX(0);
    }
    
    .photo-library::before {
        left: -20px;
        width: 20px;
        height: 40px;
        font-size: 12px;
    }
    
    .calendar-grid {
        padding: 15px;
    }
    
    .grid {
        gap: 15px;
    }
}

/* Layout Controls */
.layout-controls {
    margin-bottom: 20px;
    position: relative;
}

.control-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.control-btn {
    background: #0078d4;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.control-btn:hover {
    background: #106ebe;
    transform: translateY(-1px);
}

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

.clear-btn {
    background: #dc3545;
}

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

.export-btn {
    background: #28a745;
}

.export-btn:hover {
    background: #218838;
}

.import-btn {
    background: #17a2b8;
}

.import-btn:hover {
    background: #138496;
}

.share-btn {
    background: #fd7e14;
}

.share-btn:hover {
    background: #e8590c;
}

.load-hash-btn {
    background: #6f42c1;
}

.load-hash-btn:hover {
    background: #5a32a3;
}

.library-btn {
    background: #20c997;
}

.library-btn:hover {
    background: #1aa179;
}

.library-btn.active {
    background: #17a2b8;
    box-shadow: 0 0 0 3px rgba(32, 201, 151, 0.3);
}

.titles-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.titles-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-1px);
}

.titles-btn.active {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

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

.notification.success {
    background: #28a745;
}

.notification.error {
    background: #dc3545;
}

.notification.warning {
    background: #ffc107;
    color: #212529;
}

.notification.info {
    background: #17a2b8;
}

/* Lightbox (Vollbild-Anzeige) */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.show {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
    transition: color 0.2s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    color: #ff6b6b;
}

.lightbox-info {
    margin-top: 15px;
    text-align: center;
}

.lightbox-month {
    color: white;
    font-size: 18px;
    font-weight: 500;
    background: rgba(0, 120, 212, 0.8);
    padding: 8px 16px;
    border-radius: 20px;
}

.lightbox-title {
    display: block;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 10px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.lightbox-controls {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.lightbox-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}

.lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

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

/* Mobile Optimierung */
@media (max-width: 768px) {
    .lightbox-close {
        top: -30px;
        font-size: 24px;
        width: 30px;
        height: 30px;
    }
    
    .lightbox-month {
        font-size: 16px;
        padding: 6px 12px;
    }
    
    .lightbox-btn {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .lightbox-controls {
        gap: 15px;
        margin-top: 15px;
    }
}