/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Bai+Jamjuree:wght@300;400;500;600;700&display=swap');

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Bai Jamjuree', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #e0e0e0;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: rgba(15, 12, 41, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.3);
    border-bottom: 3px solid #ff6b6b;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.logo {
    flex-shrink: 0;
}

.logo a {
    display: block;
}

.logo img {
    height: 60px;
    width: auto;
    transition: transform 0.3s;
    filter: drop-shadow(0 0 10px rgba(255, 107, 107, 0.5));
}

.logo img:hover {
    transform: scale(1.05);
}

header nav {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

header nav ul {
    list-style: none;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin: 0;
}

header nav a {
    color: white;
    text-decoration: none;
    padding: 8px 20px;
    border-radius: 25px;
    transition: all 0.3s;
    border: 2px solid transparent;
    font-weight: 500;
}

header nav a:hover,
header nav a.active {
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    border-color: #ff6b6b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

/* Main Content */
main {
    padding: 3rem 0;
    min-height: calc(100vh - 200px);
}

main h2 {
    color: #feca57;
    text-shadow: 0 0 10px rgba(254, 202, 87, 0.5);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

/* Search Section */
.search-section {
    margin-bottom: 3rem;
}

.search-form {
    display: flex;
    gap: 15px;
    max-width: 700px;
    margin: 0 auto;
}

.search-form input {
    flex: 1;
    padding: 15px 25px;
    border: 2px solid #ff6b6b;
    border-radius: 30px;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    transition: all 0.3s;
}

.search-form input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-form input:focus {
    outline: none;
    border-color: #feca57;
    box-shadow: 0 0 20px rgba(254, 202, 87, 0.4);
    background: rgba(255, 255, 255, 0.15);
}

.search-form button {
    padding: 15px 40px;
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.3);
}

.search-form button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.5);
}

/* Anime Grid */
.anime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    margin-top: 2rem;
}

.anime-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 107, 107, 0.2);
    position: relative;
}

.anime-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.2), rgba(254, 202, 87, 0.2));
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1;
}

.anime-card:hover::before {
    opacity: 1;
}

.anime-card:hover {
    transform: translateY(-10px) scale(1.03);
    box-shadow: 0 15px 40px rgba(255, 107, 107, 0.4);
    border-color: #ff6b6b;
}

.anime-card a {
    text-decoration: none;
    color: inherit;
    position: relative;
    z-index: 2;
}

.anime-image {
    width: 100%;
    height: 320px;
    overflow: hidden;
    position: relative;
}

.anime-image::after {
    content: '▶ ดูเลย';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 107, 107, 0.9);
    color: white;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 3;
}

.anime-card:hover .anime-image::after {
    opacity: 1;
}

.anime-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.anime-card:hover .anime-image img {
    transform: scale(1.1);
}

.anime-info {
    padding: 18px;
    background: rgba(15, 12, 41, 0.8);
}

.anime-info h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: #feca57;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.anime-status {
    font-size: 0.85rem;
    color: #48dbfb;
    font-weight: 500;
}

/* Anime Detail Page */
.anime-detail {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 107, 107, 0.3);
}

.anime-header {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.anime-poster {
    position: relative;
}

.anime-poster::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    border-radius: 20px;
    z-index: -1;
    opacity: 0.5;
    filter: blur(20px);
}

.anime-poster img {
    width: 100%;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 3px solid rgba(255, 107, 107, 0.5);
}

.anime-info-detail h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: #feca57;
    text-shadow: 0 0 20px rgba(254, 202, 87, 0.5);
    font-weight: 700;
}

.anime-info-detail p {
    margin-bottom: 0.8rem;
    color: #e0e0e0;
    font-size: 1.05rem;
}

.anime-info-detail strong {
    color: #ff6b6b;
}

.description {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid rgba(255, 107, 107, 0.3);
}

.description h3 {
    margin-bottom: 1rem;
    color: #48dbfb;
    font-size: 1.3rem;
}

.description p {
    line-height: 1.8;
    color: #e0e0e0;
}

.ref-link a {
    color: #48dbfb;
    text-decoration: none;
    transition: color 0.3s;
}

.ref-link a:hover {
    color: #feca57;
}

/* Episodes Section */
.episodes-section {
    margin-top: 3rem;
}

