/* Import Font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* Reset dan Variabel */
:root {
    --gradient-start: #b3e5fc;
    --gradient-middle: #81d4fa;
    --gradient-end: #4fc3f7;
    --primary-light: #e1f5fe;
    --primary: #03a9f4;
    --primary-dark: #0288d1;
    --secondary: #b3e5fc;
    --accent: #29b6f6;
    --text-dark: #01579b;
    --text-light: #ffffff;
    --text-muted: #546e7a;
    --card-bg: rgba(255, 255, 255, 0.95);
    --shadow-sm: 0 4px 6px rgba(1, 87, 155, 0.1);
    --shadow-md: 0 6px 12px rgba(1, 87, 155, 0.15);
    --shadow-lg: 0 15px 25px rgba(1, 87, 155, 0.2);
    --border-radius-sm: 12px;
    --border-radius-md: 20px;
    --border-radius-lg: 30px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-middle), var(--gradient-end));
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" opacity="0.05"><path d="M20 20 L80 20 L80 80 L20 80 Z" fill="none" stroke="%2301579b" stroke-width="2"/><circle cx="50" cy="50" r="15" fill="none" stroke="%2301579b" stroke-width="2"/></svg>');
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
    width: 100%;
}

/* Navbar Responsif */
.navbar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.nav-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: clamp(20px, 5vw, 24px);
    font-weight: 700;
    color: var(--text-dark);
}

.nav-brand i {
    color: var(--primary);
    font-size: clamp(24px, 6vw, 28px);
}

.nav-search {
    flex: 1;
    max-width: 400px;
    min-width: 250px;
}

.nav-search form {
    display: flex;
    gap: 8px;
}

.nav-search input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid rgba(1, 87, 155, 0.1);
    border-radius: 30px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
    width: 100%;
}

.nav-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(3, 169, 244, 0.1);
}

.nav-search button {
    width: 42px;
    height: 42px;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.nav-search button:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    gap: clamp(10px, 2vw, 20px);
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
}

.nav-links a:hover {
    background: rgba(3, 169, 244, 0.1);
    color: var(--primary);
}

/* Hero Section Responsif */
.hero {
    position: relative;
    padding: clamp(40px, 8vw, 80px) 20px clamp(60px, 10vw, 120px);
    text-align: center;
    background: linear-gradient(135deg, rgba(179, 229, 252, 0.9), rgba(79, 195, 247, 0.9));
    overflow: hidden;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    padding: 0 10px;
}

