:root {
    --bg-dark: #0f111a;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --primary: #FF2A54;
    --primary-hover: #ff4d70;
    --text-main: #f0f2f5;
    --text-muted: #9ba1a6;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-orb {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.2;
    animation: float 20s infinite ease-in-out alternate;
}

.glow-orb.red {
    top: -10%;
    left: -10%;
    background: #FF2A54;
}

.glow-orb.blue {
    bottom: -10%;
    right: -10%;
    background: #2a75ff;
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(50px, 50px) scale(1.1);
    }
}

.container {
    width: 100%;
    max-width: 900px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    text-align: center;
    margin-bottom: 1rem;
}

header h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
}

.highlight {
    color: var(--primary);
    text-shadow: 0 0 20px rgba(255, 42, 84, 0.4);
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 1rem;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.search-box textarea {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1rem;
    padding: 0.75rem 1rem;
    outline: none;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    max-height: 200px;
}

.search-box textarea::placeholder {
    color: #555;
}

button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 100px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
}

button:hover {
    background: var(--primary-hover);
    box-shadow: 0 0 20px rgba(255, 42, 84, 0.4);
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.hidden {
    display: none !important;
}

.error-msg {
    color: #ff4d4d;
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid rgba(255, 77, 77, 0.3);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}

/* Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading Container with Video */
.loading-container {
    position: relative;
    margin: 0 auto;
    animation: fadeIn 0.5s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 50;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    max-width: 420px;
}

.loading-videos {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
}

.loading-container #loadingVideo {
    width: 160px;
    height: auto;
    aspect-ratio: 9/16;
    object-fit: cover;
    border-radius: 12px;
    mix-blend-mode: screen;
}

.powered-by-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.powered-by-text {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.powered-by-section video {
    width: 120px;
    height: auto;
    border-radius: 10px;
    mix-blend-mode: screen;
}

.loading-overlay {
    position: relative;
    margin-top: 0.5rem;
    z-index: 1;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    width: 100%;
    text-align: center;
}

.loading-overlay p {
    color: var(--text-main);
    font-weight: 600;
    letter-spacing: 0.5px;
    animation: pulse 1.5s infinite;
    font-size: 0.8rem;
    white-space: nowrap;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }

    50% {
        opacity: 0.5;
        text-shadow: none;
    }
}

@media (max-width: 768px) {
    .loading-container {
        position: relative;
        top: auto;
        right: auto;
        margin: 2rem auto 0;
    }

    .loading-videos {
        flex-direction: column;
        align-items: center;
    }

    .powered-by-section video {
        width: 160px;
    }
}

/* Results Area */
.results-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.5s ease;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.results-header h2 {
    font-weight: 600;
    font-size: 1.5rem;
}

.download-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    padding: 0.6rem 1.5rem;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.download-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.pdf-wrapper {
    width: 100%;
    height: 600px;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    color: #333;
}

/* Search actions row (upload + search button) */
.search-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Upload button */
.upload-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    padding: 0.7rem 1.2rem;
    border-radius: 100px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.upload-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-main);
}

/* Upload status message */
.upload-status {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.5rem 0;
    animation: fadeIn 0.3s ease;
}

.upload-status.processing {
    color: var(--primary);
}

/* Batch results container */
.batch-results-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.5s ease;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.batch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.batch-header h2 {
    font-weight: 600;
    font-size: 1.3rem;
}

.batch-summary {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Results table */
.results-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 6px;
}

.results-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.5rem 1rem;
}

.results-table td {
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
}

.results-table tr td:first-child {
    border-radius: 10px 0 0 10px;
}

.results-table tr td:last-child {
    border-radius: 0 10px 10px 0;
}

.status-found {
    color: #4ade80;
    font-weight: 600;
}

.status-not-found {
    color: #6b7280;
    font-weight: 500;
}

.status-searching {
    color: var(--primary);
}

/* Inline spinner for table rows */
.row-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

/* Per-row download link */
.download-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.download-link:hover {
    color: var(--primary-hover);
}

/* ZIP download section */
.zip-section {
    display: flex;
    justify-content: center;
    padding-top: 0.5rem;
}

.zip-download-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--primary), #ff6b35);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 100px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(255, 42, 84, 0.3);
    min-width: auto;
}

.zip-download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(255, 42, 84, 0.5);
}

.zip-download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.zip-download-btn .spinner {
    width: 18px;
    height: 18px;
}

@media (max-width: 768px) {
    .results-table th:nth-child(1),
    .results-table td:nth-child(1) {
        display: none;
    }

    .batch-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
}