/* Base Settings & Typography */
:root {
    --bg-color: #0d0f1a;
    --text-primary: #e6e6f1;
    --text-secondary: #9194a8;
    --accent-red: #ff3b30;
    --accent-blue: #0A84FF;
    --accent-green: #30D158;
    --accent-purple: #BF5AF2;
    --accent-main: #5E5CE6;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --tab-inactive: #2c2d3a;
    --glow-color: rgba(94, 92, 230, 0.5);
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    box-sizing: border-box;
    font-family: 'Outfit', 'Noto Sans KR', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, rgba(94, 92, 230, 0.15), transparent 40%),
        radial-gradient(circle at bottom left, rgba(255, 59, 48, 0.1), transparent 40%);
    z-index: -1;
}

/* Glow Orbs */
.background-effects {
    position: fixed;
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    z-index: -2;
    overflow: hidden;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.6;
    animation: drift 20s infinite alternate ease-in-out;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: rgba(94, 92, 230, 0.3);
    top: -10%;
    left: -10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: rgba(255, 59, 48, 0.2);
    bottom: 10%;
    right: 10%;
    animation-delay: -5s;
}

.orb-3 {
    width: 250px;
    height: 250px;
    background: rgba(10, 132, 255, 0.2);
    top: 50%;
    left: 50%;
    animation-delay: -10s;
}

@keyframes drift {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(100px, 50px) scale(1.1);
    }
}

/* Layout */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.5s ease;
}

/* Header & Search */
.header {
    text-align: center;
    width: 100%;
    max-width: 600px;
    margin-bottom: 3rem;
    transition: transform 0.5s ease-in-out;
}

.header-top {
    transform: translateY(-20px);
    margin-bottom: 2rem;
}

.logo {
    font-size: 3.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    background: linear-gradient(135deg, #fff, #9194a8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.logo span {
    color: var(--accent-main);
    -webkit-text-fill-color: var(--accent-main);
    background: none;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.search-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    gap: 10px;
}

#searchInput {
    width: 100%;
    padding: 1.2rem 1.5rem;
    padding-right: 4rem;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    border-radius: 50px;
    color: var(--text-primary);
    backdrop-filter: blur(10px);
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

#searchInput:focus {
    border-color: var(--accent-main);
    box-shadow: 0 0 20px rgba(94, 92, 230, 0.4);
    background: rgba(255, 255, 255, 0.12);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 8px;
    bottom: 8px;
    width: 44px;
    border-radius: 50%;
    background: var(--accent-main);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.search-btn:hover {
    transform: scale(1.05);
    background: #716EF0;
    box-shadow: 0 0 15px var(--glow-color);
}

/* Results Section */
.results-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.results-section.hidden {
    display: none;
    opacity: 0;
    transform: translateY(20px);
}

/* Tabs */
.tabs-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    border-radius: 12px;
}

.tabs {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    overflow: hidden;
    flex-wrap: wrap;
    border: 1px solid var(--card-border);
}

.tab {
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    position: relative;
}

.tab:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.tab.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

/* Tab Colors & Icons */
.tab[data-platform="youtube"].active {
    color: #ff0000;
    border-bottom: 2px solid #ff0000;
}

.tab[data-platform="naver-cafe"].active {
    color: #2DB400;
    border-bottom: 2px solid #2DB400;
}

.tab[data-platform="naver-blog"].active {
    color: #2DB400;
    border-bottom: 2px solid #2DB400;
}

.tab[data-platform="instagram"].active {
    color: #E1306C;
    border-bottom: 2px solid #E1306C;
}

.tab[data-platform="facebook"].active {
    color: #1877F2;
    border-bottom: 2px solid #1877F2;
}

/* Sort Controls */
.controls-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
}

.platform-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
}

.sort-options {
    display: flex;
    gap: 10px;
}

.sort-btn {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.sort-btn:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.sort-btn.active {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Utilities */
.hidden {
    display: none !important;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    padding: 3rem 0;
    width: 100%;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-main);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .tabs {
        justify-content: center;
    }

    .tab {
        flex: 1;
        justify-content: center;
        font-size: 0.9rem;
        padding: 0.75rem 0.5rem;
    }

    .tab span {
        display: none;
    }

    .logo {
        font-size: 2.5rem;
    }
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    width: 100%;
}

.card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 20px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 1;
    pointer-events: none;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(94, 92, 230, 0.2);
    border-color: rgba(255, 255, 255, 0.25);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.03) 100%);
}

.card-img-wrapper {
    width: 100%;
    height: 180px;
    overflow: hidden;
    position: relative;
    background: #121320;
}

.card-img-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to top, var(--card-bg) 0%, transparent 100%);
    z-index: 2;
}

.youtube-shorts-card .card-img-wrapper {
    height: 360px;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
    filter: brightness(0.9);
}

.card:hover .card-img {
    transform: scale(1.08);
    filter: brightness(1.1);
}

.card-platform-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(10, 10, 20, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 3;
    transition: all 0.3s ease;
}

.card:hover .card-platform-icon {
    transform: scale(1.1) rotate(5deg);
    border-color: rgba(255, 255, 255, 0.4);
}

.card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    position: relative;
    z-index: 3;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #ffffff;
    word-break: break-word;
    letter-spacing: -0.3px;
    transition: color 0.3s ease;
}

.card:hover .card-title {
    color: var(--accent-main);
}

.card-meta-extras {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
    font-size: 0.82rem;
    color: var(--accent-main);
    opacity: 0.9;
    font-weight: 400;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0 0 1.25rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.6;
    font-weight: 300;
}

.card-meta {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 1rem;
    font-weight: 400;
}

.card-meta .author {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Real Result Portal UI */
.real-result-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 3rem 2rem;
    text-align: center;
    backdrop-filter: blur(10px);
    max-width: 800px;
    margin: 0 auto;
    animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.real-result-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.icon-ring {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.real-result-card h2 {
    font-size: 2rem;
    margin: 0;
    color: white;
}

.real-result-desc {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 1.1rem;
    max-width: 600px;
    margin-bottom: 1rem;
}

.launch-btn {
    display: inline-flex;
    align-items: center;
    padding: 1rem 2rem;
    border-radius: 50px;
    color: white;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.launch-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

.url-preview {
    margin-top: 2rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    word-break: break-all;
    border: 1px solid rgba(255, 255, 255, 0.05);
    width: 100%;
}

.url-preview span {
    display: block;
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.5);
}

.url-preview code {
    color: #a8aab8;
    font-family: monospace;
}

/* Iframe Container */
.iframe-container {
    width: 100%;
    height: 700px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    background: white;
    /* Ensure visibility for embedded sites */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.6s ease-out forwards;
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    /* Prevent transparent iframe rendering issues */
}