/**
 * CNAT - Cẩm Nang Ẩm Thực TP.HCM 2025
 * Main Stylesheet
 */

/* ========== CSS Variables ========== */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --vibrant-gradient: linear-gradient(135deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3);
    --sunset-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --ocean-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #ff6b6b;
    --success-color: #00c853;
    --warning-color: #ffc107;
    --danger-color: #ff5252;
    --info-color: #00bcd4;
    
    --text-dark: #2d3436;
    --text-light: #636e72;
    --text-muted: #b2bec3;
    
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --bg-gradient: linear-gradient(180deg, #ffecd2 0%, #fcb69f 100%);
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 50px rgba(0,0,0,0.15);
    
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;
    --border-radius-xl: 30px;
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ========== Reset & Base ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--bg-light);
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--secondary-color);
}

img {
    max-width: 100%;
    height: auto;
}

/* ========== Layout ========== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 40px 0;
}

/* ========== Header ========== */
.header {
    background: var(--bg-white);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo img {
    height: 50px;
    width: auto;
    border-radius: var(--border-radius-sm);
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-link {
    color: var(--text-dark);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

.nav-link:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

/* Language Selector */
.language-selector {
    position: relative;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-light);
    border: none;
    border-radius: var(--border-radius-xl);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition-fast);
}

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

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-white);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition-fast);
    z-index: 100;
}

.language-selector:hover .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-dark);
    transition: var(--transition-fast);
}

.lang-option:hover {
    background: var(--bg-light);
}

.lang-option.active {
    background: var(--primary-gradient);
    color: white;
}

.lang-flag {
    font-size: 20px;
}

/* ========== Hero Section ========== */
.hero {
    background: var(--vibrant-gradient);
    padding: 80px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    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"><circle cx="50" cy="50" r="2" fill="rgba(255,255,255,0.1)"/></svg>');
    background-size: 30px 30px;
    animation: float 20s linear infinite;
}

@keyframes float {
    0% { background-position: 0 0; }
    100% { background-position: 100px 100px; }
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 3rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    margin-bottom: 15px;
}

.hero .subtitle {
    font-size: 1.5rem;
    color: rgba(255,255,255,0.95);
    margin-bottom: 30px;
}

.hero-badge {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    padding: 10px 30px;
    border-radius: var(--border-radius-xl);
    color: white;
    font-weight: 600;
    margin-bottom: 30px;
}

/* ========== Cards ========== */
.card {
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition-normal);
}

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

.card-header {
    padding: 25px 30px;
    background: var(--primary-gradient);
    color: white;
}

.card-header h2 {
    font-size: 1.5rem;
    margin: 0;
}

.card-body {
    padding: 30px;
}

/* ========== Forms ========== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius-md);
    transition: var(--transition-fast);
    background: var(--bg-white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%23636e72" d="M6 8L1 3h10z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

.form-text {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 6px;
}

.form-error {
    color: var(--danger-color);
    font-size: 13px;
    margin-top: 6px;
}

/* Radio & Checkbox */
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.form-check-input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
}

.form-check-label {
    cursor: pointer;
}

/* Gender Radio Group */
.gender-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.gender-option {
    flex: 1;
    min-width: 100px;
}

.gender-option input {
    display: none;
}

.gender-option label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-light);
    border: 2px solid transparent;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    font-weight: 500;
}

.gender-option input:checked + label {
    background: var(--primary-gradient);
    color: white;
    border-color: var(--primary-color);
}

.gender-option label:hover {
    border-color: var(--primary-color);
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius-xl);
    cursor: pointer;
    transition: var(--transition-normal);
    text-decoration: none;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: white;
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-success {
    background: linear-gradient(135deg, #11998e, #38ef7d);
    color: white;
}

.btn-lg {
    padding: 18px 40px;
    font-size: 18px;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========== Alerts ========== */
.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid var(--success-color);
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid var(--info-color);
}

.alert-icon {
    font-size: 20px;
}

/* ========== Features Grid ========== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-top: 40px;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius-md);
    color: white;
}

.feature-icon {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.feature-text h4 {
    font-size: 1rem;
    margin-bottom: 5px;
}

.feature-text p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* ========== Footer ========== */
.footer {
    background: var(--text-dark);
    color: rgba(255,255,255,0.7);
    padding: 30px 0;
    text-align: center;
}

.footer a {
    color: rgba(255,255,255,0.9);
}

/* ========== Register Page ========== */
.register-page {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.register-card {
    width: 100%;
    max-width: 500px;
}

/* ========== Verification Page ========== */
.verify-page {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.verify-card {
    width: 100%;
    max-width: 450px;
    text-align: center;
}

.verify-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.verify-icon.success {
    color: var(--success-color);
}

.verify-icon.error {
    color: var(--danger-color);
}

/* ========== PDF Viewer ========== */
.viewer-page {
    background: #1a1a2e;
    min-height: 100vh;
}

.viewer-header {
    background: rgba(0,0,0,0.3);
    padding: 15px 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.viewer-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.viewer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.viewer-logo img {
    height: 40px;
    border-radius: 6px;
}

.viewer-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.viewer-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 10px 15px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

.viewer-btn:hover {
    background: rgba(255,255,255,0.2);
}

.page-info {
    color: white;
    font-size: 14px;
    background: rgba(255,255,255,0.1);
    padding: 8px 15px;
    border-radius: var(--border-radius-xl);
}

/* Flipbook Container */
.flipbook-container {
    padding-top: 80px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#flipbook {
    width: 90vw;
    max-width: 1200px;
    height: 80vh;
}

.flipbook-page {
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flipbook-page canvas {
    max-width: 100%;
    max-height: 100%;
}

/* Navigation Arrows */
.nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    transition: var(--transition-fast);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-arrow:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-50%) scale(1.1);
}

.nav-arrow.prev {
    left: 20px;
}

.nav-arrow.next {
    right: 20px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 46, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: white;
    margin-top: 20px;
    font-size: 18px;
}

.loading-progress {
    width: 200px;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    margin-top: 15px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    width: 0%;
    transition: width 0.3s;
}

/* ========== Mobile Menu ========== */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero .subtitle {
        font-size: 1.1rem;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-white);
        flex-direction: column;
        padding: 20px;
        box-shadow: var(--shadow-lg);
        gap: 10px;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .gender-group {
        flex-direction: column;
    }
    
    .viewer-controls {
        gap: 8px;
    }
    
    .viewer-btn span {
        display: none;
    }
    
    .nav-arrow {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .nav-arrow.prev {
        left: 10px;
    }
    
    .nav-arrow.next {
        right: 10px;
    }
    
    #flipbook {
        width: 95vw;
        height: 70vh;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 50px 0;
    }
    
    .hero h1 {
        font-size: 1.6rem;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .btn-lg {
        padding: 14px 30px;
        font-size: 16px;
    }
}

/* ========== Utility Classes ========== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mt-4 { margin-top: 40px; }

.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }
.mb-4 { margin-bottom: 40px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

.hidden { display: none !important; }
.visible { display: block !important; }
