/* ============================================
   DESIGN SYSTEM - CSS Variables
   ============================================ */
:root {
    /* Colors - Premium Palette */
    --primary: hsl(250, 100%, 65%);
    --primary-dark: hsl(250, 100%, 55%);
    --primary-light: hsl(250, 100%, 75%);
    --secondary: hsl(210, 100%, 60%);
    --accent: hsl(280, 100%, 70%);

    /* Neutrals - Sophisticated Dark */
    --bg-primary: hsl(230, 20%, 7%);
    --bg-secondary: hsl(230, 18%, 11%);
    --bg-tertiary: hsl(230, 16%, 15%);
    --bg-elevated: hsl(230, 15%, 18%);
    --text-primary: hsl(0, 0%, 98%);
    --text-secondary: hsl(0, 0%, 75%);
    --text-muted: hsl(0, 0%, 55%);

    /* Glass Effect - Enhanced */
    --glass-bg: hsla(230, 16%, 15%, 0.75);
    --glass-border: hsla(250, 100%, 80%, 0.15);
    --glass-highlight: hsla(250, 100%, 90%, 0.08);

    /* Gradients - Premium */
    --gradient-primary: linear-gradient(135deg, hsl(250, 100%, 65%) 0%, hsl(210, 100%, 60%) 100%);
    --gradient-accent: linear-gradient(135deg, hsl(280, 100%, 70%) 0%, hsl(250, 100%, 65%) 100%);
    --gradient-surface: linear-gradient(145deg, hsla(230, 16%, 15%, 0.9), hsla(230, 18%, 11%, 0.95));

    /* Shadows - Sophisticated */
    --shadow-sm: 0 2px 8px hsla(230, 50%, 3%, 0.3);
    --shadow-md: 0 8px 24px hsla(230, 50%, 3%, 0.4);
    --shadow-lg: 0 16px 48px hsla(230, 50%, 3%, 0.5);
    --shadow-glow: 0 0 32px hsla(250, 100%, 65%, 0.25);
    --shadow-glow-strong: 0 0 48px hsla(250, 100%, 65%, 0.4);

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;

    /* Typography */
    --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-sm: 0.8125rem;
    --font-size-base: 0.9375rem;
    --font-size-lg: 1.0625rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;

    /* Border Radius - Refined */
    --radius-sm: 0.625rem;
    --radius-md: 1rem;
    --radius-lg: 1.25rem;
    --radius-xl: 1.5rem;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 20%, hsla(250, 100%, 65%, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, hsla(280, 100%, 70%, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, hsla(210, 100%, 60%, 0.05) 0%, transparent 70%);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   LAYOUT COMPONENTS
   ============================================ */
.container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* Header - Premium */
.header {
    padding: var(--space-lg) 0;
    border-bottom: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 16px hsla(230, 50%, 3%, 0.2);
}

.header-content {
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-size: var(--font-size-2xl);
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-xs);
    filter: drop-shadow(0 0 20px hsla(250, 100%, 65%, 0.3));
}

.logo-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 0 16px var(--primary));
}

.tagline {
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    font-weight: 300;
    letter-spacing: 0.3px;
}

/* Main Content */
.main-content {
    padding: var(--space-xl) 0;
    min-height: calc(100vh - 200px);
}

/* Cards - Premium Look */
.card {
    background: var(--gradient-surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: relative;
    transition: all var(--transition-base);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--glass-highlight);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: hsla(250, 100%, 80%, 0.25);
}

.card-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--glass-border);
    background: var(--glass-highlight);
}

.card-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    font-weight: 300;
}

/* ============================================
   FORM COMPONENTS
   ============================================ */
.search-section {
    margin-bottom: var(--space-xl);
}

.search-form {
    padding: var(--space-lg);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.form-label {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-base);
    letter-spacing: 0.2px;
}

.label-icon {
    font-size: 1.25rem;
}

.form-input {
    padding: 1rem 1.25rem;
    background: var(--bg-elevated);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    transition: all var(--transition-base);
    outline: none;
    box-shadow: inset 0 2px 4px hsla(230, 50%, 3%, 0.3);
}

