@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&display=swap');

:root {
    --blue: #85C1E9;
    --blue-dark: #5DADE2;
    --blue-light: #AED6F1;
    --black: #0a0a0a;
    --white: #ffffff;
    --gray: #666;
}

* {
    box-sizing: border-box;
}

/* Custom selection for blue background areas */
body::selection,
main::selection,
.main-content::selection,
.hero-title::selection,
.brand-text::selection,
h1::selection,
h2::selection,
p::selection,
.file-label::selection,
.card::selection,
.side-panel::selection,
li::selection {
    background: var(--black);
    color: var(--white);
}

body::-moz-selection,
main::-moz-selection,
.main-content::-moz-selection,
.hero-title::-moz-selection,
.brand-text::-moz-selection,
h1::-moz-selection,
h2::-moz-selection,
p::-moz-selection,
.file-label::-moz-selection,
.card::-moz-selection,
.side-panel::-moz-selection,
li::-moz-selection {
    background: var(--black);
    color: var(--white);
}

/* Light selection for dark backgrounds (buttons, etc.) */
.btn::selection,
.btn *::selection {
    background: var(--white);
    color: var(--black);
}

.btn::-moz-selection,
.btn *::-moz-selection {
    background: var(--white);
    color: var(--black);
}

body {
    margin: 0;
    background: linear-gradient(135deg, var(--blue-light) 0%, var(--blue) 50%, var(--blue-dark) 100%);
    background-attachment: fixed;
    color: var(--black);
    min-height: 100vh;
    font-family: 'Outfit', sans-serif;
    overflow-x: hidden;
}

/* Floating Navigation */
.floating-nav {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 1000;
}

.nav-link {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    color: var(--black);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Hero Title Section */
.hero-title {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
}

body.has-intro .hero-title.visible {
    animation: hero-fade-in 0.6s ease-out 2s forwards;
}

@keyframes hero-fade-in {
    to {
        opacity: 1;
    }
}

.hero-title.scrolled {
    opacity: 0;
    transform: translateX(-50%) scale(0.9) translateY(-20px);
}

.brand-text {
    font-family: 'Syne', sans-serif;
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: center;
    line-height: 1.1;
    display: flex;
    gap: 0.3em;
}

.brand-word {
    background: linear-gradient(
        90deg,
        var(--black) 0%,
        var(--blue-dark) 50%,
        var(--black) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 6s ease-in-out infinite;
}

@keyframes gradient-shift {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* Main Content */
main {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    z-index: 20;
}

.main-content {
    max-width: 600px;
    width: 100%;
    padding: 20px;
}

h1, h2 {
    color: var(--black);
    font-family: 'Syne', sans-serif;
    font-weight: 700;
}

h1 {
    font-size: 2rem;
    margin-bottom: 30px;
    text-align: center;
}

/* Modern Upload Card */
.upload-form {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.upload-form:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.file-input-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.file-input {
    position: absolute;
    left: -9999px;
}

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 150px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.3);
    border: 2px dashed rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--black);
    font-weight: 500;
    text-align: center;
}

.file-label::before {
    content: '';
    display: block;
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
    background: var(--black);
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12'/%3E%3C/svg%3E");
    mask-size: contain;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.file-label:hover {
    background: rgba(255, 255, 255, 0.5);
    border-color: var(--black);
}

.file-label:hover::before {
    opacity: 1;
    transform: translateY(-5px);
}

.file-name {
    font-size: 14px;
    color: var(--gray);
    text-align: center;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
}

.file-name.has-file {
    color: var(--black);
    font-weight: 500;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    background: var(--black);
    color: var(--white);
    text-decoration: none;
    border-radius: 50px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    background: #222;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

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

.btn:disabled {
    background: #999;
    color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

.btn:disabled:hover {
    background: #999;
    transform: none;
    box-shadow: none;
}

/* Results Links */
.results-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.results-links .btn {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--black);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.results-links .btn:hover {
    background: rgba(255, 255, 255, 0.45);
    transform: translateY(-2px);
}

/* Action buttons below results */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

/* List styles */
ol, ul {
    text-align: left;
    max-width: 600px;
    margin: 0 auto;
    padding-left: 30px;
}

ol li img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    margin: 10px 0;
}

li {
    margin-bottom: 10px;
    color: var(--black);
}

h2 {
    margin-top: 30px;
    font-size: 1.5rem;
}

/* Grid container for list cards */
.list-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-width: 90%;
    margin: 0 auto;
    padding-bottom: 40px;
}

.list-container.no-results {
    display: flex;
    justify-content: center;
}

.list-container.no-results .card {
    text-align: center;
}

/* Card design */
.card {
    background: rgba(255, 255, 255, 0.75);
    color: var(--black);
    border-radius: 12px;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    will-change: transform;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.new-item {
    outline: 2px solid #d72f2f;
}

.new-badge {
    background-color: #d72f2f;
    color: #fff;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.7em;
    font-weight: 600;
    display: inline-block;
    position: relative;
    top: -1px;
}

.new-item-positive {
    outline: 2px solid #32cd32;
}

.new-badge-positive {
    background-color: #32cd32;
    color: #fff;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.7em;
    font-weight: 600;
    display: inline-block;
    position: relative;
    top: -1px;
}

/* Sort buttons */
.sort-toggle {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.sort-toggle .btn {
    padding: 10px 20px;
    font-size: 14px;
}

.sort-toggle .btn.active {
    background: var(--blue-dark);
    color: var(--white);
}

/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 30px;
    border-radius: 24px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.warning-text {
    color: #d72f2f;
    font-weight: 600;
    margin-bottom: 15px;
}

.ack-label {
    color: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
}

/* Custom circular checkbox */
#ack-checkbox {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 24px;
    height: 24px;
    border: 2px solid var(--black);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

#ack-checkbox:hover {
    border-color: #222;
    transform: scale(1.05);
}

#ack-checkbox:checked {
    background: var(--black);
    border-color: var(--black);
}

#ack-checkbox:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 6px;
    height: 10px;
    border: solid var(--white);
    border-width: 0 2px 2px 0;
    border-radius: 1px;
}

/* Side panel */
.side-panel {
    position: fixed;
    top: 20px;
    left: 20px;
    padding: 15px;
    z-index: 1100;
    color: var(--black);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    max-width: 220px;
}

.side-panel .run-dates {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.side-content {
    margin-top: 10px;
}

.side-panel.collapsed .side-content {
    display: none;
}

#side-toggle {
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
}

#toggle-angle {
    display: inline-block;
    transition: transform 0.3s ease;
}

