/* =============================================
   SubwayShare — Underground / NYC / 90s / Indie
   ============================================= */

/* --- Google Fonts import (90s zine + subway signage) --- */
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&family=Oswald:wght@400;600;700&family=Special+Elite&display=swap');

/* --- CSS custom properties --- */
:root {
    --mta-yellow:  #FCCC0A;
    --mta-orange:  #FF6319;
    --mta-green:   #00933C;
    --mta-red:     #EE352E;
    --mta-blue:    #0039A6;
    --grit-dark:   #0e0e0e;
    --grit-panel:  #161616;
    --grit-card:   #1a1a1a;
    --grit-border: #2a2a2a;
    --chalk:       #d4d0c8;
    --tape-bg:     rgba(252, 204, 10, 0.08);
    --noise-opacity: 0.035;
}

/* --- Animated noise overlay (VHS / analog grain) --- */
@keyframes grainShift {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-2%, -3%); }
    30% { transform: translate(3%, 2%); }
    50% { transform: translate(-1%, 4%); }
    70% { transform: translate(2%, -2%); }
    90% { transform: translate(-3%, 1%); }
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0.8; }
    94% { opacity: 1; }
    96% { opacity: 0.9; }
    97% { opacity: 1; }
}

@keyframes scanline {
    0% { top: -10%; }
    100% { top: 110%; }
}

@keyframes tagPulse {
    0%, 100% { text-shadow: 3px 3px 0 #000, -1px -1px 0 rgba(252,204,10,0.2); }
    50% { text-shadow: 3px 3px 0 #000, -1px -1px 6px rgba(252,204,10,0.5); }
}

/* --- Base body --- */
body.bg {
    background-color: var(--grit-dark);
    background-image: url('../assets/Bricks.png');
    background-repeat: repeat;
    background-size: 30vw;
    font-family: 'Space Mono', 'Courier New', Courier, monospace;
    color: var(--chalk);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    animation: flicker 8s infinite;
}

/* Vignetta nera ai lati */
body.bg::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 10000;
    background: linear-gradient(to right, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.0) 18%, rgba(0,0,0,0.0) 82%, rgba(0,0,0,0.55) 100%);
}

/* Film grain pseudo-element */
body.bg::before {
    content: '';
    position: fixed;
    inset: -50%;
    width: 200%;
    height: 200%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    opacity: var(--noise-opacity);
    pointer-events: none;
    z-index: 9999;
    animation: grainShift 0.5s steps(6) infinite;
}

/* CRT scanline sweep */
body.bg .scanline {
    content: '';
    position: fixed;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(transparent, rgba(252,204,10,0.04), transparent);
    z-index: 9998;
    pointer-events: none;
    animation: scanline 6s linear infinite;
}

/* --- Main container --- */
.container-fluid {
    max-width: 80% !important;
    margin: 0 auto;
    padding: 2rem 2.5rem !important;
    position: relative;
}

/* --- Title / Branding --- */
.title {
    font-family: 'Oswald', 'Arial Black', Impact, sans-serif;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 700;
    color: var(--mta-yellow);
    letter-spacing: 6px;
    text-transform: uppercase;
    text-shadow: 4px 4px 0 #000, -2px -2px 0 rgba(252,204,10,0.15);
    line-height: 1;
    margin-bottom: 0.15em;
    position: relative;
    display: inline-block;
    animation: tagPulse 4s ease-in-out infinite;
}

/* Subway route badge */
.title::before {
    display: none;
}

.logo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1em;
    height: 1.1em;
    background: var(--mta-yellow);
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--grit-dark), 0 0 0 5px var(--mta-yellow);
    overflow: hidden;
}

/* Graffiti-style underline */
.title::after {
    content: '';
    display: block;
    height: 4px;
    margin-top: 6px;
    background: repeating-linear-gradient(
        90deg,
        var(--mta-yellow) 0,
        var(--mta-yellow) 12px,
        transparent 12px,
        transparent 18px
    );
    opacity: 0.7;
}

/* --- Description line --- */
.desc {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 1.15rem;
    color: #888;
    margin-bottom: 2.5em;
    letter-spacing: 1px;
    padding-left: 2px;
    border-left: 3px solid var(--mta-orange);
    padding-left: 12px;
}

/* --- Forms --- */
.form {
    background: var(--grit-panel);
    border: 1px solid var(--grit-border);
    border-left: 4px solid var(--mta-yellow);
    padding: 1.5rem 1.8rem;
    margin-bottom: 2rem;
    position: relative;
}

