:root {
    --bg-color: #000000;
    --card-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #ff9000;
    --primary-glow: rgba(255, 144, 0, 0.4);
    --text-main: #ffffff;
    --text-muted: #b3b3b3;
    --font-family: 'Outfit', sans-serif;
    --success: #4caf50;
    --error: #f44336;
    --warning: #ff9800;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-family);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Navbar */
.navbar {
    background: #1a1a1a;
    padding: 1rem 0;
    border-bottom: 1px solid #333;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
    color: white;
}

.logo span {
    background: #000;
    color: var(--primary);
    padding: 0.2rem 0.8rem;
    border-radius: 4px;
}

.db-status {
    font-size: 0.75rem;
    background: var(--card-bg);
    padding: 0.4rem 1rem;
    border-radius: 100px;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
    cursor: help;
}

.db-status:hover {
    background: rgba(255, 144, 0, 0.1);
    border-color: var(--primary);
}

/* Hero */
.hero {
    text-align: left;
    padding: 3rem 0 2rem;
}

.display-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: white;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Search Box */
.search-section {
    max-width: 100%;
    margin: 0 0 3rem;
}

.glass {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
}

.search-box {
    display: flex;
    padding: 0.5rem;
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(255, 144, 0, 0.2);
}

.search-box input {
    background: transparent;
    border: none;
    color: white;
    padding: 1rem 1.5rem;
    flex-grow: 1;
    font-size: 1rem;
    outline: none;
}

.search-box input::placeholder {
    color: #666;
}

.search-box button {
    background: var(--primary);
    border: none;
    color: black;
    width: 50px;
    height: 50px;
    border-radius: 4px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform 0.2s, background 0.2s;
    font-weight: 700;
}

.search-box button:hover {
    background: #ffaa00;
    transform: scale(1.05);
}

/* Results */
.results-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.results-grid {
    display: grid;
    gap: 0.5rem;
    padding-bottom: 5rem;
}

/* Search States */
.searching-message,
.error-message {
    text-align: center;
    padding: 3rem;
    font-size: 1rem;
    color: var(--text-muted);
}

.searching-message {
    animation: pulse 1.5s ease-in-out infinite;
}

.error-message {
    color: var(--error);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Result Cards */
.result-card {
    padding: 1.2rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    transition: all 0.2s ease;
}

.result-card:hover {
    background: rgba(255, 144, 0, 0.1);
    border-color: var(--primary);
    transform: translateX(4px);
}

.info {
    flex: 1;
    min-width: 0;
}

.info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: white;
    line-height: 1.4;
}

/* Highlight matched text */
.info h3 mark {
    background: var(--primary);
    color: #000;
    padding: 0.1rem 0.3rem;
    border-radius: 2px;
    font-weight: 700;
}

.stats {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.stats span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.size {
    color: var(--text-muted);
    font-weight: 600;
}

.seeders {
    color: var(--success);
    font-weight: 600;
}

.leechers {
    color: var(--error);
    font-weight: 600;
}

.completed {
    color: var(--primary);
    font-weight: 600;
}

.magnet-btn {
    background: var(--primary);
    border: none;
    color: black;
    padding: 0.6rem 1.5rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.magnet-btn:hover {
    background: #ffaa00;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 144, 0, 0.3);
}

.magnet-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 0.6rem 1.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: var(--primary);
    color: black;
}

/* Text Utilities */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Loader */
.loader-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s;
}

.loader-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none !important;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* Footer */
.footer {
    background: #1a1a1a;
    border-top: 1px solid #333;
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
}

.footer p {
    margin: 0.5rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer strong {
    color: var(--primary);
}

.footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.footer a:hover {
    color: #ffaa00;
    text-decoration: underline;
}

.powered {
    font-size: 0.85rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal {
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    position: relative;
    border-color: #444;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.5rem;
    color: var(--primary);
}

.close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
}

.close-btn:hover {
    color: var(--primary);
    transform: rotate(90deg);
}

.modal-body p {
    margin-bottom: 1rem;
}

.modal-body ol {
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.modal-body li {
    margin-bottom: 0.8rem;
}

.modal-body code {
    background: #333;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.modal-body pre {
    background: #000;
    padding: 1rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    overflow-x: auto;
    border: 1px solid #333;
}

.modal-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .display-title {
        font-size: 2rem;
    }

    .result-card {
        padding: 1rem;
        gap: 1rem;
    }

    .stats {
        gap: 0.75rem;
        font-size: 0.75rem;
    }

    .magnet-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 600px) {
    .display-title {
        font-size: 1.8rem;
    }

    .result-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .result-card:hover {
        transform: translateX(0);
    }

    .logo {
        font-size: 1.5rem;
    }

    .db-status {
        font-size: 0.65rem;
        padding: 0.3rem 0.8rem;
    }

    .magnet-btn {
        width: 100%;
        justify-content: center;
    }

    .modal-overlay {
        padding: 1rem;
    }

    .modal {
        padding: 1.5rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .navbar,
    .hero,
    .search-section,
    .footer,
    .magnet-btn {
        display: none;
    }

    .result-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}