/* ==========================================================================
   DIARY SMART — GLOBAL STYLESHEET
   Brand Colors:
   - Primary Background: #FFF6A1
   - Primary Brand Color: #D46D25
   - Secondary Color:     #FDC086
   ========================================================================== */

:root {
  --bg-primary: #FFF6A1;
  --bg-light: #FFFCED;
  --bg-white: #FFFFFF;
  --brand-primary: #D46D25;
  --brand-primary-hover: #B5581A;
  --brand-secondary: #FDC086;
  --text-main: #2C221E;
  --text-muted: #7A6E65;
  --border-color: rgba(212, 109, 37, 0.18);
  --shadow-sm: 0 4px 12px rgba(212, 109, 37, 0.08);
  --shadow-md: 0 8px 24px rgba(212, 109, 37, 0.12);
  --shadow-lg: 0 16px 32px rgba(212, 109, 37, 0.16);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --font-main: 'Outfit', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   1. BASE RESETS & LAYOUT HACKS
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body, html {
  width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
}

.logo {
  font-weight: 800;
  font-size: 1.8rem;
  color: var(--brand-primary);
}

.logo span {
  color: var(--text-main);
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

ul {
  list-style: none;
}

button, input, textarea, select {
  font-family: inherit;
  outline: none;
}

/* ==========================================================================
   2. UTILITY COMPONENTS & CARDS
   ========================================================================== */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn-primary {
  background-color: var(--brand-primary);
  color: #FFFFFF;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--brand-primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: var(--brand-secondary);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: #fca859;
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--brand-primary);
  color: var(--brand-primary);
}

.btn-outline:hover {
  background: var(--brand-primary);
  color: #FFFFFF;
}

.btn-full {
  width: 100%;
  border-radius: var(--radius-sm);
  padding: 12px;
}

/* ==========================================================================
   3. APP CONTAINER & MAIN CONTENT STRUCTURE
   ========================================================================== */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.main-wrapper {
  flex: 1;
  width: 100%;
  margin-left: 0;
  background: var(--bg-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 80px;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-color);
}

.page-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--brand-primary);
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--brand-secondary);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.dashboard-content {
  padding: 24px 16px;
  width: 100%;
  box-sizing: border-box;
}

.grid-dashboard {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
}

.col-8 { grid-column: span 8; }
.col-4 { grid-column: span 4; }
.col-12 { grid-column: span 12; }

/* ==========================================================================
   4. DIARY PAGE SPECIFIC LAYOUT & CARDS
   ========================================================================== */
.diary-center-container {
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.diary-card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.flex-1 {
  flex: 1;
}

.diary-textarea {
  resize: vertical;
  min-height: 180px;
}

.form-actions-left {
  margin-top: 16px;
}

.btn-save {
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}

.app-slogan {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--brand-primary);
  margin-top: 40px;
  margin-bottom: 20px;
}

/* ==========================================================================
   5. CATEGORY PILLS (HORIZONTAL ROW)
   ========================================================================== */
.category-pills-wrapper {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 16px 2px;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.category-pills-wrapper::-webkit-scrollbar {
  display: none;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  height: 38px;
  border-radius: 50px;
  background-color: #2D2A26;
  color: #D1C7BD;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  white-space: nowrap;
}

.pill-btn:hover {
  background-color: #423E3A;
  color: #FFFFFF;
}

.pill-btn.active {
  background-color: var(--brand-primary);
  color: #FFFFFF;
  border-color: var(--brand-primary);
  box-shadow: 0 4px 12px rgba(212, 109, 37, 0.3);
}

/* ==========================================================================
   6. FORM INPUT & CHECKBOX STYLES
   ========================================================================== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-light);
  font-size: 1rem;
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--brand-primary);
  background: var(--bg-white);
  box-shadow: 0 0 0 3px rgba(212, 109, 37, 0.15);
}

/* iOS Safari Date Input Fix */
input[type="date"].form-input,
input[type="date"] {
  width: 100%;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--bg-light);
  min-height: 48px;
  font-size: 16px;
}

/* Terms Checkbox Group */
.terms-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.terms-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-primary);
  cursor: pointer;
}

.terms-group label {
  cursor: pointer;
  margin-bottom: 0;
  font-weight: 500;
}

.terms-group a {
  color: var(--brand-primary);
  font-weight: 700;
}