.episodes-section h2 {
    margin-bottom: 1.5rem;
    color: #feca57;
    text-shadow: 0 0 10px rgba(254, 202, 87, 0.5);
    font-size: 1.8rem;
}

.episodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}

.episode-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
    border: 2px solid rgba(255, 107, 107, 0.2);
}

.episode-card:hover {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.3), rgba(254, 202, 87, 0.3));
    transform: translateY(-5px);
    border-color: #ff6b6b;
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
}

.episode-card a {
    display: block;
    padding: 18px;
    text-decoration: none;
    color: #e0e0e0;
    text-align: center;
}

.episode-card:hover a {
    color: white;
}

.episode-number {
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 1.1rem;
    color: #feca57;
}

.episode-name {
    font-size: 0.9rem;
    color: #48dbfb;
}

/* Player Page */
.player-page {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 107, 107, 0.3);
}

.player-page h1 {
    color: #feca57;
    text-shadow: 0 0 10px rgba(254, 202, 87, 0.5);
    margin-bottom: 1.5rem;
}

.breadcrumb {
    margin-bottom: 1.5rem;
    color: #48dbfb;
    font-size: 1rem;
}

.breadcrumb a {
    color: #ff6b6b;
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumb a:hover {
    color: #feca57;
}

.player-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    margin: 2rem 0;
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(255, 107, 107, 0.3);
    border: 3px solid rgba(255, 107, 107, 0.5);
}

.video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.no-player {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ff6b6b;
    font-size: 1.2rem;
}

.player-navigation {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: 2rem 0;
}

.anime-info-box {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1.5rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    margin: 2rem 0;
    border: 2px solid rgba(255, 107, 107, 0.2);
}

.anime-info-box h2 {
    color: #feca57;
}

.anime-info-box p {
    color: #e0e0e0;
}

.anime-thumb img {
    width: 100%;
    border-radius: 8px;
    border: 2px solid rgba(255, 107, 107, 0.3);
}

.anime-details .btn {
    margin-top: 1rem;
}

.backup-player {
    margin-top: 2rem;
}

.backup-player h3 {
    color: #48dbfb;
    margin-bottom: 1rem;
}

.episodes-list {
    margin-top: 2rem;
}

.episodes-list h3 {
    color: #feca57;
    margin-bottom: 1rem;
}

.episodes-grid-small {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 12px;
    margin-top: 1rem;
}

.episode-item {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    text-align: center;
    border: 2px solid rgba(255, 107, 107, 0.2);
    transition: all 0.3s;
}

.episode-item:hover {
    border-color: #feca57;
    transform: scale(1.05);
}

.episode-item.active {
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    border-color: #ff6b6b;
}

.episode-item a {
    display: block;
    padding: 12px;
    text-decoration: none;
    color: #e0e0e0;
    font-size: 0.95rem;
    font-weight: 600;
}

.episode-item.active a {
    color: white;
    font-weight: bold;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 30px;
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.3);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.5);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #495057);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268, #343a40);
}

.btn-info {
    background: linear-gradient(135deg, #48dbfb, #0abde3);
}

.btn-info:hover {
    background: linear-gradient(135deg, #0abde3, #00a8cc);
}

.btn-disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-disabled:hover {
    transform: none;
    box-shadow: none;
}

.btn-small {
    padding: 8px 15px;
    font-size: 0.85rem;
    margin: 0 3px;
}

.btn-danger {
    background: linear-gradient(135deg, #ee5a6f, #f29263);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333, #dc3545);
}

.btn-prev, .btn-next, .btn-list {
    flex: 1;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 3rem;
}

.pagination a,
.pagination span {
    padding: 10px 16px;
    text-decoration: none;
    color: #feca57;
    border: 2px solid rgba(255, 107, 107, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    transition: all 0.3s;
    font-weight: 600;
}

.pagination a:hover {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.2);
    transform: translateY(-2px);
}

.pagination .current-page {
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    color: white;
    border-color: #ff6b6b;
}

/* Admin Styles */
.admin-login {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
}

.login-box {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    border: 2px solid rgba(255, 107, 107, 0.3);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #feca57;
    text-shadow: 0 0 10px rgba(254, 202, 87, 0.5);
}

.admin-panel {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 107, 107, 0.3);
}

.admin-panel h1, .admin-panel h2 {
    color: #feca57;
    text-shadow: 0 0 10px rgba(254, 202, 87, 0.5);
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 2rem 0;
}

.stat-box {
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    color: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.3);
}

.stat-number {
    font-size: 3rem;
    font-weight: bold;
}

.admin-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 2rem 0;
}

