:root {
    /* Crimson Luxury Theme */
    --bg-base: #0a0a0c;
    --bg-panel: #121214;
    --border-color: #202024;
    
    --text-primary: #f8f9fa;
    --text-secondary: #868e96;
    
    --accent-red: #D90429;
    --accent-red-hover: #EF233C;
    --accent-red-glow: rgba(217, 4, 41, 0.4);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-full: 9999px;
    
    --transition: 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%; height: 100%;
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow: hidden;
}

/* TYPOGRAPHY */
.font-heading { font-family: var(--font-heading); font-weight: 600; }
.tracking-wide { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.1em; }
.uppercase { text-transform: uppercase; }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.text-accent { color: var(--accent-red) !important; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 2.25rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mr-2 { margin-right: 0.5rem; }

/* UTILS */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.justify-center { justify-content: center; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.w-full { width: 100%; }
.flex-1 { flex: 1; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.relative { position: relative; }
.absolute { position: absolute; }
.top-0 { top: 0; }
.z-10 { z-index: 10; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mx-4 { margin-left: 1rem; margin-right: 1rem; }
.ml-2 { margin-left: 0.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2.5rem; }
.p-4 { padding: 1rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.pb-20 { padding-bottom: 6rem; }
.bg-dark { background-color: var(--bg-panel); }

/* LUXURY GLOW EFFECTS */
.glow-text { text-shadow: 0 0 10px var(--accent-red-glow); }
.text-shadow { text-shadow: 0 4px 10px rgba(0,0,0,0.5); }
.glow-box { box-shadow: 0 4px 20px var(--accent-red-glow); }
.glow-box-subtle { box-shadow: 0 2px 10px rgba(217, 4, 41, 0.15); }
.shadow-glow { box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }

.hover-glow:hover { box-shadow: 0 0 15px rgba(255,255,255,0.1); border-color: var(--text-secondary); }
.hover-bg-accent:hover { background-color: var(--accent-red); color: white !important; border-color: var(--accent-red) !important; box-shadow: 0 4px 15px var(--accent-red-glow); }
.hover-glow-border:focus { border-color: var(--accent-red); box-shadow: 0 0 0 3px rgba(217, 4, 41, 0.15); }

.focus-glow-parent:focus-within {
    border-color: var(--accent-red);
    box-shadow: 0 0 25px rgba(217, 4, 41, 0.1);
}

/* LAYOUT: APP */
.app-layout {
    display: flex;
    width: 100%; height: 100%;
}

.content-area {
    flex: 1; position: relative;
    overflow: hidden;
}

.view-section {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    opacity: 0; pointer-events: none;
    transform: translateY(15px);
    transition: opacity 0.4s ease, transform 0.5s ease;
}

.view-section.active {
    opacity: 1; pointer-events: auto;
    transform: translateY(0);
}

.section-header {
    padding: 2.5rem 1.5rem 1.5rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-base);
    z-index: 10;
}

.scroll-container {
    flex: 1; overflow-y: auto;
    padding: 1.5rem;
    -webkit-overflow-scrolling: touch;
}
.scroll-container::-webkit-scrollbar { display: none; }

/* PANELS & CARDS */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: var(--transition);
}

/* FORMS */
.input-group {
    display: flex; align-items: center; gap: 1rem;
    padding: 0.75rem 1rem;
}
.input-transparent {
    background: transparent; border: none; color: var(--text-primary);
    font-size: 1rem; outline: none; font-family: var(--font-body);
}
.input-transparent::placeholder { color: var(--text-secondary); }
.input-bordered {
    background: var(--bg-base); border: 1px solid var(--border-color);
    color: var(--text-primary); padding: 0.85rem 1.25rem;
    border-radius: var(--radius-sm); outline: none; transition: var(--transition);
    font-family: var(--font-body);
}
.input-bordered::placeholder { color: var(--text-secondary); }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }

/* BUTTONS */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.85rem 1.75rem; border-radius: var(--radius-sm);
    font-weight: 600; font-family: var(--font-body); cursor: pointer;
    transition: var(--transition); border: none; letter-spacing: 0.05em;
}
.btn-primary {
    background: var(--accent-red); color: white;
}
.btn-primary:hover {
    background: var(--accent-red-hover); box-shadow: 0 8px 25px var(--accent-red-glow);
    transform: translateY(-2px);
}
.btn-outline {
    background: transparent; border: 1px solid var(--border-color); color: var(--text-primary);
}
.btn-outline:hover {
    border-color: var(--text-secondary); background: rgba(255,255,255,0.03);
}
.btn-icon {
    width: 3rem; height: 3rem; padding: 0; border-radius: var(--radius-sm);
    font-size: 1.35rem;
}
.btn-hover-glow:hover {
    border-color: var(--accent-red); color: var(--accent-red);
    box-shadow: 0 4px 15px rgba(217, 4, 41, 0.15);
}
.fab-container { position: fixed; bottom: 6rem; right: 1.5rem; z-index: 30; }
.fab {
    display: flex; align-items: center; justify-content: center;
    width: 3.75rem; height: 3.75rem; border-radius: 50%;
    cursor: pointer; box-shadow: 0 10px 30px var(--accent-red-glow);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.fab:active { transform: scale(0.9); }

/* COMPONENTS */
.stats-hero { display: flex; align-items: center; justify-content: space-around; }
.stat-box { display: flex; flex-direction: column; align-items: center; }
.stat-num { font-size: 3rem; line-height: 1; }
.stat-divider { width: 1px; height: 4rem; background: var(--border-color); }

.progress-bar {
    width: 100%; height: 8px; background: var(--bg-base);
    border-radius: var(--radius-full); overflow: hidden;
    border: 1px solid var(--border-color);
}
.progress-fill { height: 100%; width: 0%; transition: width 1s cubic-bezier(0.25, 1, 0.5, 1); }

.memory-frame {
    border: 1px solid var(--accent-red);
    padding: 0.5rem; border-radius: var(--radius-sm);
    background: rgba(217, 4, 41, 0.05);
}
.memory-frame img {
    width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px;
}

.grid-list { display: flex; flex-direction: column; gap: 0.85rem; }
.list-card {
    background: var(--bg-panel); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); padding: 1.25rem 1.5rem;
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; transition: var(--transition);
}
.list-card:hover { border-color: var(--accent-red); box-shadow: 0 4px 20px rgba(217,4,41,0.08); transform: translateY(-2px); }
.list-card.opacity-50 { opacity: 0.5; }

.masonry-grid { column-count: 2; column-gap: 1rem; }
.photo-thumb {
    break-inside: avoid; margin-bottom: 1rem;
    border-radius: var(--radius-sm); overflow: hidden;
    position: relative; border: 1px solid var(--border-color);
    cursor: pointer; transition: var(--transition);
    display: inline-block; width: 100%;
}
.photo-thumb::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(10,10,12,0.8) 0%, transparent 40%);
    opacity: 0; transition: opacity 0.4s ease; pointer-events: none;
}
.photo-overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.3); backdrop-filter: blur(3px);
    opacity: 0; transition: var(--transition); color: white;
    font-size: 2.5rem; pointer-events: none; z-index: 5;
}
.photo-thumb:hover::after, .photo-thumb:hover .photo-overlay { opacity: 1; }
.photo-thumb img { width: 100%; display: block; transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1); }
.photo-thumb:hover { border-color: var(--accent-red); box-shadow: 0 10px 30px rgba(217,4,41,0.25); z-index: 2; transform: translateY(-3px); }
.photo-thumb:hover img { transform: scale(1.08); }

