/* ============================================
   Emerald Coffin — Dark Halloween Theme
   ============================================ */

/* --- Summernote Editor (Story Manager) ---
   Match the admin dark theme instead of the library's default background. */
.note-editor.note-frame,
.note-editor.note-airframe {
  background-color: transparent !important;
  border-color: rgba(150, 150, 150, 0.3);
}

.note-editor .note-toolbar {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(150, 150, 150, 0.3);
}

.note-editor .note-editing-area .note-editable,
.note-editor .note-editing-area .note-editable * {
  background-color: #1a1a1a !important;
  color: #ffffff;
}

/* Prevent automatic first-line indentation in editor paragraphs */
.note-editor .note-editing-area .note-editable p {
  text-indent: 0;
}

/* Force text color on pasted content that may carry inline color styles */
.note-editor .note-editing-area .note-editable p,
.note-editor .note-editing-area .note-editable span,
.note-editor .note-editing-area .note-editable div {
  color: #ffffff;
}

/* --- Base / Body --- */
.ec-body {
  background-color: #0a0a0a;
  background-image: url("../assets/images/bg-emeraldcasket-uv-05.jpg");
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
  color: #c8c4bc;
  min-height: 100vh;
}

/* --- Hero / Logo Section --- */
.ec-hero {
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 1030;
  background: #0a0a0a;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
}

.ec-hero .container {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  width: 100%;
  padding: 0.5rem 1rem;
}

.ec-hero .ec-story-nav {
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  text-align: center;
}

.ec-hero a {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
}

.ec-hero img {
  max-width: 100%;
  width: min(100%, 600px);
  display: block;
}

.ec-hero .container {
  padding-left: 1rem;
  padding-right: 1rem;
}

.ec-tagline {
  font-family: "Lora", serif;
  font-style: italic;
  color: #8a8a7a;
  font-size: 1.1rem;
  margin-top: 0.25rem;
}

/* --- Story Cards Grid --- */
.ec-stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  padding: 0.5rem 0;
  -webkit-box-pack: start;
  -ms-flex-pack: start;
  justify-content: start;
  justify-items: stretch;
}

.ec-card {
  background: rgba(10, 10, 10, 0.85);
  border: 1px solid rgba(40, 80, 40, 0.25);
  border-radius: 0.5rem;
  overflow: hidden;
  -webkit-transition:
    border-color 0.3s ease,
    -webkit-box-shadow 0.3s ease,
    -webkit-transform 0.2s ease;
  transition:
    border-color 0.3s ease,
    -webkit-box-shadow 0.3s ease,
    -webkit-transform 0.2s ease;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.2s ease;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.2s ease,
    -webkit-box-shadow 0.3s ease,
    -webkit-transform 0.2s ease;
  text-decoration: none;
  color: inherit;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
}

.ec-card:hover {
  border-color: rgba(50, 180, 80, 0.5);
  -webkit-box-shadow: 0 0 20px rgba(30, 120, 50, 0.2);
  box-shadow: 0 0 20px rgba(30, 120, 50, 0.2);
  -webkit-transform: translateY(-3px);
  transform: translateY(-3px);
  color: inherit;
  text-decoration: none;
}

.ec-card-img {
  width: 100%;
  height: auto;
  max-height: 300px;
  -o-object-fit: contain;
  object-fit: contain;
  display: block;
  background-color: rgba(20, 20, 20, 0.5);
  -webkit-box-sizing: border-box;
}

.ec-card-body {
  padding: 1.25rem;
  -webkit-box-flex: 1;
  -ms-flex: 1;
  flex: 1;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
}

.ec-card-title {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.5rem;
  letter-spacing: 0.5px;
}

.ec-card-subtitle {
  font-family: "Lora", serif;
  font-size: 0.9rem;
  color: #ffffff;
  font-style: italic;
  margin-bottom: 0.75rem;
  -webkit-box-flex: 1;
  -ms-flex: 1;
  flex: 1;
}

.ec-card-meta {
  font-size: 0.8rem;
  color: #555;
  padding: 0 1.25rem 1.25rem;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  gap: 0.5rem;
}

.ec-card-badge {
  display: -webkit-inline-box;
  display: -ms-inline-flexbox;
  display: inline-flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  gap: 0.3rem;
  background: rgba(30, 100, 40, 0.25);
  color: #5cb85c;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
}

/* Featured card accent */
.ec-card-featured {
  border-color: rgba(200, 160, 40, 0.35);
}

.ec-card-featured:hover {
  border-color: rgba(220, 180, 50, 0.6);
  -webkit-box-shadow: 0 0 20px rgba(200, 160, 40, 0.2);
  box-shadow: 0 0 20px rgba(200, 160, 40, 0.2);
}