.admin-btn {
    display: block;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    color: #feca57;
    text-decoration: none;
    text-align: center;
    border-radius: 15px;
    transition: all 0.3s;
    border: 2px solid rgba(255, 107, 107, 0.3);
    font-weight: 600;
}

.admin-btn:hover {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.3), rgba(254, 202, 87, 0.3));
    color: white;
    border-color: #ff6b6b;
    transform: translateY(-3px);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.admin-table th,
.admin-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 107, 107, 0.2);
    color: #e0e0e0;
}

.admin-table th {
    background: rgba(255, 107, 107, 0.2);
    font-weight: bold;
    color: #feca57;
}

.admin-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.admin-form {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 107, 107, 0.3);
}

.admin-form h1, .admin-form h3 {
    color: #feca57;
    text-shadow: 0 0 10px rgba(254, 202, 87, 0.5);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #feca57;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="password"],
.form-group input[type="file"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid rgba(255, 107, 107, 0.3);
    border-radius: 10px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #feca57;
    box-shadow: 0 0 10px rgba(254, 202, 87, 0.3);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #48dbfb;
    font-size: 0.85rem;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.admin-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-form-inline {
    display: flex;
    gap: 10px;
    flex: 1;
}

.search-form-inline input {
    flex: 1;
    padding: 12px;
    border: 2px solid rgba(255, 107, 107, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.current-image {
    margin-bottom: 1rem;
}

.current-image img {
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 107, 107, 0.3);
}

.seo-tips {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border-left: 4px solid #ff6b6b;
}

.seo-tips h3 {
    margin-bottom: 1rem;
    color: #feca57;
}

.seo-tips ul {
    margin-left: 1.5rem;
}

.seo-tips li {
    margin-bottom: 0.5rem;
    color: #e0e0e0;
}

/* Messages */
.success,
.success-message {
    padding: 1rem;
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
    border: 2px solid #4caf50;
    border-radius: 10px;
    margin-bottom: 1rem;
    backdrop-filter: blur(10px);
    font-weight: 600;
}

.error,
.error-message {
    padding: 1rem;
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
    border: 2px solid #f44336;
    border-radius: 10px;
    margin-bottom: 1rem;
    backdrop-filter: blur(10px);
    font-weight: 600;
}

.info-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(72, 219, 251, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border-left: 4px solid #48dbfb;
}

.info-box h3 {
    margin-bottom: 1rem;
    color: #48dbfb;
}

.info-box ul {
    margin-left: 1.5rem;
}

.info-box li {
    margin-bottom: 0.5rem;
    color: #e0e0e0;
}

.no-results,
.no-episodes {
    text-align: center;
    padding: 3rem;
    color: #48dbfb;
    font-size: 1.2rem;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: #6c757d;
}

.link-small {
    color: #48dbfb;
    font-size: 0.85rem;
}

/* Footer */
footer {
    background: rgba(15, 12, 41, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    text-align: center;
    padding: 2.5rem 0;
    margin-top: 4rem;
    border-top: 3px solid #ff6b6b;
    box-shadow: 0 -4px 20px rgba(255, 107, 107, 0.3);
}

footer p {
    font-size: 1.05rem;
    color: #e0e0e0;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .logo img {
        height: 50px;
    }
    
    header nav {
        justify-content: center;
    }
    
    header nav ul {
        justify-content: center;
    }
    
    .anime-header {
        grid-template-columns: 1fr;
    }
    
    .anime-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .episodes-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .admin-stats {
        grid-template-columns: 1fr;
    }
    
    .anime-info-box {
        grid-template-columns: 1fr;
    }
    
    .player-navigation {
        flex-direction: column;
    }
    
    .search-form {
        flex-direction: column;
    }
}

/* Ad Banner */
.ad-banner {
    /*margin: var(--space-6) 0;*/
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ad-banner img {
    max-width: 100%;
    height: auto;
    /*border-radius: var(--radius-lg);*/
}

