/* style.css (Crafty Scrapbook Overhaul with Font Size Fix) */

/* 1. Fonts & Colors -- The foundation of the new theme */
:root {
  --font-body: "Lora", "Georgia", serif;
  --font-handwritten: "Gochi Hand", cursive;

  --bg-color: #fcf8f0; /* Parchment paper */
  --text-color: #4a443d; /* Dark charcoal brown */
  --card-bg: #ffffff;
  --card-shadow: rgba(74, 68, 61, 0.15);
  --border-color: #eaddd7;
  --toast-bg: #4a443d;
  --toast-text: #ffffff;

  /* Bubbly Accent Colors */
  --accent-pink: #ff6b81;
  --accent-blue: #48dbfb;
  --accent-yellow: #feca57;
  --tape-color: rgba(254, 202, 87, 0.6); /* Translucent yellow for tape */
}

[data-theme="dark"] {
  --bg-color: #2c3e50;
  --text-color: #ecf0f1;
  --card-bg: #34495e;
  --card-shadow: rgba(0, 0, 0, 0.25);
  --border-color: #4a6278;
  --tape-color: rgba(254, 202, 87, 0.4);
}

/* 2. General Body & Layout */
body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-body);
  line-height: 1.7;
  margin: 0;
  transition: background-color 0.3s, color 0.3s;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23eaddd7' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  padding-top: 1rem; /* Add some space at the top */
}

.fixed-header {
  position: fixed;
  top: 1rem;
  z-index: 1000;
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(5px);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 5px var(--card-shadow);
}

.mla-header {
  left: 1rem;
}

.corner-controls {
  right: 1rem;
  display: flex;
  gap: 0.5rem;
}

.corner-controls button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.8rem;
  transition: transform 0.2s;
}

.corner-controls button:hover {
  transform: scale(1.2);
}

.site-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
  margin-top: 100px; /* Push content down below fixed headers */
}

/* 3. Header & Title -- Using the new handwritten font */
.site-header {
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
}

.handwritten-title {
  font-family: var(--font-handwritten);
  font-size: 2.5rem; /* Adjusted for longer title */
  margin: 0;
  color: var(--accent-pink);
  font-weight: normal;
  line-height: 1.2;
}

/* 4. Controls & Buttons -- Bubbly and interactive */
.controls button {
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  font-size: 1.5rem;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); /* Bouncy transition */
  box-shadow: 0 4px 0 var(--border-color);
}

.controls button:hover {
  transform: translateY(-2px) scale(1.1);
  box-shadow: 0 6px 0 var(--border-color);
}

.controls button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--border-color);
}

/* 5. Tab Navigation -- Now looks like sticky notes */
.tab-group-title {
  text-align: center;
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-size: 2rem;
  color: var(--text-color);
}

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
}

.tab-bar:first-child {
  border-bottom: 2px dashed var(--border-color);
  margin-bottom: 1rem;
  padding-bottom: 1rem;
}

.tab-link {
  background-color: var(--accent-yellow);
  color: var(--text-color);
  text-decoration: none;
  padding: 0.8rem 1.3rem;
  border-radius: 8px 8px 2px 2px;
  font-family: var(--font-handwritten); /* NEW FONT */
  font-size: 1.1rem; /* Adjusted for new font */
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 2px 2px 5px var(--card-shadow);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.tab-link:hover {
  transform: translateY(-4px) rotate(2deg);
  box-shadow: 4px 6px 10px var(--card-shadow);
}

.tab-link.active {
  background-color: var(--accent-pink);
  color: white;
  transform: translateY(-2px) rotate(-1deg) scale(1.05);
  box-shadow: 4px 6px 10px var(--card-shadow);
  z-index: 2;
}

/* 6. The Paper Card & Tape Effect -- The star of the show! */
.paper-card {
  background-color: var(--card-bg);
  padding: 2rem;
  border-radius: 4px;
  box-shadow: 0 4px 6px var(--card-shadow), 0 1px 3px var(--card-shadow);
  transition: background-color 0.3s;
  position: relative; /* Needed for the tape */
}

.taped-corner::before,
.taped-corner::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 30px;
  background: var(--tape-color);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  border-left: 1px dashed rgba(0, 0, 0, 0.1);
  border-right: 1px dashed rgba(0, 0, 0, 0.1);
}

