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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

h1 {
    font-size: 32px;
    margin-bottom: 20px;
    color: #333;
}

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

.btn-primary, .btn-success, .btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-secondary {
    background: #4299e1;
    color: white;
}

.btn-primary:hover, .btn-success:hover {
    transform: translateY(-2px);
}

.btn-upload {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s;
    background: #f6ad55;
    color: white;
    display: inline-block;
}

.btn-upload:hover {
    transform: translateY(-2px);
}

.btn-delete {
    color: #f56565 !important;
}

.btn-delete:hover:not(:disabled) {
    background: #f56565 !important;
    color: white !important;
}

.btn-danger {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s;
    background: #f56565;
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    background: #e53e3e;
}

.info-box {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
}

.info-box p {
    margin: 5px 0;
    color: #4a5568;
}

.media-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.media-list.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.media-list.list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.media-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    cursor: move;
    transition: all 0.2s;
    position: relative;
}

.media-item:hover {
    background: #edf2f7;
    transform: translateX(5px);
}

.drag-handle {
    font-size: 24px;
    color: #a0aec0;
    cursor: grab;
}

.media-preview-container {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    min-height: 60vh;
    overflow: hidden;
}

.media-preview {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.media-preview img,
.media-preview video {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.media-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filename {
    font-weight: 600;
    color: #2d3748;
}

.title-input {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.title-input:focus {
    outline: none;
    border-color: #667eea;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #a0aec0;
    font-size: 18px;
}

.view-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
}

#searchInput {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
}

#searchInput:focus {
    outline: none;
    border-color: #667eea;
}

.item-count {
    color: #4a5568;
    font-size: 14px;
}

.item-number {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.position-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.position-controls label {
    font-size: 12px;
    color: #718096;
}

.position-select {
    flex: 1;
    padding: 6px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.position-select:focus {
    outline: none;
    border-color: #667eea;
}

.item-controls {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.btn-control {
    padding: 6px 12px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-control:hover:not(:disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.btn-control:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.quick-position {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.quick-position label {
    font-size: 12px;
    color: #718096;
}

.position-input {
    width: 60px;
    padding: 4px 8px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
}

.position-input:focus {
    outline: none;
    border-color: #667eea;
}

.position-total {
    font-size: 12px;
    color: #a0aec0;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 36px;
    color: #fff;
    cursor: pointer;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.modal-preview-container {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    min-height: 60vh;
    overflow: hidden;
}

.modal-preview {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.modal-preview img,
.modal-preview video {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.modal-info {
    padding: 20px;
    background: white;
}

.modal-info h3 {
    margin-bottom: 15px;
    color: #2d3748;
    font-size: 18px;
}

.modal-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

.control-group label {
    font-weight: 600;
    color: #4a5568;
    min-width: 100px;
}

.control-group input,
.control-group select {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
}

.control-group input:focus,
.control-group select:focus {
    outline: none;
    border-color: #667eea;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
}

.modal-actions button {
    flex: 1;
}

/* Titel-Vorschau im Modal - jetzt relativ zur Preview */
.title-preview {
    position: absolute;
    color: white;
    font-size: 32px;
    text-shadow: 3px 3px 8px rgba(0,0,0,0.9);
    padding: 15px 30px;
    background: rgba(0,0,0,0.5);
    border-radius: 8px;
    max-width: 70%;
    text-align: center;
    z-index: 10;
    pointer-events: none;
    display: none;
}

.title-preview.bottom { 
    bottom: 40px; 
    left: 50%; 
    transform: translateX(-50%); 
}

.title-preview.top { 
    top: 40px; 
    left: 50%; 
    transform: translateX(-50%); 
}

.title-preview.center { 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
}

.title-preview.bottom-left { 
    bottom: 40px; 
    left: 40px; 
    transform: none; 
}

.title-preview.bottom-right { 
    bottom: 40px; 
    right: 40px; 
    transform: none; 
}

.title-preview.top-left { 
    top: 40px; 
    left: 40px; 
    transform: none; 
}

.title-preview.top-right { 
    top: 40px; 
    right: 40px; 
    transform: none; 
}

/* Navigation Buttons im Modal */
.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    font-size: 36px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-nav:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.modal-nav-left {
    left: 20px;
}

.modal-nav-right {
    right: 20px;
}

.drop-zone {
    border: 3px dashed #cbd5e0;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    margin-bottom: 20px;
    background: #f7fafc;
    cursor: pointer;
    transition: all 0.3s;
}

.drop-zone:hover {
    border-color: #667eea;
    background: #edf2f7;
}

.drop-zone.drag-over {
    border-color: #667eea;
    background: #e6f2ff;
    transform: scale(1.02);
}

.drop-zone.uploading {
    border-color: #48bb78;
    background: #f0fff4;
    pointer-events: none;
}

.drop-zone-content {
    pointer-events: none;
}

.drop-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.drop-zone p {
    font-size: 18px;
    color: #4a5568;
    margin: 10px 0;
    font-weight: 600;
}

.drop-zone small {
    color: #a0aec0;
    font-size: 14px;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

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

.notification.success {
    background: #48bb78;
}

.notification.error {
    background: #f56565;
}

.notification.info {
    background: #4299e1;
}

#saveBtn {
    transition: background 0.3s, transform 0.2s;
}