.side-panel.expanded #toggle-angle {
    transform: rotate(90deg);
}

.side-panel .btn {
    padding: 10px 16px;
    font-size: 13px;
    margin-top: 10px;
}

.delete-run {
    margin-left: 8px;
    color: #d72f2f;
    cursor: pointer;
    font-weight: bold;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.delete-run:hover {
    opacity: 1;
}

/* Fade out elements when overlay is open */
.floating-nav.overlay-active .nav-link,
.side-panel.overlay-active #side-toggle,
.side-panel.overlay-active .side-content,
.main-content.overlay-active #results,
.main-content.overlay-active .action-buttons {
    opacity: 0.3;
    pointer-events: none;
}

.run-tooltip {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--black);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px 12px;
    font-size: 0.8em;
    font-weight: 500;
    z-index: 2000;
}

/* Upload overlay specific */
#upload-overlay .modal {
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
}

#upload-overlay .upload-form {
    width: min(500px, 90vw);
    background: rgba(255, 255, 255, 0.95);
}

/* User item links */
.user-item a,
.card a {
    color: var(--black);
    text-decoration: none;
    transition: color 0.2s ease;
}

.user-item a:hover,
.card a:hover {
    color: var(--blue-dark);
}

/* How-to page styles */
.how-to-link {
    margin-top: 20px;
}

.how-to-link .btn {
    background: #32cd32;
    color: white;
}

.how-to-link .btn:hover {
    background: #28a428;
}

p {
    color: var(--black);
}

/* Subtle footer attribution */
.subtle-footer {
    position: fixed;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: rgba(0, 0, 0, 0.4);
    z-index: 5;
    opacity: 0;
}

body.has-intro .subtle-footer.visible {
    animation: footer-fade-in 0.6s ease-out 2s forwards;
}