.timeline-wrapper { padding-left: 1.5rem; border-left: 2px solid var(--border-color); margin-left: 0.75rem; margin-top: 2rem; }
.timeline-item { position: relative; margin-bottom: 2.5rem; }
.timeline-item::before {
    content: ''; position: absolute; left: -1.95rem; top: 0.25rem;
    width: 14px; height: 14px; border-radius: 50%; background: var(--accent-red);
    box-shadow: 0 0 15px var(--accent-red-glow);
    border: 3px solid var(--bg-base);
}
.timeline-date { display: inline-block; font-size: 0.85rem; color: var(--accent-red); font-weight: 700; margin-bottom: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; }

/* MODALS */
dialog { margin: auto; border: none; background: transparent; outline: none; }
dialog::backdrop { background: rgba(5, 5, 6, 0.95); backdrop-filter: blur(10px); }
dialog[open].lightbox-modal { 
    width: 100vw; 
    height: 100dvh; 
    max-width: 100vw; 
    max-height: 100dvh; 
    padding: 0; 
    overflow: hidden; 
    background: rgba(10, 10, 12, 0.95);
    border: none;
}
.lightbox-modal::backdrop { background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(8px); }
.lightbox-content { display: flex; flex-direction: column; width: 100%; height: 100%; position: relative; }
.lightbox-controls {
    padding: calc(1rem + env(safe-area-inset-top)) calc(1rem + env(safe-area-inset-right)) 1rem calc(1rem + env(safe-area-inset-left));
}
.img-wrapper { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0; }
.img-wrapper img { max-width: 100%; max-height: 100dvh; width: 100%; height: 100%; object-fit: contain; }
.lightbox-nav-btn { display: flex; align-items: center; justify-content: center; background: rgba(10,10,12,0.5); backdrop-filter: blur(4px); border: none; color: white; }
.lightbox-nav-btn:hover { background: var(--accent-red); transform: translateY(-50%) scale(1.1); }
#przycisk-poprzednie-zdjecie { left: calc(1rem + env(safe-area-inset-left)) !important; }
#przycisk-nastepne-zdjecie { right: calc(1rem + env(safe-area-inset-right)) !important; }

