/* ============================================
   Zhongwen Pro - Main Stylesheet
   ============================================ */

/* Skip Link Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #E53935;
    color: white;
    padding: 8px 16px;
    z-index: 100;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

:root {
    --zw-red: #E53935;
    --zw-red-dark: #C62828;
    --zw-gold: #FFC107;
    --zw-dark: #1a1a2e;
    --zw-gray: #6c757d;
    --zw-light: #f8f9fa;
    --zw-border: #e9ecef;
    --zw-radius: 12px;
    --zw-shadow: 0 2px 8px rgba(0,0,0,0.08);
    --zw-shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --zw-transition: all 0.3s ease;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
    font-family: var(--font-sans);
    line-height: 1.6;
    color: #333;
    background: #fff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}
a { color: var(--zw-red); transition: var(--zw-transition); }
a:hover { color: var(--zw-red-dark); }
img { max-width: 100%; height: auto; }

.site-header {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.95);
    border-bottom: 1px solid var(--zw-border);
}
.navbar-brand { font-size: 1.4rem; font-weight: 700; color: var(--zw-dark); }
.brand-text strong { color: var(--zw-red); }
.navbar-nav .nav-link { color: #555; font-weight: 500; }
.navbar-nav .nav-link:hover, .navbar-nav .nav-link.active { color: var(--zw-red); }

/* Dropdown menu z-index fix */
.dropdown-menu {
    z-index: 2000 !important;
}

/* Sticky sidebar z-index fix */
.sticky-top {
    z-index: 1000;
}

.main-content { padding: 20px 0; min-height: calc(100vh - 180px); }

.card { border-radius: var(--zw-radius); box-shadow: var(--zw-shadow); }
.card-header { background: #fff; border-bottom: 1px solid var(--zw-border); }

/* Hover effects */
.hover-bg-light:hover { background-color: var(--zw-light) !important; }

.breadcrumb { background: none; padding: 0.75rem 0; margin: 0; }
.breadcrumb-item + .breadcrumb-item::before { content: "/"; color: #999; }

.site-footer { background: #1a1a2e; color: #ffffff; padding: 40px 0 20px; }
.site-footer a { color: #d4d4d4; }
.site-footer a:hover { color: #ffffff; }
.site-footer p, .site-footer li { color: #d4d4d4; }
.site-footer .text-muted { color: #a0a0a0 !important; }
.site-footer h6 { color: #ffffff; }
.site-footer hr { border-color: #333333; }

.btn-danger { background: var(--zw-red); border-color: var(--zw-red); }
.btn-danger:hover { background: var(--zw-red-dark); border-color: var(--zw-red-dark); }

.badge { font-weight: 500; }

.pagination .page-link { color: var(--zw-red); }
.pagination .page-item.active .page-link { background: var(--zw-red); border-color: var(--zw-red); }

.form-control:focus { border-color: var(--zw-red); box-shadow: 0 0 0 0.2rem rgba(229,57,53,0.15); }

@media (max-width: 991.98px) {
    body { padding-bottom: 70px; }
}

/* === Vocabulary Flashcard Styles === */
.flashcard-container {
    perspective: 1000px;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flashcard {
    width: 100%;
    max-width: 420px;
    height: 280px;
    position: relative;
    transform-style: preserve-3d;
    cursor: pointer;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.flashcard-front {
    background: linear-gradient(135deg, #fff5f5 0%, #fff0f0 100%);
    border: 2px solid rgba(229,57,53,0.1);
}

.flashcard-back {
    background: #fff;
    border: 2px solid #e9ecef;
    transform: rotateY(180deg);
}

.chinese-char {
    font-size: 4.5rem;
    font-weight: 700;
    color: #1a1a2e;
}

.pinyin-display {
    font-size: 1.8rem;
    color: #E53935;
    font-weight: 600;
}

.meaning-display {
    font-size: 1.4rem;
    color: #333;
}

.btn-rating {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    border: 2px solid #e9ecef;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-rating:hover {
    border-color: #E53935;
    background: #fff5f5;
    transform: scale(1.05);
}

@media (max-width: 767px) {
    .flashcard { height: 240px; }
    .chinese-char { font-size: 3.5rem; }
}