/* ============================================
   NewsApp — Modern News Website Styles
   Palette: #0d1b2a (dark navy), #e63946 (red accent),
            #f1faee (cream), #ffffff, #1d3557 (navy)
   Fonts: Playfair Display (headlines), Inter (body)
   ============================================ */

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #212529;
  background: #f1faee;
  line-height: 1.6;
  font-size: 15px;
}

a { color: #1d3557; text-decoration: none; transition: color 0.2s; }
a:hover { color: #e63946; }

/* --- Top Bar (date + ticker) --- */
.top-bar {
  background: #0d1b2a;
  color: #a8dadc;
  font-size: 0.75rem;
  padding: 0.35rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: 0.3px;
}
.top-bar a { color: #a8dadc; }
.top-bar a:hover { color: #fff; }

/* --- Main Navbar --- */
.site-navbar {
  background: #1d3557;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-brand {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}
.nav-brand:hover { color: #e63946; }
.nav-brand .accent { color: #e63946; }

.nav-links { display: flex; gap: 0.25rem; }
.nav-links a {
  font-size: 0.82rem;
  font-weight: 500;
  color: #a8dadc;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.nav-links a:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  color: #a8dadc;
}
.nav-right b { color: #fff; }
.nav-right a { color: #a8dadc; }
.nav-right a:hover { color: #fff; }

.nav-right .btn-logout {
  color: #e63946;
  font-weight: 600;
  font-size: 0.8rem;
}
.nav-right .btn-logout:hover { color: #ff6b6b; }

/* --- Container --- */
.page-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem;
  min-height: calc(100vh - 56px - 50px - 28px);
}

/* --- Notification Messages --- */
ul#messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem 0;
}
ul#messages li {
  display: block;
  max-width: 700px;
  margin: 0.5rem auto;
  text-align: center;
  padding: 0.7rem 1rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
}
ul#messages li.info {
  background: #d1fae5;
  color: #065f46;
  border-left: 4px solid #10b981;
}
ul#messages li.error {
  background: #fee2e2;
  color: #991b1b;
  border-left: 4px solid #e63946;
}

/* --- Section Headers --- */
.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #e63946;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid #e63946;
  display: inline-block;
}

/* --- Home Page Layout --- */
.home-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .home-layout { grid-template-columns: 1fr; }
}

/* --- Hero Article (first post on home) --- */
.hero-article {
  background: #fff;
  border-bottom: 3px solid #e63946;
  margin-bottom: 1.5rem;
  padding: 0;
  overflow: hidden;
}
.hero-article .hero-body {
  padding: 1.5rem 1.75rem;
}
.hero-article .post-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.5rem 0;
}
.hero-article .post-title a { color: #0d1b2a; }
.hero-article .post-title a:hover { color: #e63946; }
.hero-article .post-body {
  font-size: 0.95rem;
  color: #495057;
  max-height: 100px;
  overflow: hidden;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* --- News Cards (grid articles) --- */
.news-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 600px) {
  .news-grid { grid-template-columns: 1fr; }
}

.news-card {
  background: #fff;
  border-bottom: 2px solid #e63946;
  padding: 1rem 1.25rem;
  transition: box-shadow 0.2s;
}
.news-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.news-card .post-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 0.3rem 0;
}
.news-card .post-title a { color: #0d1b2a; }
.news-card .post-title a:hover { color: #e63946; }

.post-meta {
  font-size: 0.72rem;
  color: #868e96;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.news-card .post-body {
  max-height: 60px;
  overflow: hidden;
  font-size: 0.85rem;
  color: #495057;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.read-more {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #e63946;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.read-more:hover { text-decoration: underline; }

/* --- Sidebar --- */
.sidebar {
  background: #fff;
  border-top: 3px solid #1d3557;
  padding: 1.25rem 1.25rem;
}

.sidebar h3 {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #e63946;
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #dee2e6;
}

.sidebar .sidebar-item {
  display: flex;
  padding: 0.6rem 0;
  border-bottom: 1px solid #f1f3f5;
}
.sidebar .sidebar-item:last-child { border-bottom: none; }

.sidebar .sidebar-num {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: #e63946;
  min-width: 2rem;
  line-height: 1;
  margin-right: 0.75rem;
  margin-top: 2px;
}

.sidebar .sidebar-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0d1b2a;
  line-height: 1.3;
}
.sidebar .sidebar-link:hover { color: #e63946; }

/* --- Post View (single article) --- */
.post-view {
  max-width: 760px;
  margin: 0 auto;
  background: #fff;
  padding: 2.5rem 3rem;
  border-top: 4px solid #e63946;
}

.post-view .post-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.6rem 0;
  color: #0d1b2a;
}

.post-view .post-meta {
  font-size: 0.8rem;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #dee2e6;
}

.post-view .post-body {
  font-size: 1.05rem;
  line-height: 1.85;
  color: #343a40;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* --- Responsive Images --- */
.post-body img,
.news-card img,
.hero-article img,
article img,
main img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem 0;
}

/* --- Form Cards --- */
.form-card {
  max-width: 480px;
  margin: 2rem auto;
  background: #fff;
  border-top: 4px solid #e63946;
  padding: 2rem 2.5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.form-card h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 1.5rem 0;
  color: #0d1b2a;
}

.form-card label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #495057;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-card .form-control {
  border-radius: 3px;
  border: 1px solid #dee2e6;
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  transition: border-color 0.2s;
}
.form-card .form-control:focus {
  border-color: #1d3557;
  box-shadow: 0 0 0 3px rgba(29,53,87,0.1);
}

/* --- Buttons --- */
.btn-primary {
  background: #e63946;
  border-color: #e63946;
  border-radius: 3px;
  font-weight: 600;
  padding: 0.55rem 1.5rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s;
}
.btn-primary:hover, .btn-primary:focus {
  background: #c62828;
  border-color: #c62828;
}

.btn-secondary {
  border-radius: 3px;
  font-weight: 500;
  font-size: 0.85rem;
}

.btn-danger {
  border-radius: 3px;
  font-weight: 600;
}

/* --- Tables --- */
.clean-table {
  background: #fff;
  border-top: 3px solid #1d3557;
  padding: 1.25rem;
}

.clean-table .table { margin-bottom: 0; }

.clean-table .table thead th {
  border-top: none;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #1d3557;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #1d3557;
}

.clean-table .table td {
  vertical-align: middle;
  font-size: 0.88rem;
  padding: 0.7rem;
  border-color: #f1f3f5;
}

/* --- Pagination --- */
.pagination .page-link {
  border-radius: 0;
  margin: 0 1px;
  font-size: 0.8rem;
  color: #1d3557;
  border-color: #dee2e6;
}
.pagination .page-item.active .page-link {
  background: #1d3557;
  border-color: #1d3557;
}

/* --- Search Bar --- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.search-bar .form-control {
  border-radius: 3px;
  border: 1px solid #dee2e6;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  max-width: 350px;
}

/* --- Footer --- */
.site-footer {
  background: #0d1b2a;
  color: #a8dadc;
  text-align: center;
  padding: 1.25rem 2rem;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}
.site-footer a { color: #a8dadc; }
.site-footer a:hover { color: #fff; }

/* --- Error Pages --- */
.error-page {
  text-align: center;
  padding: 4rem 2rem;
  background: #fff;
  border-top: 4px solid #e63946;
  max-width: 500px;
  margin: 2rem auto;
}
.error-page img {
  max-width: 250px;
  margin-bottom: 1.5rem;
  opacity: 0.85;
}
.error-page h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: #0d1b2a;
}

/* --- Form validation --- */
.formError {
  color: #e63946;
  font-style: italic;
  font-size: 0.82rem;
}

/* --- Summernote fix --- */
.form-card .note-editor {
  border-radius: 3px;
  border-color: #dee2e6;
}

/* --- Page title --- */
.page-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #0d1b2a;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid #e63946;
  display: inline-block;
}

/* --- Breaking / Latest label --- */
.breaking-label {
  background: #e63946;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.2rem 0.6rem;
  display: inline-block;
  margin-bottom: 0.5rem;
}

/* --- Nav search (extracted inline styles) --- */
.nav-search-input {
  padding: 4px 10px;
  font-size: 0.78rem;
  border: none;
  border-radius: 3px;
  width: 160px;
}
.nav-search-btn {
  background: #e63946;
  border: none;
  color: #fff;
  padding: 4px 10px;
  border-radius: 3px;
  font-size: 0.75rem;
  cursor: pointer;
}

/* --- Hamburger Button --- */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 4px;
  flex-direction: column;
  gap: 4px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #a8dadc;
  border-radius: 2px;
  transition: all 0.3s;
}
.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

/* --- Tablet & below (< 900px) --- */
@media (max-width: 900px) {
  .top-bar {
    font-size: 0.65rem;
    padding: 0.3rem 1rem;
  }
  .site-navbar {
    padding: 0 1rem;
    flex-wrap: wrap;
    height: auto;
    min-height: 50px;
  }
  .nav-left {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    min-height: 50px;
  }
  .hamburger {
    display: flex;
  }
  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    padding: 0.5rem 0 0.75rem;
    gap: 0;
    order: 3;
  }
  .nav-links.open {
    display: flex;
  }
  .nav-links a {
    padding: 0.55rem 0.5rem;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .nav-links span { display: contents; }
  .nav-right {
    position: absolute;
    right: 1rem;
    top: 8px;
  }
  .nav-search-input {
    width: 100px;
  }
  .page-container {
    padding: 1rem;
  }
  .post-view {
    padding: 1.5rem 1.25rem;
  }
  .form-card {
    padding: 1.5rem 1.25rem;
    margin: 1rem auto;
  }
}

/* --- Phone (< 600px) --- */
@media (max-width: 600px) {
  .top-bar {
    flex-direction: column;
    gap: 0.2rem;
    text-align: center;
    padding: 0.4rem 0.75rem;
  }
  .site-navbar {
    padding: 0 0.75rem;
  }
  .nav-brand {
    font-size: 1.3rem;
  }
  .nav-right {
    position: static;
    width: 100%;
    padding: 0.5rem 0;
    order: 2;
  }
  .nav-right form {
    width: 100%;
  }
  .nav-search-input {
    flex: 1;
    width: auto !important;
  }
  .page-container {
    padding: 0.75rem;
  }
  .hero-article .hero-body {
    padding: 1rem;
  }
  .hero-article .post-title {
    font-size: 1.3rem;
  }
  .news-card {
    padding: 0.75rem 1rem;
  }
  .post-view {
    padding: 1.25rem 1rem;
  }
  .post-view .post-title {
    font-size: 1.5rem;
  }
  .post-view .post-body {
    font-size: 0.95rem;
  }
  .form-card {
    padding: 1.25rem 1rem;
  }
  .clean-table {
    padding: 0.75rem;
    overflow-x: auto;
  }
  .clean-table .table td,
  .clean-table .table th {
    font-size: 0.75rem;
    padding: 0.5rem;
  }
  .page-title {
    font-size: 1.2rem;
  }
  .sidebar {
    padding: 1rem;
  }
}