.hero h1 {
    font-size: clamp(28px, 6vw, 48px);
    margin-bottom: 15px;
    background: linear-gradient(135deg, var(--text-dark), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: fadeInUp 1s ease;
    line-height: 1.2;
}

.hero p {
    font-size: clamp(14px, 3vw, 18px);
    color: var(--text-dark);
    margin-bottom: 30px;
    opacity: 0.9;
    animation: fadeInUp 1s ease 0.2s both;
    padding: 0 10px;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: clamp(20px, 5vw, 50px);
    animation: fadeInUp 1s ease 0.4s both;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
    min-width: 100px;
}

.stat-number {
    display: block;
    font-size: clamp(24px, 5vw, 36px);
    font-weight: 700;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.stat-label {
    font-size: clamp(12px, 2.5vw, 14px);
    color: var(--text-dark);
    opacity: 0.8;
}

.hero-wave {
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    line-height: 0;
}

.hero-wave svg {
    width: 100%;
    height: auto;
}

/* Filter Section Responsif */
.filter-section {
    margin: clamp(-30px, -4vw, -50px) 0 40px;
    position: relative;
    z-index: 10;
    padding: 0 15px;
}

.filter-container {
    background: white;
    border-radius: clamp(20px, 4vw, 50px);
    padding: clamp(15px, 3vw, 30px);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

.filter-form {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 180px;
}

.filter-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.filter-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid rgba(1, 87, 155, 0.1);
    border-radius: 30px;
    font-size: 13px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-filter {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-filter:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-reset {
    padding: 10px 20px;
    background: rgba(1, 87, 155, 0.1);
    color: var(--text-dark);
    border-radius: 30px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-reset:hover {
    background: rgba(1, 87, 155, 0.2);
}

/* Stories Grid Responsif */
.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: clamp(15px, 3vw, 30px);
    margin: 40px 0;
}

.story-card {
    height: 380px;
    perspective: 1500px;
    cursor: pointer;
}

.story-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.story-card:hover .story-card-inner {
    transform: rotateY(180deg);
}

.story-card-front, .story-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.story-card-front {
    background: white;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.story-card-back {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    transform: rotateY(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.card-badge {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 5px;
}

.lang-badge {
    background: var(--primary-light);
    color: var(--text-dark);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.level-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.level-badge.pemula {
    background: #c8e6c9;
    color: #2e7d32;
}

.level-badge.menengah {
    background: #fff3e0;
    color: #f57c00;
}

.level-badge.lanjutan {
    background: #ffcdd2;
    color: #c62828;
}

.card-title {
    font-size: clamp(18px, 4vw, 22px);
    margin-bottom: 12px;
    color: var(--text-dark);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-preview {
    flex: 1;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(1, 87, 155, 0.1);
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 5px;
}

.back-content {
    padding: 20px;
}

.back-content h4 {
    margin-bottom: 12px;
    font-size: 16px;
}

.available-langs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-bottom: 20px;
}

.lang-chip {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.read-button {
    display: inline-block;
    padding: 10px 25px;
    background: white;
    color: var(--primary);
    text-decoration: none;
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.read-button:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* Detail Story Layout Responsif */
.story-detail {
    background: white;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    margin: 30px 0;
}

.story-header {
    background: linear-gradient(135deg, var(--primary-light), white);
    padding: clamp(20px, 4vw, 40px);
    border-bottom: 1px solid rgba(1, 87, 155, 0.1);
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.back-button:hover {
    color: var(--primary);
    transform: translateX(-5px);
}

.story-title h1 {
    font-size: clamp(24px, 5vw, 36px);
    margin-bottom: 12px;
    color: var(--text-dark);
    line-height: 1.2;
}

.story-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.story-meta span {
    font-size: 13px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.story-content {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 600px;
}

/* Language Sidebar Responsif */
.language-sidebar {
    background: var(--primary-light);
    padding: clamp(15px, 3vw, 30px);
    border-right: 1px solid rgba(1, 87, 155, 0.1);
}

.language-sidebar h3 {
    margin-bottom: 15px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.language-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lang-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: white;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    font-size: 13px;
}

.lang-item:hover {
    transform: translateX(5px);
    border-color: var(--primary);
}

.lang-item.active {
    background: var(--primary);
    color: white;
}

.lang-name {
    font-weight: 500;
}

.lang-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 12px;
    background: rgba(1, 87, 155, 0.1);
}

.lang-badge.ai {
    background: var(--primary);
    color: white;
}

/* Reading Area Responsif */
.reading-area {
    padding: clamp(20px, 4vw, 40px);
    background: white;
}

.reading-header {
    margin-bottom: 25px;
}

.reading-title {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary);
    flex-wrap: wrap;
}

.reading-title h2 {
    font-size: clamp(18px, 4vw, 24px);
    color: var(--text-dark);
}

.story-text {
    font-size: clamp(14px, 2.5vw, 18px);
    line-height: 1.8;
    color: var(--text-dark);
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    white-space: pre-wrap;
    padding-right: 10px;
}

.story-text::-webkit-scrollbar {
    width: 6px;
}

.story-text::-webkit-scrollbar-track {
    background: var(--primary-light);
    border-radius: 10px;
}

.story-text::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

/* Story Navigation Responsif */
.story-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 25px;
    border-top: 2px solid var(--primary-light);
    gap: 15px;
    flex-wrap: wrap;
}

.nav-prev, .nav-next {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-dark);
    padding: 12px 20px;
    background: var(--primary-light);
    border-radius: 30px;
    transition: all 0.3s ease;
    flex: 1;
    max-width: 300px;
}

.nav-prev:hover, .nav-next:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.nav-info {
    display: flex;
    flex-direction: column;
}

.nav-label {
    font-size: 11px;
    opacity: 0.7;
}

.nav-title {
    font-weight: 600;
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Pagination Responsif */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.page-link:hover, .page-link.active {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* Footer Responsif */
.footer {
    background: rgba(1, 87, 155, 0.1);
    backdrop-filter: blur(10px);
    margin-top: 60px;
    padding: 40px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: clamp(20px, 4vw, 40px);
    margin-bottom: 30px;
}

.footer-section h4 {
    margin-bottom: 15px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.footer-section ul li i {
    color: var(--primary);
}

.level-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.level-dot.pemula {
    background: #2e7d32;
}

.level-dot.menengah {
    background: #f57c00;
}

.level-dot.lanjutan {
    background: #c62828;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(1, 87, 155, 0.2);
    color: var(--text-muted);
    font-size: 13px;
}

.fa-heart {
    color: #ff4081;
}

/* Empty State Responsif */
.empty-state {
    text-align: center;
    padding: clamp(40px, 8vw, 80px) 20px;
    background: white;
    border-radius: var(--border-radius-lg);
    grid-column: 1 / -1;
}

.empty-state i {
    color: var(--primary-light);
    margin-bottom: 15px;
    font-size: clamp(2rem, 5vw, 3rem);
}

.empty-state h3 {
    font-size: clamp(18px, 4vw, 24px);
    margin-bottom: 8px;
    color: var(--text-dark);
}

.empty-state p {
    color: var(--text-muted);
    font-size: clamp(13px, 3vw, 14px);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
    .story-content {
        grid-template-columns: 240px 1fr;
    }
    
    .nav-links a span {
        display: none;
    }
    
    .nav-links a i {
        font-size: 18px;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
    }
    
    .nav-brand {
        justify-content: center;
    }
    
    .nav-search {
        max-width: 100%;
        width: 100%;
    }
    
    .nav-links {
        justify-content: center;
        width: 100%;
    }
    
    .nav-links a {
        padding: 8px 15px;
    }
    
    .nav-links a span {
        display: inline;
        font-size: 13px;
    }
    
    .hero h1 {
        font-size: 28px;
    }
    
    .hero-stats {
        gap: 20px;
    }
    
    .filter-form {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .btn-filter, .btn-reset {
        width: 100%;
        justify-content: center;
    }
    
    .story-content {
        grid-template-columns: 1fr;
    }
    
    .language-sidebar {
        border-right: none;
        border-bottom: 1px solid rgba(1, 87, 155, 0.1);
    }
    
    .language-list {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .lang-item {
        flex: 1;
        min-width: 140px;
    }
    
    .story-navigation {
        flex-direction: column;
    }
    
    .nav-prev, .nav-next {
        max-width: 100%;
    }
    
    .stories-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .story-card {
        height: 350px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-section h4 {
        justify-content: center;
    }
    
    .footer-section ul li {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }
    
    .hero {
        padding: 30px 12px 50px;
    }
    
    .hero h1 {
        font-size: 24px;
    }
    
    .hero p {
        font-size: 13px;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .stat {
        min-width: auto;
    }
    
    .filter-container {
        padding: 15px;
    }
    
    .stories-grid {
        grid-template-columns: 1fr;
    }
    
    .story-card {
        height: 320px;
    }
    
    .story-title h1 {
        font-size: 22px;
    }
    
    .story-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .story-meta span {
        width: 100%;
    }
    
    .reading-area {
        padding: 15px;
    }
    
    .story-text {
        max-height: 400px;
    }
    
    .language-list {
        flex-direction: column;
    }
    
    .lang-item {
        width: 100%;
    }
    
    .pagination {
        gap: 5px;
    }
    
    .page-link {
        width: 35px;
        height: 35px;
        font-size: 12px;
    }
    
    .footer {
        padding: 30px 0 15px;
    }
    
    .footer-section ul li {
        font-size: 12px;
    }
}

/* Touch Device Optimization */
@media (hover: none) and (pointer: coarse) {
    .story-card:hover .story-card-inner {
        transform: none;
    }
    
    .story-card.active .story-card-inner {
        transform: rotateY(180deg);
    }
    
    .btn-filter:hover, .btn-reset:hover, .read-button:hover {
        transform: none;
    }
    
    .nav-links a, .btn-filter, .btn-reset, .read-button {
        padding: 12px 15px;
    }
}

/* Print Styles */
@media print {
    .navbar, .hero, .filter-section, .footer, .story-navigation, .language-sidebar {
        display: none;
    }
    
    .story-detail {
        box-shadow: none;
    }
    
    .story-content {
        display: block;
    }
    
    .reading-area {
        padding: 20px;
    }
}