/* =============================================
   J's Plane Story - Aircraft Encyclopedia
   Main Stylesheet
   ============================================= */

/* === VARIABLES === */
:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #4a9eff;
    --accent: #ff6b35;
    --accent-dark: #e55a2b;
    --danger: #dc3545;
    --success: #28a745;
    --bg-dark: #0a0e17;
    --bg-card: #111827;
    --bg-surface: #1f2937;
    --bg-elevated: #283347;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --border-light: #475569;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 48px rgba(0,0,0,0.5);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Orbitron', sans-serif;
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-main);
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
}

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

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

::selection { background: var(--primary); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* === CONTAINER === */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* === HERO SECTION === */
.hero {
    position: relative;
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    background-color: #0c1929;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('../images/f22-hero.jpg') center center / cover no-repeat;
    z-index: 0;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(10, 14, 23, 0.5) 0%,
        rgba(10, 14, 23, 0.3) 40%,
        rgba(10, 14, 23, 0.7) 80%,
        rgba(10, 14, 23, 1) 100%
    );
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    padding: 0 24px;
    animation: fadeInUp 1s ease-out;
}

.hero-subtitle {
    font-family: var(--font-display);
    font-size: 0.9rem;
    letter-spacing: 6px;
    text-transform: uppercase;
    color: var(--primary-light);
    margin-bottom: 16px;
}

.hero-subtitle i { margin-right: 8px; }

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 900;
    letter-spacing: 4px;
    line-height: 1.1;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #fff 0%, #a0c4ff 50%, #60a5fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
}

.hero-desc {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-weight: 300;
}

.hero-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.hero-scroll {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    color: var(--text-muted);
    font-size: 1.5rem;
    animation: bounce 2s infinite;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn i { font-size: 0.9em; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(26, 115, 232, 0.3);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(26, 115, 232, 0.4);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--border-light);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: #c82333; }

.btn-accent {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: #fff;
}
.btn-accent:hover { transform: translateY(-2px); }

.btn-sm { padding: 8px 16px; font-size: 0.85rem; }

/* === NAVIGATION === */
.main-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.main-nav.scrolled {
    background: rgba(10, 14, 23, 0.95);
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 1px;
}
.nav-logo:hover { color: var(--primary-light); }
.nav-logo i { color: var(--primary-light); font-size: 1.1rem; }

.nav-links { display: flex; gap: 8px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}
.nav-link:hover, .nav-link.active {
    color: var(--primary-light);
    background: rgba(26, 115, 232, 0.1);
}

.nav-mobile-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu {
    display: none;
    flex-direction: column;
    padding: 8px 24px 16px;
    border-top: 1px solid var(--border);
}
.mobile-menu.open { display: flex; }

.mobile-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-weight: 500;
}
.mobile-menu a:hover { color: var(--primary-light); background: rgba(26,115,232,0.1); }

/* === SECTION === */
.section {
    padding: 80px 0;
    min-height: 60vh;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 40px;
}

.section-header h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.section-header h2 i { color: var(--primary-light); }

/* === FILTER BAR === */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; }

.filter-btn {
    padding: 8px 20px;
    border: 1px solid var(--border);
    border-radius: 50px;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary-light); }
.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* === ARTICLES GRID === */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

.article-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    animation: fadeInUp 0.5s ease-out;
}
.article-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 12px 40px rgba(26, 115, 232, 0.15);
}

.article-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
}
.article-card-image img { width: 100%; height: 100%; object-fit: cover; }
.article-card-image .placeholder-icon {
    font-size: 3rem;
    color: var(--text-muted);
}

.article-card-body { padding: 20px; }

.article-card-category {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(26, 115, 232, 0.15);
    color: var(--primary-light);
    margin-bottom: 10px;
}

.article-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card-excerpt {
    font-size: 0.88rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 16px;
}

.article-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.article-card-footer i { margin-right: 4px; }

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 4rem; margin-bottom: 20px; opacity: 0.3; }
.empty-state h3 { font-size: 1.3rem; color: var(--text-secondary); margin-bottom: 10px; }
.empty-state p { margin-bottom: 30px; }

/* === MODAL === */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
}
.modal-overlay.open { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease-out;
}

.modal-view { max-width: 900px; }
.modal-editor { max-width: 960px; }
.modal-table-maker { max-width: 1000px; }
.modal-saved-tables { max-width: 800px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}
.modal-header-left { display: flex; flex-direction: column; gap: 8px; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-surface); }

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px 28px;
    border-top: 1px solid var(--border);
}

/* === ARTICLE VIEW === */
.article-category-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(26, 115, 232, 0.15);
    color: var(--primary-light);
}

.article-meta {
    padding: 16px 28px;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
}
.article-meta i { margin-right: 6px; }

.article-body {
    padding: 32px 28px;
    line-height: 1.9;
    font-size: 1rem;
}
.article-body h2 { font-size: 1.5rem; margin: 32px 0 16px; padding-bottom: 8px; border-bottom: 2px solid var(--border); color: var(--primary-light); }
.article-body h3 { font-size: 1.25rem; margin: 24px 0 12px; color: var(--text-primary); }
.article-body h4 { font-size: 1.1rem; margin: 20px 0 10px; color: var(--text-secondary); }
.article-body p { margin-bottom: 16px; }
.article-body ul, .article-body ol { margin: 16px 0; padding-left: 28px; }
.article-body li { margin-bottom: 6px; }
.article-body blockquote {
    border-left: 4px solid var(--primary);
    padding: 16px 20px;
    margin: 20px 0;
    background: rgba(26, 115, 232, 0.05);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
    font-style: italic;
}
.article-body img { border-radius: var(--radius-sm); margin: 20px 0; box-shadow: var(--shadow); }
.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.9rem;
}
.article-body table th {
    background: var(--bg-surface);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    border: 1px solid var(--border);
    color: var(--primary-light);
}
.article-body table td {
    padding: 10px 16px;
    border: 1px solid var(--border);
}
.article-body table tr:hover td { background: rgba(26, 115, 232, 0.03); }
.article-body hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 32px 0;
}