.form-input:focus {
    border-color: var(--primary);
    background: var(--bg-tertiary);
    box-shadow: 0 0 0 4px hsla(250, 100%, 65%, 0.1),
        inset 0 2px 4px hsla(230, 50%, 3%, 0.2);
    transform: translateY(-1px);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-hint {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.form-actions {
    display: flex;
    justify-content: center;
}

/* ============================================
   BUTTON COMPONENTS - Premium
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 1rem 2.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    outline: none;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: hsla(255, 100%, 100%, 0.15);
    transform: translate(-50%, -50%);
    transition: width var(--transition-slow), height var(--transition-slow);
}

.btn:hover::before {
    width: 400px;
    height: 400px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow-strong);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 2px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    box-shadow: var(--shadow-md), 0 0 16px hsla(250, 100%, 65%, 0.2);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-icon {
    font-size: 1.25rem;
    z-index: 1;
}

.btn-text {
    z-index: 1;
}

/* ============================================
   LOADING STATE
   ============================================ */
.loading-section {
    margin-bottom: var(--space-xl);
}

.loading-content {
    padding: var(--space-xl);
    text-align: center;
}

.spinner {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-lg);
    border: 4px solid var(--glass-border);
    border-top: 4px solid var(--primary);
    border-right: 4px solid var(--secondary);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
    box-shadow: 0 0 24px hsla(250, 100%, 65%, 0.3);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: var(--space-sm);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.loading-text {
    color: var(--text-secondary);
    font-weight: 300;
}

/* ============================================
   RESULTS SECTION - Premium Table
   ============================================ */
.results-section {
    margin-bottom: var(--space-xl);
}

.results-header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.export-buttons {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.table-container {
    overflow-x: auto;
    padding: var(--space-lg);
    max-width: 100%;
}

.results-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1200px;
    table-layout: fixed;
}

/* Column Widths */
.results-table th:nth-child(1),
.results-table td:nth-child(1) {
    width: 70px;
}

.results-table th:nth-child(2),
.results-table td:nth-child(2) {
    width: 200px;
}

.results-table th:nth-child(3),
.results-table td:nth-child(3) {
    width: 80px;
}

.results-table th:nth-child(4),
.results-table td:nth-child(4) {
    width: 90px;
}

.results-table th:nth-child(5),
.results-table td:nth-child(5) {
    width: 150px;
}

.results-table th:nth-child(6),
.results-table td:nth-child(6) {
    width: 250px;
}

.results-table th:nth-child(7),
.results-table td:nth-child(7) {
    width: 140px;
}

.results-table th:nth-child(8),
.results-table td:nth-child(8) {
    width: 140px;
}

.results-table th:nth-child(9),
.results-table td:nth-child(9) {
    width: 130px;
}

.results-table thead {
    background: var(--bg-elevated);
    position: sticky;
    top: 0;
    z-index: 10;
}

.results-table th {
    padding: 1.125rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--primary);
    white-space: nowrap;
    background: var(--bg-elevated);
    box-shadow: 0 4px 8px hsla(230, 50%, 3%, 0.2);
    text-transform: uppercase;
    font-size: var(--font-size-sm);
    letter-spacing: 1px;
}

.results-table th:first-child {
    border-radius: var(--radius-md) 0 0 0;
}

.results-table th:last-child {
    border-radius: 0 var(--radius-md) 0 0;
}

.results-table tbody tr {
    transition: all var(--transition-fast);
    border-bottom: 1px solid var(--glass-border);
}

.results-table tbody tr:hover {
    background: hsla(250, 100%, 65%, 0.08);
    transform: scale(1.005);
}

.results-table tbody tr:last-child td:first-child {
    border-radius: 0 0 0 var(--radius-md);
}

.results-table tbody tr:last-child td:last-child {
    border-radius: 0 0 var(--radius-md) 0;
}

.results-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.results-table td:first-child {
    color: var(--primary);
    font-weight: 700;
    font-size: var(--font-size-base);
}

/* Allow wrap in specific columns */
.results-table td:nth-child(2),
.results-table td:nth-child(6) {
    white-space: normal;
    word-wrap: break-word;
}

.rating-cell {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: hsl(45, 100%, 60%);
    font-weight: 700;
}

.link-cell a {
    color: var(--primary);
    text-decoration: none;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.link-cell a:hover {
    color: var(--primary-light);
    text-decoration: underline;
    text-shadow: 0 0 8px hsla(250, 100%, 65%, 0.4);
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    padding: var(--space-lg) 0;
    margin-top: var(--space-xl);
    border-top: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
}

.footer-text {
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    font-weight: 300;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .header {
        padding: var(--space-md) 0;
    }

    .logo {
        font-size: var(--font-size-xl);
    }

    .logo-icon {
        font-size: 2rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .results-header-content {
        flex-direction: column;
        align-items: stretch;
    }

    .export-buttons {
        justify-content: stretch;
    }

    .export-buttons .btn {
        flex: 1;
    }

    .table-container {
        padding: var(--space-sm);
    }

    .results-table th,
    .results-table td {
        padding: var(--space-sm);
        font-size: var(--font-size-sm);
    }
}

@media (max-width: 480px) {
    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   ANIMATIONS & MICRO-INTERACTIONS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(24px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.card {
    animation: fadeIn var(--transition-slow) cubic-bezier(0.16, 1, 0.3, 1);
}

.results-table tbody tr {
    animation: slideIn var(--transition-base) cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.results-table tbody tr:nth-child(1) {
    animation-delay: 0ms;
}

.results-table tbody tr:nth-child(2) {
    animation-delay: 50ms;
}

.results-table tbody tr:nth-child(3) {
    animation-delay: 100ms;
}

.results-table tbody tr:nth-child(4) {
    animation-delay: 150ms;
}

.results-table tbody tr:nth-child(5) {
    animation-delay: 200ms;
}

/* Scroll Styles */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: var(--radius-sm);
    border: 2px solid var(--bg-tertiary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}