.taped-corner::before {
  top: -15px;
  left: -20px;
  transform: rotate(-45deg);
}

.taped-corner::after {
  top: -15px;
  right: -20px;
  transform: rotate(45deg);
}

/* 7. Sub-Tabs -- Styled like smaller labels */
.sub-tab-nav {
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.sub-tab-link {
  background: #f1f1f1;
  border-radius: 4px 4px 0 0;
  border: 1px solid var(--border-color);
  border-bottom: none;
}

.sub-tab-link.active {
  background: var(--card-bg);
  border-bottom: 1px solid var(--card-bg);
}

/* 8. Editor & Save Button */
.editor-toolbar {
  background-color: transparent;
  border: 2px dashed var(--border-color);
  margin-bottom: 1rem;
  padding: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.editor-toolbar button {
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: var(--card-bg);
  font-family: var(--font-handwritten);
  font-size: 1.2rem;
}

.toolbar-label {
  font-family: var(--font-handwritten);
  font-size: 1rem;
  margin-left: 0.5rem;
}

.toolbar-divider {
  width: 2px;
  height: 25px;
  background: var(--border-color);
  margin: 0 0.5rem;
}

#image-editor-toolbar {
  position: absolute;
  z-index: 10;
  background: var(--card-bg);
  border-radius: 10px;
  box-shadow: 0 4px 15px var(--card-shadow);
}

.save-btn {
  background-color: var(--accent-blue);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 30px;
  cursor: pointer;
  font-weight: bold;
  font-family: var(--font-handwritten);
  font-size: 1.2rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 0 #1cb0f6;
}

.save-btn:hover {
  background-color: #4acffb;
}

.save-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #1cb0f6;
}

/* 9. Editable Content & Image Styles */
.editable-content::after {
  content: "";
  display: table;
  clear: both;
}

.editable-content img {
  border-radius: 4px;
  transition: all 0.2s ease-in-out;
  cursor: pointer;
}

.editable-content img.img-selected {
  outline: 4px solid var(--accent-blue);
  box-shadow: 0 0 15px var(--accent-blue);
}

.editable-content .img-wrap-left {
  float: left;
  margin-right: 1.5em;
  margin-bottom: 1em;
}

.editable-content .img-wrap-right {
  float: right;
  margin-left: 1.5em;
  margin-bottom: 1em;
}

.editable-content .img-size-s {
  max-width: 25%;
}
.editable-content .img-size-m {
  max-width: 50%;
}
.editable-content .img-size-l {
  max-width: 75%;
}
.editable-content .img-size-full {
  max-width: 100%;
  float: none;
}

.entry-subtitle-container {
  position: relative;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px dashed var(--border-color);
}

.entry-subtitle {
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 500;
  color: var(--text-color);
  opacity: 0.9;
  line-height: 1.6;
}

.entry-subtitle[contenteditable="true"] {
  outline: 2px dashed transparent;
  transition: outline-color 0.2s;
}

.entry-subtitle[contenteditable="true"]:focus {
  outline-color: var(--accent-blue);
}

.entry-subtitle-container .save-btn {
  position: absolute;
  bottom: -20px;
  right: 0;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

/* NEW: Font Size Control Styles */
.editable-content [data-font-size="-3"] {
  font-size: 0.7em;
}
.editable-content [data-font-size="-2"] {
  font-size: 0.8em;
}
.editable-content [data-font-size="-1"] {
  font-size: 0.9em;
}
/* 0 is normal size */
.editable-content [data-font-size="1"] {
  font-size: 1.15em;
}
.editable-content [data-font-size="2"] {
  font-size: 1.3em;
}
.editable-content [data-font-size="3"] {
  font-size: 1.5em;
}
.editable-content [data-font-size="4"] {
  font-size: 1.75em;
}

/* 10. Footer */
.site-footer {
  text-align: center;
  margin-top: 3rem;
  padding: 1.5rem;
  border-top: 2px dashed var(--border-color);
  font-size: 1rem;
  font-family: var(--font-handwritten);
  color: var(--text-color);
}