@keyframes footer-fade-in {
    to {
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .list-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .list-container {
        grid-template-columns: 1fr;
    }
    
    .brand-text {
        font-size: clamp(1rem, 5vw, 1.5rem);
    }
    
    .intro-instagram,
    .intro-followers {
        font-size: clamp(1.5rem, 10vw, 3rem);
    }
    
    .floating-nav {
        top: 10px;
        right: 10px;
    }
    
    .nav-link {
        padding: 8px 14px;
        font-size: 12px;
    }
    
    .side-panel {
        top: auto;
        bottom: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
    }
    
    .upload-form {
        padding: 25px;
    }
    
    .file-label {
        min-height: 120px;
        padding: 20px;
    }
    
    .file-label::before {
        width: 40px;
        height: 40px;
    }
}

/* Custom tooltip for cards */
.custom-tooltip {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 10px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    padding: 10px 14px !important;
    font-size: 0.85em !important;
    line-height: 1.5;
}

/* ===== INTRO ANIMATION ===== */

/* Intro overlay - covers the whole screen */
.intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--blue-light) 0%, var(--blue) 50%, var(--blue-dark) 100%);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.intro-overlay.animating {
    animation: overlay-fade 0.8s ease-out 1.6s forwards;
}

@keyframes overlay-fade {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* Stack of intro words */
.intro-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.intro-word {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: linear-gradient(
        90deg,
        var(--black) 0%,
        var(--blue-dark) 50%,
        var(--black) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 6s ease-in-out infinite;
    opacity: 0;
    transform: translateY(20px);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    cursor: default;
}

.intro-instagram,
.intro-followers {
    font-size: clamp(2rem, 8vw, 4rem);
}

.intro-copyright {
    font-size: clamp(0.7rem, 2vw, 0.9rem);
    margin-top: 20px;
}

/* Staggered entrance */
.intro-overlay.animating .intro-instagram {
    animation: gradient-shift 6s ease-in-out infinite,
               word-enter 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards,
               word-shimmer-out 0.8s ease-out 1.2s forwards;
}

.intro-overlay.animating .intro-followers {
    animation: gradient-shift 6s ease-in-out infinite,
               word-enter 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards,
               word-shimmer-out 0.8s ease-out 1.35s forwards;
}

.intro-overlay.animating .intro-copyright {
    animation: gradient-shift 6s ease-in-out infinite,
               word-enter 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards,
               word-shimmer-out 0.8s ease-out 1.5s forwards;
}

@keyframes word-enter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Shimmer/dissolve exit animation */
@keyframes word-shimmer-out {
    0% {
        opacity: 1;
        filter: blur(0px);
        transform: translateY(0) scale(1);
    }
    30% {
        opacity: 0.8;
        filter: blur(2px);
        transform: translateY(5px) scale(1.02);
    }
    100% {
        opacity: 0;
        filter: blur(12px);
        transform: translateY(20px) scale(1.05);
    }
}

/* Hide overlay after animation */
.intro-overlay.done {
    display: none;
    pointer-events: none;
}

/* Main content - hidden initially on pages with intro */
body.has-intro .main-content {
    opacity: 0;
}

body.has-intro .main-content.visible {
    animation: content-fade-in 0.8s ease-out 2.2s forwards;
}

/* After animation completes, set opacity directly so modals work properly */
body.has-intro .main-content.animation-done {
    animation: none;
    opacity: 1;
}

@keyframes content-fade-in {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Nav and side panel - hidden initially on pages with intro */
body.has-intro .floating-nav,
body.has-intro .side-panel {
    opacity: 0;
}

body.has-intro .floating-nav.visible,
body.has-intro .side-panel.visible {
    animation: ui-fade-in 0.5s ease-out 2.4s forwards;
}

@keyframes ui-fade-in {
    to {
        opacity: 1;
    }
}

/* Animation for page entrance (non-intro pages) */
@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body:not(.has-intro) .main-content {
    animation: fade-up 0.6s ease-out;
}

body:not(.has-intro) .hero-title {
    opacity: 1;
}

body:not(.has-intro) .subtle-footer {
    opacity: 1;
}

/* Legacy header/footer hidden by default, but available for subpages that need simpler nav */
header, footer {
    display: none;
}

/* Subpage header styling (shown via JS) */
.subpage-header {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 15px 30px;
    z-index: 1000;
    justify-content: space-between;
    align-items: center;
}

.subpage-header .logo {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    background: linear-gradient(90deg, var(--black), var(--blue-dark));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subpage-header .header-links {
    display: flex;
    gap: 15px;
}

.subpage-header .header-link {
    text-decoration: none;
    color: var(--black);
    font-weight: 500;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 50px;
    transition: all 0.3s ease;
}

.subpage-header .header-link:hover {
    background: rgba(255, 255, 255, 0.3);
}
