/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif; color: #333; line-height: 1.6; background: #fff; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ===== Public Layout ===== */
.public-site { min-height: 100vh; display: flex; flex-direction: column; }
.site-content { flex: 1; max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; width: 100%; }

/* Header */
.site-header { background: #1a1a2e; color: #fff; padding: 0 1.5rem; }
.header-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; height: 70px; }
.logo-img { height: 40px; }
.main-nav { display: flex; gap: 1.5rem; align-items: center; }
.main-nav a, .nav-link { color: #cbd5e1; font-size: 0.95rem; font-weight: 500; transition: color 0.2s; }
.main-nav a:hover { color: #fff; text-decoration: none; }
.nav-dropdown { position: relative; }
.nav-dropdown > a { color: #cbd5e1; }
.dropdown-content { display: none; position: absolute; top: 100%; left: 0; background: #1a1a2e; border: 1px solid #334155; border-radius: 6px; min-width: 200px; padding: 0.5rem 0; z-index: 100; }
.dropdown-content a { display: block; padding: 0.5rem 1rem; color: #cbd5e1; }
.dropdown-content a:hover { background: #334155; color: #fff; }
.nav-dropdown:hover .dropdown-content { display: block; }

/* Footer */
.site-footer { background: #1a1a2e; color: #94a3b8; padding: 2rem 1.5rem; margin-top: auto; }
.footer-inner { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.footer-links a, .footer-social a { color: #94a3b8; margin: 0 0.75rem; font-size: 0.9rem; }
.footer-links a:hover, .footer-social a:hover { color: #fff; }

/* ===== Admin Layout ===== */
.admin-wrapper { min-height: 100vh; display: flex; flex-direction: column; }
.admin-header { background: #1a1a2e; color: #fff; padding: 0 1.5rem; height: 56px; display: flex; align-items: center; }
.admin-header-inner { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.admin-brand { font-size: 1.1rem; font-weight: 700; color: #7eb3ff; }
.admin-header-right { display: flex; align-items: center; gap: 1rem; }
.admin-user { color: #94a3b8; font-size: 0.9rem; }
.btn-logout { background: transparent; border: 1px solid #475569; color: #94a3b8; padding: 0.3rem 0.75rem; border-radius: 4px; cursor: pointer; font-size: 0.85rem; }
.btn-logout:hover { background: #334155; color: #fff; }

.admin-body { display: flex; flex: 1; }
.admin-sidebar { width: 220px; background: #0f172a; padding: 1rem 0; flex-shrink: 0; }
.sidebar-link { display: block; padding: 0.6rem 1.25rem; color: #94a3b8; font-size: 0.9rem; }
.sidebar-link:hover { background: #1e293b; color: #fff; text-decoration: none; }
.admin-sidebar hr { border: none; border-top: 1px solid #1e293b; margin: 0.5rem 0; }
.admin-content { flex: 1; padding: 1.5rem 2rem; background: #f8fafc; overflow-y: auto; }

/* ===== Common Components ===== */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; color: #1e293b; }

.btn-primary { background: #2563eb; color: #fff; border: none; padding: 0.5rem 1.25rem; border-radius: 6px; cursor: pointer; font-size: 0.9rem; font-weight: 500; text-decoration: none; display: inline-block; }
.btn-primary:hover { background: #1d4ed8; text-decoration: none; }
.btn-secondary { background: #e2e8f0; color: #475569; border: none; padding: 0.5rem 1.25rem; border-radius: 6px; cursor: pointer; font-size: 0.9rem; text-decoration: none; display: inline-block; }
.btn-secondary:hover { background: #cbd5e1; text-decoration: none; }
.btn-small { background: #e2e8f0; color: #475569; border: none; padding: 0.25rem 0.6rem; border-radius: 4px; cursor: pointer; font-size: 0.8rem; text-decoration: none; }
.btn-small:hover { background: #cbd5e1; }
.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }
.btn-active { background: #dcfce7; color: #16a34a; }
.btn-inactive { background: #f1f5f9; color: #94a3b8; }

/* Tables */
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.admin-table th { background: #f1f5f9; text-align: left; padding: 0.75rem 1rem; font-size: 0.85rem; color: #475569; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.admin-table td { padding: 0.75rem 1rem; border-top: 1px solid #f1f5f9; font-size: 0.9rem; }
.admin-table tr:hover { background: #f8fafc; }
.admin-table code { background: #f1f5f9; padding: 0.15rem 0.4rem; border-radius: 3px; font-size: 0.85rem; }
.status-published { color: #16a34a; font-weight: 500; }
.status-draft { color: #94a3b8; }
.quote-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Forms */
.edit-form { background: #fff; padding: 1.5rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: #475569; margin-bottom: 0.3rem; }
.form-group input[type="text"], .form-group input[type="number"], .form-group textarea, .form-group select {
    width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.9rem; font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.flex-2 { flex: 2 !important; }
.flex-1 { flex: 1 !important; }
.form-actions { justify-content: space-between; align-items: center; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #e2e8f0; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; cursor: pointer; }
.code-editor { font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace; font-size: 0.85rem; line-height: 1.5; tab-size: 2; }
.form-message { padding: 0.75rem 1rem; border-radius: 6px; margin-top: 1rem; font-size: 0.9rem; }
.form-message.success { background: #dcfce7; color: #16a34a; }
.form-message.error { background: #fee2e2; color: #dc2626; }

/* Filter */
.filter-bar { display: flex; gap: 0.75rem; margin-bottom: 1rem; align-items: center; }
.filter-bar select { padding: 0.4rem 0.75rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.9rem; }

/* Media */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.media-card { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.media-thumb { width: 100%; height: 150px; object-fit: cover; }
.media-icon { width: 100%; height: 150px; display: flex; align-items: center; justify-content: center; background: #f1f5f9; font-size: 3rem; }
.media-info { padding: 0.5rem 0.75rem; }
.media-filename { display: block; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-date { font-size: 0.8rem; color: #94a3b8; }
.media-actions { padding: 0.5rem 0.75rem; display: flex; gap: 0.5rem; border-top: 1px solid #f1f5f9; }

/* Upload */
.upload-form { background: #fff; padding: 1.5rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); max-width: 600px; }

/* Import */
.import-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.import-card { background: #fff; padding: 1.25rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.import-card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.import-card p { font-size: 0.9rem; color: #64748b; margin-bottom: 1rem; }
.import-result { background: #f1f5f9; padding: 1rem; border-radius: 6px; margin-bottom: 0.5rem; }
.import-result pre { font-size: 0.85rem; white-space: pre-wrap; }

/* Dashboard */
.dashboard-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: #fff; padding: 1.25rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); text-align: center; }
.stat-card h3 { font-size: 2rem; color: #2563eb; }
.stat-card p { color: #64748b; font-size: 0.9rem; }

/* Login */
.login-container { display: flex; justify-content: center; align-items: center; min-height: 60vh; }
.login-box { background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); width: 100%; max-width: 400px; }
.login-box h2 { margin-bottom: 1.5rem; text-align: center; }
.login-error { background: #fee2e2; color: #dc2626; padding: 0.75rem; border-radius: 6px; margin-bottom: 1rem; text-align: center; font-size: 0.9rem; }
.login-box .form-group { margin-bottom: 1rem; }
.login-box .btn-primary { width: 100%; padding: 0.75rem; font-size: 1rem; }

/* 404 */
.not-found { text-align: center; padding: 4rem 1rem; }
.not-found h1 { font-size: 4rem; color: #e2e8f0; }
.not-found p { color: #64748b; margin: 1rem 0; }

/* Hero fallback */
.hero { text-align: center; padding: 4rem 1rem; }
.hero h1 { font-size: 2.5rem; color: #1a1a2e; }
.hero p { font-size: 1.2rem; color: #64748b; margin-top: 1rem; }

.empty-state { text-align: center; color: #94a3b8; padding: 2rem; }