.form::before {
    content: '▶ UPLOAD';
    font-family: 'Oswald', sans-serif;
    font-size: 0.65rem;
    letter-spacing: 3px;
    color: var(--mta-yellow);
    position: absolute;
    top: -0.55em;
    left: 1.2rem;
    background: var(--grit-panel);
    padding: 0 8px;
    text-transform: uppercase;
}

.form:last-of-type::before {
    content: '▶ SEARCH';
}

.form input.form-control,
.form input.input {
    background: var(--grit-dark) !important;
    color: var(--chalk) !important;
    border: 1px solid var(--grit-border) !important;
    border-radius: 0 !important;
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    padding: 0.65rem 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form input.form-control:focus,
.form input.input:focus {
    border-color: var(--mta-yellow) !important;
    box-shadow: 0 0 0 2px rgba(252,204,10,0.15) !important;
    outline: none;
}

.form input.form-control::placeholder,
.form input.input::placeholder {
    color: #555;
    font-style: italic;
}

/* File input special styling */
.form input[type="file"] {
    padding: 0.5rem;
}
.form input[type="file"]::file-selector-button {
    background: var(--mta-yellow);
    color: var(--grit-dark);
    border: none;
    padding: 0.4rem 1rem;
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    margin-right: 1rem;
    transition: background 0.2s;
}
.form input[type="file"]::file-selector-button:hover {
    background: var(--mta-orange);
}

/* --- Buttons --- */
.btn {
    font-family: 'Oswald', sans-serif !important;
    font-weight: 600 !important;
    letter-spacing: 2px !important;
    text-transform: uppercase !important;
    border-radius: 0 !important;
    padding: 0.55rem 1.8rem !important;
    font-size: 0.9rem !important;
    transition: all 0.15s ease !important;
    position: relative;
    overflow: hidden;
}

.btn-warning {
    background: var(--mta-yellow) !important;
    color: var(--grit-dark) !important;
    border: 2px solid var(--mta-yellow) !important;
}

.btn-warning:hover {
    background: transparent !important;
    color: var(--mta-yellow) !important;
    border-color: var(--mta-yellow) !important;
}

.btn-dark {
    background: transparent !important;
    color: var(--mta-yellow) !important;
    border: 1px solid var(--mta-yellow) !important;
}

.btn-dark:hover {
    background: var(--mta-yellow) !important;
    color: var(--grit-dark) !important;
}

/* --- Subtitle --- */
.subtitle {
    font-family: 'Oswald', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--mta-yellow);
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-top: 2.5em;
    margin-bottom: 1em;
    padding-bottom: 0.5em;
    border-bottom: 2px solid var(--grit-border);
    position: relative;
}

.subtitle::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 80px;
    height: 2px;
    background: var(--mta-yellow);
}

/* --- Table --- */
.table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.88rem;
}

.table-dark {
    --bs-table-bg: var(--grit-panel) !important;
    --bs-table-border-color: var(--grit-border) !important;
    --bs-table-striped-bg: var(--grit-card) !important;
}

.table thead th {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--mta-yellow) !important;
    border-bottom: 2px solid var(--mta-yellow) !important;
    padding: 0.9rem 1rem;
    background: var(--grit-dark) !important;
    word-break: break-word;
}

.table td.title-col {
    max-width: 220px;
    word-break: break-word;
    white-space: normal;
    overflow-wrap: anywhere;
}
.table td.user-col {
    max-width: 120px;
    word-break: break-word;
    white-space: normal;
    overflow-wrap: anywhere;
}
.table tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border-color: var(--grit-border) !important;
    color: var(--chalk);
}

.table tbody tr {
    transition: background 0.15s;
}

.table tbody tr:hover {
    background: rgba(252,204,10,0.04) !important;
}

/* --- File links --- */
.link {
    color: var(--mta-yellow);
    text-decoration: none;
    border-bottom: 1px dashed rgba(252,204,10,0.3);
    transition: color 0.2s, border-color 0.2s;
    font-size: 0.85rem;
}

.link:hover {
    color: var(--mta-orange);
    border-bottom-color: var(--mta-orange);
    text-decoration: none;
}

/* --- Material icons in table --- */
.material-symbols-sharp {
    color: #555;
    font-size: 1.1em !important;
    vertical-align: middle;
}