/* ==========================================================================
   7. BOTTOM NAVIGATION BAR (FOR MOBILE & DIARY SMART APP)
   ========================================================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background-color: var(--brand-primary);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 0 12px 0;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.65);
  flex: 1;
  gap: 4px;
  transition: all 0.25s ease;
}

.nav-icon {
  width: 22px;
  height: 22px;
  stroke: rgba(255, 255, 255, 0.65);
  fill: none;
  stroke-width: 2;
  transition: all 0.25s ease;
}

.nav-item span {
  font-size: 0.72rem;
  font-weight: 600;
}

.nav-item.active span {
  color: var(--bg-primary);
}

.nav-item.active .nav-icon {
  stroke: var(--bg-primary);
  transform: translateY(-2px);
}

/* ==========================================================================
   8. AUTHENTICATION & LANDING PAGES
   ========================================================================== */
body.auth-page {
  min-height: 100vh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  padding: 20px;
  background-color: var(--brand-primary-hover);
}

body.auth-page .auth-wrapper {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

body.auth-page .auth-card {
  width: 100%;
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 32px 28px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  display: inline-block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--brand-primary);
  margin-bottom: 12px;
  text-decoration: none;
}

.auth-logo span {
  color: var(--text-main);
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  font-size: 0.88rem;
}

/* ==========================================================================
   9. MODALS & POP-UPS (TERMS & STATUS ALERTS)
   ========================================================================== */
.modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(44, 34, 30, 0.6) !important;
  backdrop-filter: blur(4px);
  display: none !important;
  justify-content: center !important;
  align-items: center !important;
  z-index: 99999 !important;
  padding: 16px;
  box-sizing: border-box;
}

.modal-overlay.active {
  display: flex !important;
}

.modal-card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  max-width: 420px;
  width: 100%;
  padding: 28px 24px;
  position: relative;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  box-sizing: border-box;
  margin: auto;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--brand-primary);
}

.modal-title {
  color: var(--brand-primary);
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 16px;
  text-align: center;
}

.modal-body {
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.5;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 6px;
}

.modal-body p {
  margin-bottom: 12px;
  color: var(--text-muted);
}

.modal-body h4 {
  color: var(--brand-primary);
  font-size: 0.98rem;
  font-weight: 700;
  margin-top: 14px;
  margin-bottom: 4px;
}

.modal-body::-webkit-scrollbar {
  width: 5px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--brand-secondary);
  border-radius: 10px;
}

/* Status Icon & Alert Adjustments */
.alert-card {
  text-align: center;
  padding: 32px 24px;
  max-width: 380px;
}

.status-icon-wrapper {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
  transition: var(--transition);
}

.status-icon-wrapper.success {
  background: rgba(212, 109, 37, 0.15);
  color: var(--brand-primary);
}

.status-icon-wrapper.error {
  background: rgba(220, 53, 69, 0.15);
  color: #dc3545;
}

.alert-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.alert-message {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ==========================================================================
   10. RESPONSIVE BREAKPOINTS (MOBILE & TABLET FIXES)
   ========================================================================== */
@media (max-width: 768px) {
  .grid-dashboard {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .col-8, .col-4, .col-12 {
    width: 100% !important;
  }

  .dashboard-content {
    padding: 16px;
  }

  .top-nav {
    padding: 14px 16px;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }
}

/* Profile Modal Styles */
.custom-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.custom-modal.active {
  display: flex;
}

.profile-card {
  background: #ffffff;
  padding: 20px;
  border-radius: 12px;
  width: 90%;
  max-width: 350px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  text-align: left;
}

.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.profile-body {
  margin-bottom: 20px;
}

.profile-avatar {
  display: flex;
  justify-content: center;
  margin-bottom: 15px;
  color: #d97706;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
}

.logout-btn {
  width: 100%;
  padding: 10px;
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}

.logout-btn:hover {
  background: #b91c1c;
}
.custom-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.custom-modal.active {
  display: flex !important;
}
/* ==========================================================================
   PASSWORD UPDATE SUCCESS POP-UP MODAL
   ========================================================================== */
.custom-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(44, 34, 30, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  padding: 16px;
  box-sizing: border-box;
}

.custom-modal-overlay.active {
  display: flex !important;
}

.alert-card-box {
  background: #FFFFFF;
  border-radius: 24px;
  max-width: 380px;
  width: 100%;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 16px 32px rgba(212, 109, 37, 0.2);
  border: 1px solid rgba(212, 109, 37, 0.15);
  box-sizing: border-box;
  animation: modalScaleUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalScaleUp {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.status-icon-circle {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(212, 109, 37, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px auto;
  color: #D46D25;
}

.alert-card-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #2C221E;
  margin-bottom: 8px;
}

.alert-card-message {
  font-size: 0.95rem;
  color: #7A6E65;
  margin-bottom: 24px;
  line-height: 1.5;
}

.alert-card-btn {
  width: 100%;
  background-color: #D46D25;
  color: #FFFFFF;
  padding: 14px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(212, 109, 37, 0.3);
}

.alert-card-btn:hover {
  background-color: #B5581A;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(212, 109, 37, 0.4);
}