.confirm-modal { width: 100%; max-width: 420px; padding: 1rem; }
.confirm-content { border-top: 4px solid var(--accent-red); padding: 2rem; }
.icon-danger-circle {
    width: 4rem; height: 4rem; border-radius: 50%;
    background: rgba(217, 4, 41, 0.1); color: var(--accent-red);
    display: flex; align-items: center; justify-content: center; font-size: 2rem;
}

@keyframes modalFade { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

/* LOADING SCREEN */
.loading-screen {
    position: fixed; inset: 0; z-index: 100;
    background: var(--bg-base);
    display: flex; align-items: center; justify-content: center;
    transition: opacity 1s ease;
}
#plotno-serce { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 101; pointer-events: none; }
.loading-content { position: relative; z-index: 102; text-align: center; }

/* TOASTS */
.toast-container { position: fixed; top: 2rem; right: 2rem; left: 2rem; z-index: 200; display: flex; flex-direction: column; gap: 0.75rem; align-items: center; pointer-events: none; }
.toast {
    background: var(--bg-panel); border-left: 4px solid var(--accent-red);
    padding: 1.25rem 1.5rem; border-radius: var(--radius-sm); box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    display: flex; align-items: center; gap: 1rem; pointer-events: auto;
    transform: translateY(-50px) scale(0.9); opacity: 0; transition: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.toast.show { transform: translateY(0) scale(1); opacity: 1; }
.toast-progress {
    flex-direction: column;
    align-items: stretch;
    min-width: 280px;
    max-width: 400px;
    width: 100%;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.15); }
}

.animate-pulse {
    display: inline-block;
    animation: pulseGlow 1.2s infinite ease-in-out;
}

/* =========================================
   UKŁAD MOBILE
   ========================================= */
.app-layout { flex-direction: column-reverse; }
.nav-bar {
    display: flex; justify-content: space-around; align-items: center;
    background: var(--bg-panel); border-top: 1px solid var(--border-color);
    padding: 0.75rem 0.5rem; z-index: 50; padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
}
.nav-brand, .nav-footer { display: none; }
.nav-links { display: flex; width: 100%; justify-content: space-around; }
.nav-item {
    background: transparent; border: none; color: var(--text-secondary);
    display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
    padding: 0.5rem; cursor: pointer; transition: var(--transition);
}
.nav-item i { font-size: 1.65rem; }
.nav-item span { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.nav-item.active { color: var(--accent-red); text-shadow: 0 0 15px var(--accent-red-glow); transform: translateY(-3px); }
.desktop-only { display: none !important; }

/* =========================================
   UKŁAD DESKTOP
   ========================================= */
@media (min-width: 768px) {
    .app-layout { flex-direction: row; }
    
    .nav-bar {
        width: 280px; height: 100vh;
        flex-direction: column; justify-content: flex-start; align-items: flex-start;
        border-top: none; border-right: 1px solid var(--border-color);
        padding: 2.5rem 1.5rem; gap: 2rem;
    }
    
    .nav-brand {
        display: flex; align-items: center; gap: 0.75rem;
        font-size: 1.75rem; color: var(--text-primary); margin-bottom: 2.5rem;
    }
    .nav-brand i { font-size: 2.25rem; }
    
    .nav-links { flex-direction: column; width: 100%; gap: 0.5rem; }
    
    .nav-item {
        flex-direction: row; justify-content: flex-start; padding: 1rem 1.25rem;
        width: 100%; border-radius: var(--radius-sm);
    }
    .nav-item i { font-size: 1.5rem; margin-right: 1rem; }
    .nav-item span { font-size: 1rem; }
    .nav-item:hover { background: rgba(255,255,255,0.03); color: var(--text-primary); transform: translateX(5px); }
    .nav-item.active { background: linear-gradient(90deg, rgba(217, 4, 41, 0.15) 0%, transparent 100%); color: var(--accent-red); transform: translateX(5px); border-left: 3px solid var(--accent-red); }
    
    .nav-footer { display: block; margin-top: auto; width: 100%; }
    .tool-btn { border: 1px solid var(--border-color); }
    .mobile-tools-panel { display: none; }
    .desktop-only { display: inline !important; }
    
    .view-section { max-width: 1200px; margin: 0 auto; }
    .section-header { padding: 4rem 3rem 2rem 3rem; }
    .scroll-container { padding: 3rem; }
    
    .desktop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: start; }
    .grid-list { grid-template-columns: repeat(2, 1fr); display: grid; gap: 1.25rem; align-items: start; }
    .masonry-grid { column-count: 3; column-gap: 1.5rem; display: block; }
    
    .fab-container { position: absolute; bottom: 4rem; right: 4rem; }
    .fab { width: auto; height: 4rem; padding: 0 2rem; border-radius: var(--radius-full); }
    
    .toast-container { right: 2rem; left: auto; top: 2rem; align-items: flex-end; }
}