.article-tags {
    padding: 16px 28px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.article-tags .tag {
    padding: 4px 14px;
    border-radius: 50px;
    background: var(--bg-surface);
    font-size: 0.8rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* === EDITOR FORM === */
.editor-form { padding: 24px 28px; }

.form-row { display: flex; gap: 16px; }
.form-row .flex-1 { flex: 1; }
.form-row .flex-2 { flex: 2; }

.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.form-group label i { margin-right: 6px; color: var(--primary-light); }

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}
.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.form-group select { cursor: pointer; }

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* === TOOLBAR === */
.toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 10px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.toolbar button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: var(--font-main);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}
.toolbar button:hover {
    background: var(--bg-elevated);
    color: var(--primary-light);
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
}

/* === EDITOR CONTENT === */
.editor-content {
    min-height: 350px;
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    background: var(--bg-dark);
    font-size: 0.95rem;
    line-height: 1.8;
    outline: none;
    color: var(--text-primary);
}
.editor-content:focus { border-color: var(--primary); }

.editor-content[placeholder]:empty::before {
    content: attr(placeholder);
    color: var(--text-muted);
    font-style: italic;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 8px;
}

/* === TABLE MAKER === */
.table-maker-form { padding: 24px 28px; }

.size-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}
.size-inputs input {
    width: 70px;
    padding: 12px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.95rem;
    outline: none;
}
.size-inputs input:focus { border-color: var(--primary); }
.size-inputs span { color: var(--text-muted); font-weight: 600; }

.table-preview-wrapper {
    margin: 20px 0;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-dark);
}

.table-preview { min-height: 150px; }
.table-preview table {
    width: 100%;
    border-collapse: collapse;
}
.table-preview th, .table-preview td {
    border: 1px solid var(--border);
    padding: 10px 14px;
    min-width: 100px;
}
.table-preview th {
    background: var(--bg-surface);
    color: var(--primary-light);
    font-weight: 600;
}
.table-preview td { background: var(--bg-card); }

.table-preview input {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.9rem;
    outline: none;
    padding: 4px;
}
.table-preview input::placeholder { color: var(--text-muted); }

.table-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    gap: 8px;
}
.table-placeholder i { font-size: 2rem; opacity: 0.3; }

.table-maker-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* === SAVED TABLES === */
.saved-tables-list { padding: 24px 28px; }

.saved-table-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    transition: var(--transition);
}
.saved-table-item:hover { border-color: var(--primary); background: rgba(26,115,232,0.05); }
.saved-table-item-info h4 { font-size: 1rem; margin-bottom: 4px; }
.saved-table-item-info p { font-size: 0.8rem; color: var(--text-muted); }
.saved-table-item-actions { display: flex; gap: 8px; }

/* === TOAST === */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 22px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    font-size: 0.9rem;
    animation: slideInRight 0.3s ease-out;
    min-width: 280px;
}
.toast.success { border-color: var(--success); }
.toast.success i { color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.error i { color: var(--danger); }
.toast.info { border-color: var(--primary); }
.toast.info i { color: var(--primary-light); }

/* === FOOTER === */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 40px 0;
    background: var(--bg-card);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-brand h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    letter-spacing: 2px;
    margin-bottom: 4px;
}
.footer-brand h3 i { color: var(--primary-light); margin-right: 8px; }
.footer-brand p { font-size: 0.85rem; color: var(--text-muted); }
.footer-info p { font-size: 0.8rem; color: var(--text-muted); }

.footer-note {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
}
.footer-note p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}
.footer-contact {
    margin-top: 8px;
    font-style: normal !important;
}
.footer-contact a {
    color: var(--primary-light);
    text-decoration: underline;
    transition: var(--transition);
}
.footer-contact a:hover {
    color: #fff;
}

/* === ANIMATIONS === */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(60px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(-12px); }
    60% { transform: translateX(-50%) translateY(-6px); }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .nav-mobile-btn { display: block; }

    .hero { background-attachment: scroll; min-height: 500px; }

    .section { padding: 60px 0; }
    .section-header { flex-direction: column; align-items: flex-start; }

    .articles-grid { grid-template-columns: 1fr; }

    .form-row { flex-direction: column; gap: 0; }

    .modal { margin: 0; border-radius: var(--radius-sm); }
    .modal-overlay { padding: 20px 12px; }

    .editor-form { padding: 16px; }
    .modal-header { padding: 16px; }
    .modal-footer { padding: 16px; }
    .article-body { padding: 20px 16px; }
    .article-meta { padding: 12px 16px; }
    .article-tags { padding: 12px 16px; }
    .table-maker-form { padding: 16px; }

    .toolbar { gap: 2px; padding: 8px; }
    .toolbar button { width: 30px; height: 30px; }

    .filter-bar { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 8px; }

    .table-maker-actions { flex-direction: column; }
    .table-maker-actions .btn { width: 100%; justify-content: center; }

    .footer-content { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
    .hero-title { letter-spacing: 1px; }
    .hero-subtitle { font-size: 0.75rem; letter-spacing: 3px; }
    .hero-actions { flex-direction: column; }
    .hero-actions .btn { width: 100%; justify-content: center; }
}
