/* ==========================================================================
   Uttara University Cover Page Generator - Exact Replica Stylesheet
   ========================================================================== */

/* --- 1. CSS Variables & Theme Tokens --- */
:root {
  --uu-blue: #2c5697;
  --uu-black: #000000;
  --uu-border: #000000;
  --uu-bg-screen: #383838;

  --font-serif: 'Georgia', 'Times New Roman', serif;
  --font-sans: 'Arial', 'Helvetica', sans-serif;
}

/* --- 2. Global Reset & Screen Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--uu-bg-screen);
  color: #ffffff;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- 3. Sticky Action Header Bar --- */
.action-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(40, 40, 40, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 24px;
}

.action-bar-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: bold;
  font-size: 1rem;
}

.dev-credit {
  font-size: 0.8rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.6);
  margin-left: 4px;
}

.dev-credit a {
  color: #60a5fa;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

.dev-credit a:hover {
  color: #93c5fd;
  text-decoration: underline;
}

.action-buttons { display: flex; gap: 10px; }
.btn { padding: 6px 12px; border-radius: 4px; cursor: pointer; border: 1px solid transparent; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-secondary { background: #4b5563; color: #fff; }

/* --- 4. Canvas Wrapper & Responsive Scaling --- */
.canvas-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px 8px;
  box-sizing: border-box;
}

/* True A4 Page Dimensions (794px width, 1123px height) */
.page {
  width: 794px !important;
  min-width: 794px !important;
  max-width: 794px !important;
  height: 1123px !important;
  min-height: 1123px !important;
  max-height: 1123px !important;
  flex-shrink: 0;
  background: #ffffff;
  color: var(--uu-black);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transform-origin: top center;
  box-sizing: border-box;
  padding: 28px; /* THIN Margin from page edge to inner border */
  display: flex;
  flex-direction: column;
}

/* Main Inner Page Content with Border */
.page-content {
  border: 1px solid var(--uu-border);
  flex: 1;
  padding: 55px 65px; /* Padding inside the border */
  display: flex;
  flex-direction: column;
}

/* --- 5. Institution Header --- */
.univ-header {
  text-align: center;
}

.univ-title {
  font-family: var(--font-serif);
  font-size: 3.8rem; /* BIGGER TITLE */
  font-weight: 700;
  color: var(--uu-blue);
  margin-bottom: 15px;
}

.univ-tagline {
  font-family: var(--font-serif);
  font-size: 1.25rem; /* BIGGER TAGLINE */
  font-weight: 700;
  color: var(--uu-black);
  margin-bottom: 40px;
}

.logo-container {
  text-align: center;
  margin-bottom: 40px;
}

.univ-logo {
  height: 200px; /* BIGGER LOGO */
  width: auto;
  display: inline-block;
}

/* --- 6. Document Heading ("Assignment") --- */
.doc-title-section {
  text-align: center;
  margin-bottom: 45px;
}

.doc-title-badge {
  position: relative;
  display: inline-block;
  font-family: var(--font-serif);
  font-size: 2.2rem; /* BIGGER HEADING */
  font-weight: 700;
  color: var(--uu-black);
  cursor: pointer;
  outline: none;
  padding: 4px 18px 4px 10px;
  border-radius: 8px;
  transition: background-color 0.2s ease, transform 0.15s ease;
  user-select: none;
}

.doc-title-badge:hover {
  background-color: #f1f5f9;
}

.doc-title-badge:active {
  transform: scale(0.97);
}

.cycle-icon {
  position: absolute;
  top: 4px;
  right: 0px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--uu-blue);
  opacity: 0.55;
  transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.doc-title-badge:hover .cycle-icon {
  opacity: 1;
  transform: rotate(180deg);
}

/* --- 7. Course Details Section --- */
.course-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 50px;
}

.field-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 1.25rem; /* BIGGER TEXT */
}

.label {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--uu-black);
  white-space: nowrap;
}

.value {
  flex: 1;
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--uu-black);
  outline: none;
  border-bottom: 1px solid transparent;
  min-width: 0;
  word-wrap: break-word;
  word-break: normal;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  position: relative;
  top: 2px;
}

.value:focus {
  background-color: #f1f5f9;
}

/* Placeholders matching black filled state for exact replica look */
.value[contenteditable="true"]:empty:before {
  content: attr(data-placeholder);
  color: var(--uu-black);
  pointer-events: none;
}

/* --- 8. Submission Details Box (2-Column Unified Table) --- */
.submission-box {
  width: 100%;
  border: 1px solid var(--uu-border);
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.sub-col {
  padding: 20px 20px 30px 20px;
  display: flex;
  flex-direction: column;
}

.sub-col-left {
  border-right: 1px solid var(--uu-border);
}

.col-header {
  font-family: var(--font-serif);
  font-size: 1.15rem; /* BIGGER HEADER */
  font-weight: 700;
  color: var(--uu-black);
  text-align: center;
  margin-bottom: 30px;
}

.col-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.box-field-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 1.05rem; /* BIGGER BOX TEXT */
}

.box-field-row .label {
  font-size: 1.05rem;
}

/* Normal weight values inside the box */
.value-normal {
  font-weight: 400;
}

.static-row {
  margin-top: 6px;
}

.static-univ {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--uu-black);
}

.date-row {
  margin-top: 6px;
}

/* --- 9. Screen Footer --- */
.app-footer {
  text-align: center;
  padding: 16px 24px 30px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
}

.app-footer a {
  color: #60a5fa;
  text-decoration: none;
  font-weight: 600;
}

.app-footer a:hover {
  color: #93c5fd;
  text-decoration: underline;
}

/* --- 10. Mobile Responsive Header Improvements --- */
@media screen and (max-width: 600px) {
  .action-bar {
    padding: 8px 12px;
  }
  .action-bar-container {
    gap: 8px;
    justify-content: center;
  }
  .brand-badge {
    font-size: 0.85rem;
    flex-wrap: wrap;
    justify-content: center;
  }
  .btn {
    padding: 5px 8px;
    font-size: 0.75rem;
  }
}

/* --- 10. Print Media Queries (1:1 Native A4 Export) --- */
@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }
  html, body {
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .action-bar, .no-print {
    display: none !important;
  }
  .canvas-wrapper {
    padding: 0 !important;
  }
  .page {
    transform: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    width: 100% !important;
    padding: 28px !important;
  }
}
