/*
 *  Gothic / Bloodborne / Victorian Aesthetic Stylesheet
 *  "Schaurig Schön"
 */

/* 1. Imports and Root Variables */
@import url('https://fonts.googleapis.com/css2?family=UnifrakturMaguntia&family=MedievalSharp&display=swap');

:root {
    --blood-red: #8a0303;
    --dark-red: #3b0101;
    --black: #050505;
    --parchment: #c5b8a5;
    --gold-leaf: #b48608;
    --smoke-black: rgba(5, 5, 5, 0.92);
    --border-color: rgba(180, 134, 8, 0.25);
}

/* 2. Animations */
@keyframes flicker {
    0%, 18%, 22%, 25%, 53%, 57%, 100% {
        text-shadow:
            0 0 4px var(--parchment),
            0 0 10px var(--parchment),
            0 0 18px var(--parchment),
            0 0 38px var(--blood-red),
            0 0 70px var(--blood-red);
    }
    20%, 24%, 55% {        
        text-shadow: none;
    }
}

@keyframes background-pan {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

/* 3. Base & Body Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'MedievalSharp', serif;
    background-color: var(--black);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 40" width="80" height="40"><path fill="%231a0000" fill-opacity="0.1" d="M0 40L40 0H0v40zM40 40V0h40L40 40z"/></svg>');
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--parchment);
    text-shadow: 1px 1px 2px var(--black);
    overflow-x: hidden;
}

@media (min-width: 768px) {
    body::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: radial-gradient(circle 400px at var(--mouse-x) var(--mouse-y), rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 80%, rgba(0,0,0,0.95) 100%);
        pointer-events: none;
        z-index: 10;
    }
}

/* 4. Page & Layout */
.page { display: none; min-height: 100vh; }
.page.active { display: block; }
.hidden { display: none !important; }

.landing-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    background: radial-gradient(ellipse at 50% 30%, rgba(59, 1, 1, 0.2) 0%, transparent 70%);
}

/* 5. Typography */
.wedding-header {
    text-align: center;
    margin-bottom: 3rem;
}

.wedding-header h1 {
    font-family: 'UnifrakturMaguntia', cursive;
    font-size: clamp(3rem, 10vw, 5.5rem);
    font-weight: normal;
    color: var(--parchment);
    animation: flicker 5s linear infinite;
    letter-spacing: 0.2em;
}

.wedding-date {
    font-size: clamp(1rem, 4vw, 1.4rem);
    color: var(--parchment);
    opacity: 0.8;
    margin-top: 1rem;
    position: relative;
}

.wedding-date::before, .wedding-date::after {
    content: '†';
    margin: 0 1rem;
    color: var(--blood-red);
    opacity: 0.7;
}

/* 6. Forms & Inputs */
.login-form {
    background: var(--smoke-black);
    padding: 2.5rem;
    max-width: 550px;
    width: 95%;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    box-shadow: 0 0 30px rgba(0,0,0,0.8), inset 0 0 15px rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.login-form h2 {
    font-family: 'UnifrakturMaguntia', cursive;
    font-size: 2rem;
    text-align: center;
    color: var(--blood-red);
    margin-bottom: 1rem;
    text-shadow: 0 0 10px var(--blood-red);
}

.login-form p {
    text-align: center;
    margin-bottom: 2rem;
    opacity: 0.8;
}

#password-form { display: flex; flex-direction: column; gap: 1.5rem; }

#surname-input {
    font-family: 'MedievalSharp', serif;
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
    padding: 1rem;
    font-size: 1.1rem;
    color: var(--parchment);
    border-radius: 2px;
    transition: all 0.3s ease;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.7);
}

#surname-input::placeholder { color: var(--parchment); opacity: 0.4; }

#surname-input:focus {
    outline: none;
    border-color: var(--gold-leaf);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.7), 0 0 15px rgba(180, 134, 8, 0.3);
}

/* 7. Buttons */
button {
    font-family: 'MedievalSharp', serif;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 2px;
    font-size: 1.1rem;
    padding: 0.8rem 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.btn-primary {
    background: var(--blood-red);
    color: var(--parchment);
    border: 1px solid var(--dark-red);
    box-shadow: 0 0 15px rgba(138, 3, 3, 0.5);
}

.btn-primary:hover {
    background: var(--dark-red);
    color: var(--gold-leaf);
    box-shadow: 0 0 25px rgba(180, 134, 8, 0.5);
}

.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(80%); }

.btn-secondary {
    background: transparent;
    color: var(--parchment);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover { background: var(--border-color); color: var(--black); }

.btn-logout { border: 1px solid var(--border-color); background: transparent; color: var(--parchment); }
.btn-logout:hover { background: var(--blood-red); border-color: var(--dark-red); }

.error { color: var(--blood-red); margin-top: 1rem; text-align: center; }

/* 8. Gallery */
.gallery-header {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(to bottom, rgba(5,5,5,0.95), rgba(5,5,5,0.8));
}

.gallery-header h1 { font-family: 'UnifrakturMaguntia', cursive; font-size: 2.5rem; color: var(--parchment); }
.clickable-header { cursor: pointer; }

.header-actions { 
    display: flex; 
    gap: 1rem; 
    flex-wrap: wrap; 
}

.gallery-container { padding: 2rem; max-width: 1600px; margin: 0 auto; position: relative; }

#folder-view { 
    transition: opacity 0.3s ease;
    width: 100%;
}
#folder-view.hidden { 
    display: none;
}

