@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300..700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;600;700&display=swap');

:root {
  --color-primary: #A283D2;   /* Ungu pastel */
  --color-accent: #AEE1D6;    /* Mint */
  --color-bg: #FAF0E6;        /* Cream */
  --color-text: #333333;      /* Teks utama */
  --color-white: #FFFFFF;
  --color-pink: #F6A5C0;      /* Accent tambahan */
  --color-error: #FF6B6B;     /* Error color */
  --color-success: #51CF66;   /* Success color */
  
  /* Shadow variables */
  --shadow-light: 0 2px 8px rgba(162, 131, 210, 0.1);
  --shadow-medium: 0 4px 12px rgba(162, 131, 210, 0.15);
  --shadow-heavy: 0 8px 24px rgba(162, 131, 210, 0.2);
  
  /* Transition variables */
  --transition-fast: 0.2s ease;
  --transition-medium: 0.3s ease;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Fredoka", sans-serif;
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}

/* ================ APP BAR ================ */
.app-bar {
  background: linear-gradient(135deg, var(--color-primary) 0%, #9575cd 100%);
  color: var(--color-white);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-medium);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-bar .logo {
  height: 72px;
  transition: transform var(--transition-fast);
}

.app-bar .logo:hover {
  transform: scale(1.05);
}

.app-bar h1 {
  margin: 0;
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: clamp(1.5rem, 4vw, 2rem);
}

/* ================ CONTAINER ================ */
.container {
  padding: 2rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* ================ NOTE FORM ================ */
#add-note-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
  background: var(--color-white);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow-light);
  border: 2px solid transparent;
  transition: border-color var(--transition-medium);
}

#add-note-form:focus-within {
  border-color: var(--color-accent);
}

#add-note-form label {
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--color-text);
  margin-bottom: 0.25rem;
  display: block;
}

#add-note-form input,
#add-note-form textarea {
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  background: var(--color-white);
}

#add-note-form input:focus,
#add-note-form textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(162, 131, 210, 0.1);
}

#add-note-form textarea {
  min-height: 120px;
  resize: vertical;
  font-family: inherit;
}

.form-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: -0.5rem;
}

.error {
  color: var(--color-error);
  font-size: 0.8rem;
  font-weight: 500;
}

.char-count {
  font-size: 0.75rem;
  color: #666;
  font-weight: 500;
}

.char-count.warning {
  color: #ff9800;
}

.char-count.danger {
  color: var(--color-error);
}

#add-note-form button {
  background: linear-gradient(135deg, var(--color-primary) 0%, #9575cd 100%);
  color: var(--color-white);
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: all var(--transition-medium);
  box-shadow: var(--shadow-light);
  position: relative;
  overflow: hidden;
}

#add-note-form button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

#add-note-form button:active {
  transform: translateY(0);
}

#add-note-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ================ NOTES GRID ================ */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

/* ================ NOTE ITEM ================ */
.note-item {
  background: var(--color-white);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow-light);
  transition: all var(--transition-medium);
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.note-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-medium);
}

.note-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-heavy);
  border-color: rgba(162, 131, 210, 0.2);
}

.note-item:hover::before {
  transform: scaleX(1);
}

.note-item:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-medium), 0 0 0 3px rgba(162, 131, 210, 0.1);
}

.note-item.highlight {
  border-color: var(--color-accent);
  background: linear-gradient(135deg, #E6FAF5 0%, rgba(174, 225, 214, 0.1) 100%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.note-item.highlight::before {
  transform: scaleX(1);
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-primary) 100%);
}

/* Error state for invalid notes */
.note-item.error-state {
  border-color: var(--color-error);
  background: rgba(255, 107, 107, 0.05);
  cursor: default;
}

.note-item.error-state:hover {
  transform: none;
  box-shadow: var(--shadow-light);
}

/* ================ NOTE CONTENT ================ */
.note-header {
  margin-bottom: 0.75rem;
}

.note-title {
  margin: 0;
  font-size: 1.25rem;
  color: var(--color-primary);
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.note-body {
  margin: 0.75rem 0;
  flex-grow: 1;
}

.note-text {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.note-footer {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(162, 131, 210, 0.1);
}

.note-date {
  font-size: 0.8rem;
  color: #666;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 500;
}

.date-icon {
  font-size: 0.9rem;
}

.date-text {
  line-height: 1.2;
}

/* ================ RESPONSIVE DESIGN ================ */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }
  
  .notes-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  #add-note-form {
    padding: 1rem;
  }
  
  .note-item {
    padding: 1rem;
  }
}

/* ================ ACCESSIBILITY ================ */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .note-item {
    border: 2px solid var(--color-text);
  }
  
  .note-item.highlight {
    border: 3px solid var(--color-accent);
  }
}

.footer-bar {
  background: var(--color-primary);
  color: var(--color-white);
  text-align: center;
  padding: 1rem;
  margin-top: 2rem;
  font-size: 0.9rem;
  border-top: 3px solid var(--color-accent);
}

.footer-bar p {
  margin: 0;
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
}

.footer-bar .tagline {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--color-accent);
}
