:root {
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --card-bg: #ffffff;
    --header-bg: rgba(255, 255, 255, 0.9);
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --accent-color: #fd79a8;
    --shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    --modal-overlay: rgba(0, 0, 0, 0.5);
    --border-color: #e9ecef;
}

body.dark-mode {
    --bg-color: #0f0f13;
    --text-color: #f8f9fa;
    --card-bg: #1a1a24;
    --header-bg: rgba(26, 26, 36, 0.9);
    --primary-color: #827ffe;
    --secondary-color: #6c5ce7;
    --accent-color: #ff7675;
    --shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    --modal-overlay: rgba(0, 0, 0, 0.8);
    --border-color: #2d2d3a;
}

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

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.4s, color 0.4s;
    overflow-x: hidden;
}

/* Header & Navigation */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background-color: var(--header-bg);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: background-color 0.4s;
}

.header-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -1px;
    cursor: pointer;
}

.search-box {
    flex: 1;
    max-width: 500px;
    display: flex;
    gap: 10px;
}

#search-input {
    width: 100%;
    padding: 12px 20px;
    border: 1px solid var(--border-color);
    border-radius: 30px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
}

#search-btn {
    padding: 0 25px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 500;
    transition: transform 0.2s, background-color 0.3s;
}

#search-btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.theme-btn {
    padding: 10px 15px;
    background: none;
    border: 1.5px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.theme-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Hero Section */
.hero-section {
    width: 100%;
    height: 450px;
    margin-top: 80px;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    background-image: url('https://images.unsplash.com/photo-1578632292335-df3abbb0d586?auto=format&fit=crop&q=80&w=2000');
    background-size: cover;
    background-position: center;
    position: relative;
}

.hero-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.7));
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-content {
    text-align: center;
    color: white;
}

.hero-content h2 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.hero-content p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.section-title-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

#view-title {
    font-size: 1.8rem;
    font-weight: 700;
}

#status-message {
    padding: 10px 20px;
    border-radius: 10px;
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
}

.anime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 30px;
}

.anime-card {
    background-color: var(--card-bg);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    border: 1px solid var(--border-color);
    position: relative;
}

.like-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
    z-index: 5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.like-btn:hover {
    transform: scale(1.1);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.like-btn.liked {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.anime-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    border-color: var(--primary-color);
}

.card-img-container {
    width: 100%;
    height: 320px;
    overflow: hidden;
    position: relative;
}

.anime-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.anime-card:hover img {
    transform: scale(1.1);
}

.card-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 5px 12px;
    background-color: rgba(108, 92, 231, 0.9);
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.anime-card h3 {
    padding: 20px;
    font-size: 1.05rem;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Modal Styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--card-bg);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    border-radius: 20px;
    overflow-y: auto;
    position: relative;
    padding: 40px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.6;
    transition: opacity 0.2s;
}

.close-btn:hover {
    opacity: 1;
}

.modal-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 40px;
}

@media (max-width: 768px) {
    .modal-grid {
        grid-template-columns: 1fr;
    }
    .hero-content h2 {
        font-size: 2.2rem;
    }
    .header-content {
        padding: 0 15px;
    }
}

.modal-img {
    width: 100%;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-info h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    font-size: 0.95rem;
}

.meta-item {
    background-color: var(--bg-color);
    padding: 6px 15px;
    border-radius: 8px;
    font-weight: 500;
}

.modal-synopsis {
    margin-bottom: 25px;
}

.modal-synopsis h4 {
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.trailer-box {
    margin-top: 30px;
    border-radius: 15px;
    overflow: hidden;
}

/* Tab Menu Styling */
.modal-tabs {
    display: flex;
    gap: 10px;
    margin-top: 30px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    opacity: 0.6;
    transition: all 0.3s;
}

.tab-btn.active {
    opacity: 1;
    color: var(--primary-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.tab-content {
    display: none;
    padding: 30px 0;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

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

/* Goods & Popup Card UI Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.info-card {
    background-color: var(--bg-color);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.info-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.info-card-body {
    padding: 15px;
}

.info-card-body h5 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.info-card-body p {
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.info-link {
    display: inline-block;
    font-size: 0.85rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.info-link:hover {
    text-decoration: underline;
}

/* Map Container Styling */
#map-container {
    width: 100%;
    height: 350px;
    border-radius: 15px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.custom-overlay {
    background-color: var(--card-bg);
    padding: 10px 15px;
    border-radius: 10px;
    border: 1.5px solid var(--primary-color);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    font-size: 0.85rem;
    color: var(--text-color);
    position: relative;
    bottom: 45px;
    min-width: 150px;
    text-align: center;
}

.custom-overlay h6 {
    color: var(--primary-color);
    margin-bottom: 5px;
    font-weight: 700;
}

.custom-overlay a {
    display: block;
    margin-top: 5px;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

/* Footer */
footer {
    padding: 60px 0;
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
}

.footer-content {
    text-align: center;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.hidden {
    display: none;
}