#photo-view { 
    display: none;
    width: 100%;
}
#photo-view.active { 
    display: block;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--parchment);
    padding: 0.5rem 1rem;
    margin-bottom: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'MedievalSharp', serif;
}

.btn-back:hover {
    background: rgba(180, 134, 8, 0.2);
    border-color: var(--gold-leaf);
}

.btn-back svg {
    width: 16px;
    height: 16px;
}

.folder-grid, .photo-grid {
    display: grid;
    gap: 2rem;
}

.folder-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.photo-grid { 
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); 
    margin-top: 2rem;
    gap: 1.5rem;
    width: 100%;
    padding: 1rem;
    min-height: 300px;
    background-color: var(--smoke-black);
}

.folder-card, .photo-item {
    background: var(--smoke-black);
    border: 1px solid var(--border-color);
    box-shadow: 0 5px 20px rgba(0,0,0,0.7);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.folder-card:hover, .photo-item:hover {
    transform: translateY(-5px) scale(1.03);
    border-color: var(--gold-leaf);
    box-shadow: 0 10px 30px rgba(0,0,0,0.9), 0 0 20px rgba(180, 134, 8, 0.2);
}

.folder-preview {
    height: 220px;
    background-color: var(--black);
    display: flex; align-items: center; justify-content: center;
}

.folder-preview img, .photo-item img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.4s ease;
}

.folder-card:hover .folder-preview img, .photo-item:hover img { transform: scale(1.1); }

.folder-preview.empty { font-size: 4rem; color: var(--dark-red); }

.folder-info { padding: 1.5rem; }
.folder-name { font-family: 'UnifrakturMaguntia', cursive; font-size: 1.8rem; color: var(--gold-leaf); }
.folder-count { opacity: 0.7; }

.photo-item { 
    aspect-ratio: 1; 
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.photo-item:hover img {
    transform: scale(1.05);
}

.photo-item .download-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.photo-item:hover .download-overlay { opacity: 1; }

/* 9. Modals */
.modal {
    position: fixed; z-index: 1000; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(5, 5, 5, 0.8);
    backdrop-filter: blur(8px);
    display: none; align-items: center; justify-content: center;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--black);
    border: 1px solid var(--gold-leaf);
    box-shadow: 0 0 50px rgba(0,0,0,0.9);
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-modal-content { padding: 2rem; width: 600px; }

.close {
    position: absolute; top: 10px; right: 15px; font-size: 2.5rem;
    color: var(--parchment); opacity: 0.5; cursor: pointer; transition: all 0.3s ease;
}

.close:hover { opacity: 1; color: var(--gold-leaf); transform: rotate(90deg); }

#modal-image { 
    display: block; 
    max-width: 100%; 
    max-height: 80vh; 
    margin: 0 auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#modal-image.loaded {
    opacity: 1;
}

.modal-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--gold-leaf);
    color: var(--parchment);
    width: 50px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.modal-nav-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.9);
}

.modal-nav-btn.prev {
    left: 0;
    border-left: none;
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
}

.modal-nav-btn.next {
    right: 0;
    border-right: none;
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
}

.modal-nav-btn svg {
    width: 30px;
    height: 30px;
}

.modal-actions { padding: 1rem; text-align: center; border-top: 1px solid var(--border-color); }

/* 10. Upload Form */
.upload-form h2 { font-family: 'UnifrakturMaguntia', cursive; color: var(--gold-leaf); text-align: center; margin-bottom: 2rem; }

.file-drop-zone {
    border: 2px dashed var(--border-color);
    padding: 3rem 2rem; text-align: center; cursor: pointer;
    transition: all 0.3s ease;
}

.file-drop-zone:hover, .file-drop-zone.dragover {
    border-color: var(--gold-leaf);
    background: rgba(180, 134, 8, 0.05);
}

.drop-zone-content svg { color: var(--gold-leaf); margin-bottom: 1rem; width: 48px; height: 48px; }

.file-item { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem; background: rgba(0,0,0,0.3); margin-bottom: 0.5rem; }

.upload-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 2rem; }

/* 11. Spinners & Progress */
.loading-spinner {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--smoke-black);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 2000;
}

.spinner {
    width: 50px; height: 50px;
    border: 3px solid var(--border-color);
    border-top-color: var(--gold-leaf);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* 12. Responsive Design */
@media (max-width: 768px) {
    .gallery-header { flex-direction: column; }
    .folder-grid { grid-template-columns: 1fr; }
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media (max-width: 480px) {
    .header-actions { flex-direction: column; width: 100%; }
    .header-actions button { width: 100%; }
}