/* --- Reading Page --- */
.ec-reading {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.ec-reading-title {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  margin-bottom: 0.25rem;
  letter-spacing: 1px;
}

.ec-reading-subtitle {
  font-family: "Lora", serif;
  font-style: italic;
  color: #7a7a6e;
  text-align: center;
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.ec-reading-date {
  text-align: center;
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 2rem;
}

.ec-reading-body {
  font-family: "Lora", serif;
  font-size: 1.15rem;
  line-height: 1.85;
  color: #d4d0c8;
}

.ec-reading-body p {
  margin-bottom: 1.25rem;
  text-indent: 0;
}

.ec-reading-body img {
  max-width: 100%;
  height: auto;
  border-radius: 0.25rem;
  margin: 1.5rem 0;
}

/* --- Audio Player --- */
.ec-audio-player {
  background: rgba(20, 20, 20, 0.8);
  border: 1px solid rgba(40, 80, 40, 0.3);
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin-bottom: 2rem;
  text-align: center;
}

.ec-audio-player audio {
  width: 100%;
  max-width: 500px;
  margin-top: 0.5rem;
}

.ec-audio-label {
  font-family: "Lora", serif;
  font-size: 0.9rem;
  color: #7a7a6e;
  margin-bottom: 0.5rem;
}

/* --- Navigation --- */
.ec-nav {
  background: rgba(5, 5, 5, 0.9) !important;
  border-bottom: 1px solid rgba(40, 80, 40, 0.2);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.ec-nav .navbar-brand {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: #5cb85c !important;
  letter-spacing: 1px;
}

.ec-nav .nav-link {
  color: #aaa !important;
  -webkit-transition: color 0.2s;
  transition: color 0.2s;
}

.ec-nav .nav-link:hover {
  color: #5cb85c !important;
}

/* --- Footer --- */
.ec-footer {
  background: rgba(5, 5, 5, 0.95);
  border-top: 1px solid rgba(40, 80, 40, 0.2);
  padding: 1.5rem 0;
  text-align: center;
  color: #555;
  font-size: 0.85rem;
  margin-top: auto;
}

/* --- Back to Top --- */
.ec-back-top {
  color: #5cb85c;
  font-size: 1.5rem;
  text-decoration: none;
  -webkit-transition: color 0.2s;
  transition: color 0.2s;
}

.ec-back-top:hover {
  color: #7cd97c;
}

/* --- Admin Page --- */
.ec-admin-card {
  background: rgba(15, 15, 15, 0.9);
  border: 1px solid rgba(40, 80, 40, 0.25);
}

.ec-admin-card .card-header {
  background: rgba(20, 20, 20, 0.95);
  border-bottom: 1px solid rgba(40, 80, 40, 0.2);
  color: #e0ddd5;
  font-family: "Creepster", cursive;
  letter-spacing: 0.5px;
}

/* --- Login Page --- */
.ec-login-wrapper {
  min-height: 100vh;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
}

.ec-login-card {
  background: rgba(15, 15, 15, 0.9);
  border: 1px solid rgba(40, 80, 40, 0.3);
  border-radius: 0.5rem;
  width: 100%;
  max-width: 400px;
  padding: 2rem;
}

.ec-login-card .form-control {
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(60, 60, 60, 0.5);
  color: #ccc;
}

.ec-login-card .form-control:focus {
  background: rgba(0, 0, 0, 0.6);
  border-color: #5cb85c;
  color: #ddd;
  -webkit-box-shadow: 0 0 0 0.2rem rgba(92, 184, 92, 0.15);
  box-shadow: 0 0 0 0.2rem rgba(92, 184, 92, 0.15);
}

/* --- Utility --- */
.ec-divider {
  border: 0;
  height: 1px;
  background: -webkit-gradient(
    linear,
    left top,
    right top,
    from(transparent),
    color-stop(rgba(40, 80, 40, 0.3)),
    to(transparent)
  );
  background: linear-gradient(
    to right,
    transparent,
    rgba(40, 80, 40, 0.3),
    transparent
  );
  margin: 2rem 0;
}

/* --- Preserve old classes during migration --- */
.style3 {
  background-color: #000;
  background-image: url("../assets/images/bg-emeraldcasket-uv-05.jpg");
}

/* --- Story Cover Image --- */
.ec-reading-cover {
  width: 100%;
  max-width: 100%;
  margin: 2rem 0;
  overflow: hidden;
  border-radius: 0.5rem;
  background-color: rgba(20, 20, 20, 0.5);
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
}

.ec-reading-cover img {
  width: 100%;
  height: auto;
  -o-object-fit: contain;
  object-fit: contain;
  display: block;
}

/* --- Story card metadata --- */
.ec-card-meta {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  gap: 0.75rem;
}

.ec-card-read-time {
  color: #39ff14;
  font-weight: 600;
}

/* --- Mobile overflow protection --- */
.ec-body {
  overflow-x: hidden;
}

.ec-stories-grid {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  -webkit-box-pack: start;
  -ms-flex-pack: start;
  justify-content: start;
}

.ec-card {
  min-width: 0;
}

.ec-card-meta {
  min-width: 0;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
}

.ec-card-meta > span {
  min-width: 0;
}

@media (max-width: 575.98px) {
  .ec-stories-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }
}

@media (max-width: 575.98px) {
  .ec-card {
    border-width: 2px;
    border-color: rgba(200, 200, 200, 0.45);
  }

  .ec-hero .container {
    padding-top: 0.1rem;
    padding-bottom: 0.1rem;
  }

  .ec-divider {
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
  }
}

/* Keep the first mobile story row close to the sticky header. */
@media (max-width: 575.98px) {
  .ec-stories-section {
    padding-top: 0.5rem;
  }

  .ec-stories-section .ec-stories-grid {
    padding-top: 0;
  }
}

@media (max-width: 575.98px) {
  .ec-reading {
    padding-top: 0.75rem;
  }
}

/* --- Mobile reading typography --- */
@media (max-width: 575.98px) {
  .ec-reading-body,
  .ec-reading-body p,
  .ec-reading-body div,
  .ec-reading-body span,
  .ec-reading-body li,
  .ec-reading-body blockquote {
    font-family: "Lora", Georgia, serif !important;
  }
}
