/* Import Prompt Font */
@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap');

/* Reset default styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base styles */
:root {
    --primary-color: #ffffff;
    --text-color: #333333;
    --accent-color: #3498db;
    --light-gray: #f5f6fa;
    --border-color: #e1e1e1;
    --card-hover: #f8f9fa;
}

body {
    font-family: 'Prompt', sans-serif;
    line-height: 1.6;
    background: var(--primary-color);
    color: var(--text-color);
}

/* Navigation */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 2rem;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.05);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-brand a {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-color);
    text-decoration: none;
}

.nav-brand span {
    color: var(--accent-color);
}

nav ul {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 1rem;
}

nav ul li a {
    color: #555;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 400;
    padding: 0.5rem 0.8rem;
    transition: all 0.3s ease;
}

nav ul li a:hover {
    color: var(--accent-color);
}

/* Main Content */
main {
    padding-top: 5rem;
}

/* Filters */
.filters {
    display: none;
}

/* Dropdown styles */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.dropdown-toggle::after {
    content: '▾';
    font-size: 1.1rem;
    margin-top: -2px;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 180px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 0.5rem;
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.dropdown-menu a {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.dropdown-menu a:hover {
    background: var(--light-gray);
    color: var(--accent-color);
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    display: block;
    width: 100%;
}

.dropdown-menu li a {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--text-color);
    border-radius: 6px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.dropdown-menu li a:hover {
    background: var(--light-gray);
    color: var(--accent-color);
}

/* Script Grid */
.script-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1rem 4rem;
    max-width: 1400px;
    margin: 0 auto;
}

.script-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.script-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.card-thumbnail {
    width: 100%;
    height: 250px;
    overflow: hidden;
}

.card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.script-card:hover .card-thumbnail img {
    transform: scale(1.05);
}

.script-card h3 {
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0.3rem 0.5rem 0.5rem;
    line-height: 1.3;
    color: var(--text-color);
}

.category-tag {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: var(--light-gray);
    color: var(--text-color);
    border-radius: 50px;
    font-size: 0.85rem;
    margin: 1rem;
}

.card-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.view-btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background: var(--accent-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.view-btn:hover {
    background: #2980b9;
}

/* Animation */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.script-card {
    animation: fadeIn 0.5s ease forwards;
}

/* View Page Styles */
.view-main {
    padding: 8rem 2rem 4rem;
    max-width: 1000px;
    margin: 0 auto;
}

.script-detail {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.script-header {
    padding: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.script-header h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.script-content {
    padding: 2rem;
}

.script-description {
    margin-bottom: 3rem;
}

.script-description h2,
.script-gallery h2,
.script-download h2 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 3rem;
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.gallery-item img:hover {
    transform: scale(1.05);
}

.download-btn {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--accent-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.download-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
}

.error-message {
    text-align: center;
    padding: 4rem 2rem;
}

.back-btn {
    display: inline-block;
    padding: 0.8rem 1.6rem;
    margin-top: 1rem;
    background: var(--accent-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: #2980b9;
}

/* ปรับ script-card ้ห้คลิกได้ทั้งการ์ด */
.script-card {
    text-decoration: none;
    cursor: pointer;
}

.category-tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0;
    margin: 0.2rem 0.5rem;
    align-items: center;
}

.category-tag {
    background: var(--accent-color);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.7rem;
    line-height: 1;
    display: inline-block;
    margin: 0;
}

.category-tag + .category-tag {
    margin-left: -0.1rem;
}

/* Search Bar Styles */
.search-container {
    max-width: 600px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.search-form {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 50px;
    padding: 0.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.search-form input {
    flex: 1;
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-family: 'Prompt', sans-serif;
    outline: none;
    width: 100%;
}

.search-form button {
    background: var(--accent-color);
    border: none;
    color: white;
    padding: 0.8rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.search-form button:hover {
    background: #2980b9;
    transform: translateY(-1px);
}