/**
 * File Converter System - Styles
 * Design based on Flexy Bootstrap Lite Admin Template
 * Font: DM Sans | Framework: Bootstrap 5.3
 * Color Palette: Primary #1e4db7, Secondary #1a97f5
 */

/* ─── CSS Variables (Flexy palette) ─────────────────────────── */
:root {
  --fc-primary: #1e4db7;
  --fc-secondary: #1a97f5;
  --fc-success: #39cb7f;
  --fc-info: #0bb2fb;
  --fc-warning: #fdc90f;
  --fc-danger: #fc4b6c;
  --fc-dark: #11142d;
  --fc-muted: #777e89;
  --fc-body: #67757c;
  --fc-light-bg: #f6f8fb;
  --fc-sidebar-width: 260px;
  --fc-header-height: 64px;
  --fc-font: 'DM Sans', sans-serif;
}

/* ─── Base ──────────────────────────────────────────────────── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--fc-font);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--fc-body);
  background: var(--fc-light-bg);
  overflow-x: hidden;
}

/* ─── Main Layout ───────────────────────────────────────────── */
.main-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.left-sidebar {
  width: var(--fc-sidebar-width);
  background: #fff;
  border-right: 1px solid #e8ecf1;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.sidebar-header {
  height: var(--fc-header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid #e8ecf1;
}

.brand-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  gap: 10px;
}

.brand-logo-img {
  width: 210px;
  max-width: 100%;
  object-fit: contain;
}

.sidebar-toggle {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--fc-muted);
  cursor: pointer;
  display: none;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 15px 0;
}

.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: #a1aab2;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 15px 20px 8px;
}