/* --- Scrollbar (underground dark) --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--grit-dark);
}
::-webkit-scrollbar-thumb {
    background: #333;
    border: 1px solid #222;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--mta-yellow);
}

/* --- Selection highlight --- */
::selection {
    background: var(--mta-yellow);
    color: var(--grit-dark);
}

/* --- Responsive --- */
/* =============================================
   Upload Progress Overlay
   ============================================= */


@keyframes dotPulse {
    0%, 100% { opacity: 0.3; }
    50%      { opacity: 1; }
}

@keyframes barGlow {
    0%, 100% { box-shadow: 0 0 6px rgba(252,204,10,0.3); }
    50%      { box-shadow: 0 0 18px rgba(252,204,10,0.6); }
}

/* Fullscreen overlay */
.upload-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(6px);
}

/* Modal box */
.upload-modal {
    background: var(--grit-panel);
    border: 1px solid var(--grit-border);
    border-top: 3px solid var(--mta-yellow);
    width: 520px;
    max-width: 92vw;
    padding: 2rem 2.2rem;
    position: relative;
    overflow: hidden;
}

.upload-modal-header {
    display: flex;
    align-items: center;
    gap: 0.6em;
    margin-bottom: 1.2rem;
}

.upload-icon {
    font-size: 1.6rem !important;
    color: var(--mta-yellow);
    animation: dotPulse 1.5s ease-in-out infinite;
}

.upload-title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--mta-yellow);
}

.upload-status {
    font-family: 'Space Mono', monospace;
    font-size: 0.82rem;
    color: var(--chalk);
    margin-bottom: 1rem;
    min-height: 1.4em;
    word-break: break-word;
}

.upload-status.upload-success {
    color: var(--mta-green);
    font-weight: 700;
}

.upload-status.upload-error {
    color: var(--mta-red);
    font-weight: 700;
}

/* Progress bar */
.upload-bar-track {
    width: 100%;
    height: 18px;
    background: var(--grit-dark);
    border: 1px solid var(--grit-border);
    position: relative;
    overflow: hidden;
    margin-bottom: 0.6rem;
}

.upload-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--mta-yellow), var(--mta-orange));
    transition: width 0.25s ease;
    position: relative;
    animation: barGlow 2s ease-in-out infinite;
}

/* Striped animation on fill */
.upload-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 6px,
        rgba(0,0,0,0.15) 6px,
        rgba(0,0,0,0.15) 12px
    );
    animation: barStripeMove 0.6s linear infinite;
}

@keyframes barStripeMove {
    0%   { background-position: 0 0; }
    100% { background-position: 17px 0; }
}

.upload-stats {
    display: flex;
    justify-content: space-between;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 1rem;
}

#uploadPercent {
    color: var(--mta-yellow);
    font-weight: 700;
    font-size: 0.85rem;
}

/* File list */
.upload-file-list {
    max-height: 180px;
    overflow-y: auto;
    margin-bottom: 1rem;
    border: 1px solid var(--grit-border);
    background: var(--grit-dark);
}

.upload-file-item {
    display: flex;
    align-items: center;
    gap: 0.6em;
    padding: 0.4rem 0.8rem;
    border-bottom: 1px solid var(--grit-border);
    font-size: 0.75rem;
    font-family: 'Space Mono', monospace;
}

.upload-file-item:last-child {
    border-bottom: none;
}

.upload-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--chalk);
}

.upload-file-size {
    color: #666;
    white-space: nowrap;
}

.upload-file-status {
    font-family: 'Oswald', sans-serif;
    font-size: 0.65rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #555;
    min-width: 60px;
    text-align: right;
}

.upload-file-status.file-active {
    color: var(--mta-orange);
}

.upload-file-status.file-done {
    color: var(--mta-green);
}

.upload-hint {
    font-family: 'Special Elite', monospace;
    font-size: 0.72rem;
    color: #555;
    text-align: center;
    letter-spacing: 1px;
    border-top: 1px dashed var(--grit-border);
    padding-top: 0.8rem;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 768px) {
    .container-fluid {
        padding: 1rem !important;
    }
    .title {
        font-size: 2rem;
        letter-spacing: 3px;
    }
    .form {
        padding: 1rem;
    }
    .table {
        font-size: 0.78rem;
    }
    .table thead th {
        font-size: 0.65rem;
        letter-spacing: 2px;
    }
    .upload-modal {
        padding: 1.2rem 1rem;
        width: 98vw;
    }
}