.nav-item .nav-link {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  color: var(--fc-body);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 400;
  border-radius: 0;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

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

.nav-item .nav-link.active {
  background: rgba(30, 77, 183, 0.08);
  color: var(--fc-primary);
  font-weight: 500;
  border-left-color: var(--fc-primary);
}

.nav-icon {
  width: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 1.125rem;
}

/* ─── Sidebar Toggle Submenu ────────────────────────────────── */
.toggle-trigger {
  position: relative;
}

.toggle-arrow {
  margin-left: auto;
  font-size: 0.875rem;
  transition: transform 0.25s ease;
}

.nav-toggle.open > .toggle-trigger .toggle-arrow {
  transform: rotate(180deg);
}

.toggle-submenu {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.nav-toggle.open > .toggle-submenu {
  max-height: 800px;
}

.toggle-submenu li a {
  display: block;
  padding: 7px 20px 7px 56px;
  font-size: 0.8125rem;
  color: var(--fc-muted);
  text-decoration: none;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.toggle-submenu li a:hover {
  color: var(--fc-primary);
  background: var(--fc-light-bg);
  border-left-color: var(--fc-primary);
}

/* ─── Body Wrapper ──────────────────────────────────────────── */
.body-wrapper {
  margin-left: var(--fc-sidebar-width);
  width: calc(100% - var(--fc-sidebar-width));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Top Header ────────────────────────────────────────────── */
.top-header {
  height: var(--fc-header-height);
  background: #fff;
  border-bottom: 1px solid #e8ecf1;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.sidebar-toggle-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--fc-dark);
  cursor: pointer;
  display: none;
  margin-right: 12px;
}

/* ─── Page Content ──────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 24px;
}

/* ─── Cards (Flexy style) ───────────────────────────────────── */
.card {
  border-radius: 12px;
  background: #fff;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  /* subtle lift on hover like Flexy */
}

.card-title {
  color: var(--fc-dark);
}

/* ─── Stat Cards ────────────────────────────────────────────── */
.stat-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-card h4 {
  color: var(--fc-dark);
}

/* ─── Upload Area ───────────────────────────────────────────── */
.upload-area {
  position: relative;
  border: 2px dashed #d0d7e2;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  background: var(--fc-light-bg);
  transition: all 0.3s ease;
  cursor: pointer;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--fc-primary);
  background: rgba(30, 77, 183, 0.04);
}

.upload-area.drag-over {
  transform: scale(1.01);
}

.upload-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.upload-icon {
  font-size: 3rem;
  color: var(--fc-primary);
  margin-bottom: 10px;
  opacity: 0.7;
}

.upload-content h6 {
  color: var(--fc-dark);
}

/* Upload Preview */
.upload-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 10px 0;
}

.preview-icon {
  font-size: 2.5rem;
}

.preview-info h6 {
  color: var(--fc-dark);
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Result Card ───────────────────────────────────────────── */
.result-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}

/* ─── Format List ───────────────────────────────────────────── */
.format-item {
  padding: 4px 0;
  cursor: pointer;
  transition: opacity 0.2s;
}

.format-item:hover {
  opacity: 0.8;
}

/* ─── Step Numbers ──────────────────────────────────────────── */
.step-num {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
}

/* ─── Buttons (Flexy style) ─────────────────────────────────── */
.btn-primary {
  background: var(--fc-primary);
  border-color: var(--fc-primary);
}

.btn-primary:hover {
  background: #163a8f;
  border-color: #163a8f;
}

.btn-success {
  background: var(--fc-success);
  border-color: var(--fc-success);
}

.btn-success:hover {
  background: #2db46b;
  border-color: #2db46b;
}

/* ─── Form Controls ─────────────────────────────────────────── */
.form-select:focus,
.form-control:focus {
  border-color: var(--fc-primary);
  box-shadow: 0 0 0 0.2rem rgba(30, 77, 183, 0.15);
}

.form-select-lg {
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.9375rem;
  border-color: #d0d7e2;
}

/* ─── Badge tweaks ──────────────────────────────────────────── */
.bg-primary-subtle { background: #ddebff !important; }
.text-primary { color: var(--fc-primary) !important; }
.bg-secondary-subtle { background: rgba(26, 151, 245, 0.1) !important; }
.text-secondary { color: var(--fc-secondary) !important; }
.bg-success-subtle { background: #ebfaf2 !important; }
.text-success { color: var(--fc-success) !important; }
.bg-info-subtle { background: #e6f4ff !important; }
.text-info { color: var(--fc-info) !important; }
.bg-warning-subtle { background: #fff4e5 !important; }
.text-warning { color: var(--fc-warning) !important; }
.bg-danger-subtle { background: #fdf3f5 !important; }
.text-danger { color: var(--fc-danger) !important; }

/* ─── Footer ────────────────────────────────────────────────── */
.site-footer {
  padding: 16px 24px;
  border-top: 1px solid #e8ecf1;
  background: #fff;
  font-size: 0.8125rem;
}

/* ─── Ad placeholders (AdSense slots) ───────────────────────── */
.ad-slot {
  width: 100%;
  background: #fff;
  border: 1px dashed #d0d7e2;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.ad-slot__label {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #6b7785;
  background: rgba(246, 248, 251, 0.95);
  border: 1px solid #e8ecf1;
  padding: 4px 10px;
  border-radius: 999px;
  z-index: 2;
}

.ad-slot__inner {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.ad-slot--leaderboard .ad-slot__inner {
  min-height: 100px;
}

.ad-slot--incontent .ad-slot__inner {
  min-height: 200px;
}

.ad-slot--sidebar .ad-slot__inner {
  min-height: 600px; /* vertical */
}

.ad-slot--sticky {
  position: sticky;
  top: calc(var(--fc-header-height) + 18px);
}

/* ─── Sidebar Overlay (mobile) ──────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
}

.sidebar-overlay.active {
  display: block;
}

/* ─── Loading Spinner ───────────────────────────────────────── */
.btn-loading .spinner-border {
  width: 1rem;
  height: 1rem;
}

/* ─── Scrollbar ─────────────────────────────────────────────── */
.sidebar-nav::-webkit-scrollbar {
  width: 5px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: #d0d7e2;
  border-radius: 10px;
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .left-sidebar {
    transform: translateX(-100%);
  }

  .left-sidebar.show {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: block;
  }

  .sidebar-toggle-btn {
    display: block;
  }

  .body-wrapper {
    margin-left: 0;
    width: 100%;
  }

  .page-content {
    padding: 16px;
  }

  .upload-area {
    padding: 30px 15px;
  }
}

@media (max-width: 575.98px) {
  .header-inner {
    padding: 0 16px;
  }

  .header-inner h5 {
    font-size: 1rem;
  }

  .result-icon {
    display: none;
  }

  .btn-lg {
    font-size: 0.9375rem;
    padding: 10px 20px;
  }

  .upload-preview {
    flex-direction: column;
    text-align: center;
  }

  .upload-area {
    padding: 24px 12px;
  }

  .upload-icon {
    font-size: 2.25rem;
  }

  .card-body {
    padding: 16px !important;
  }

  .form-select-lg {
    font-size: 0.875rem;
    padding: 10px 14px;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }

  .stat-card h4 {
    font-size: 1.25rem;
  }

  .stat-card h6 {
    font-size: 0.75rem;
  }

  /* Download button full width on mobile */
  .result-icon + .ms-3 .btn {
    display: block;
    width: 100%;
    margin-bottom: 8px;
  }

  .result-icon + .ms-3 .btn.ms-2 {
    margin-left: 0 !important;
  }
}

/* ─── Animations ────────────────────────────────────────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  animation: fadeInUp 0.4s ease forwards;
}

.row .col-sm-6:nth-child(2) .card { animation-delay: 0.05s; }
.row .col-sm-6:nth-child(3) .card { animation-delay: 0.1s; }
.row .col-sm-6:nth-child(4) .card { animation-delay: 0.15s; }

/* ─── Admin: Post Editor (WordPress-like) ───────────────────── */
.admin-nav .list-group-item {
  border: 0;
  border-radius: 10px;
  margin-bottom: 6px;
}

.admin-nav .list-group-item.active {
  background: rgba(30, 77, 183, 0.08);
  color: var(--fc-primary);
  font-weight: 600;
}

.tag-input {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tag-input__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-chip {
  border: 1px solid #d0d7e2;
  background: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--fc-dark);
  cursor: pointer;
}

.tag-chip:hover {
  border-color: var(--fc-primary);
  box-shadow: 0 0 0 0.2rem rgba(30, 77, 183, 0.10);
}

.tag-chip__x {
  font-weight: 800;
  color: var(--fc-muted);
}

.featured-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid #e8ecf1;
}

.admin-toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: rgba(17, 20, 45, 0.92);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
  max-width: min(420px, calc(100vw - 32px));
}

.admin-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Cookie Consent Banner ─────────────────────────────────── */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1e293b;
  color: #f8fafc;
  z-index: 10000;
  padding: 14px 20px;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.2);
}

.cookie-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.cookie-banner-text {
  flex: 1;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #cbd5e1;
}

.cookie-link {
  color: #93c5fd;
  text-decoration: underline;
}

.cookie-link:hover {
  color: #bfdbfe;
}

.cookie-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

@media (max-width: 576px) {
  .cookie-banner-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}
