@import url('https://fonts.googleapis.com/css2?family=Pacifico&display=swap');

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  --font-display: 'Pacifico', cursive;

  --primary-color: #F54291;
  --primary-color-dark: #d42c7a;
  --secondary-color: #8a9198;
  --success-color: #5A9A78;
  --danger-color: #dc3545;

  --background-color: #121212;
  --text-color: #e0e0e0;
  --card-bg: #1e1e1e;
  --border-color: #333333;
}

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

#root {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 500px;
  margin: 0 auto;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  background-color: var(--card-bg);
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header h1 {
  margin: 0;
  font-size: 2.2rem;
  text-align: center;
  flex-grow: 1;
  font-family: var(--font-display);
  font-weight: 400;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lang-toggle, .header-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 0;
    border-radius: 5px;
    cursor: pointer;
    min-width: 40px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s;
}
.lang-toggle {
    font-weight: bold;
    font-size: 0.9rem;
    padding: 0.3rem 0.6rem;
}
.header-btn:hover, .lang-toggle:hover {
    background: rgba(255,255,255,0.3);
}

.page {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.5s ease-in-out;
}

.home-page {
  text-align: center;
  justify-content: space-between;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-title {
  margin-top: 0;
  margin-bottom: 2rem;
  text-align: center;
  color: var(--primary-color);
}

.tips {
  background-color: var(--background-color);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-color);
  padding: 1rem;
  margin: 1.5rem 0;
  border-radius: 4px;
  text-align: left;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.tips ul {
  padding-left: 1.2rem;
  margin: 0;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: auto; /* Pushes button to bottom */
  padding-top: 1rem;
}

.single-button-group {
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
  font-weight: bold;
  text-align: center;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  text-decoration: none;
  color: white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transform: translateY(0);
}
.btn:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}
.btn:active {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  transform: translateY(0);
}

.btn svg {
  width: 1.2em;
  height: 1.2em;
}

.btn-primary {
  background-color: var(--primary-color);
}
.btn-primary:hover {
  background-color: var(--primary-color-dark);
}

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

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

.btn-danger {
  background-color: var(--danger-color);
}
.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

/* --- Lipstick Page --- */
.preview-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.user-photo-preview {
  width: 150px;
  height: 150px;
  border-radius: 12px;
  object-fit: cover;
  border: 3px solid var(--border-color);
}

.lipstick-photo-preview {
  width: 100px;
  height: 100px;
  border-radius: 12px;
  object-fit: cover;
  border: 3px solid var(--primary-color);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.prompt-info {
  text-align: center;
  color: var(--secondary-color);
  margin-bottom: 1.5rem;
}
.lipstick-page-info {
  margin-top: 1rem;
  margin-bottom: 1rem;
}


/* --- Result Page --- */

.result-image-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.gallery-item {
  text-align: center;
}

.gallery-item img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-bottom: 0.5rem;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.gallery-item p {
  margin: 0;
  font-weight: bold;
  font-size: 0.9rem;
  color: var(--secondary-color);
}

.color-info-box, .recommendations-box {
  background-color: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.color-info-box h3, .recommendations-box h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--primary-color);
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.lipstick-brand, .lipstick-name {
  margin: 0.25rem 0;
  font-size: 0.9rem;
}
.lipstick-brand span, .lipstick-name span {
  font-weight: bold;
  color: var(--secondary-color);
}

.color-display {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
}

.color-display .color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
}

.color-display .color-hex {
  font-family: monospace;
  font-size: 1.1rem;
  font-weight: bold;
}

.recommendations-text {
  font-family: var(--font-sans);
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
}


.back-button {
  background: none;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.5rem 0;
  margin-bottom: 1rem;
  align-self: flex-start;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  color: white;
  flex-direction: column;
  backdrop-filter: blur(5px);
}

.spinner {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top: 4px solid #fff;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Disclaimer Box */
.disclaimer-box {
    border-top: 1px solid var(--border-color);
    margin-top: 1rem;
    padding-top: 1rem;
    text-align: left;
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.disclaimer-box h3 {
    text-align: center;
    color: var(--text-color);
    font-size: 1rem;
    margin: 0 0 1rem 0;
}

.disclaimer-item {
    margin-bottom: 0.5rem;
}

.disclaimer-item p {
    margin: 0.25rem 0 0 0;
}

.disclaimer-item strong {
    color: var(--text-color);
}

/* History Modal */
.history-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

.history-modal {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    width: 90%;
    max-width: 450px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.history-modal-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.close-btn {
    background: none;
    border: none;
    color: var(--secondary-color);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.history-list {
    padding: 1rem;
    overflow-y: auto;
    flex-grow: 1;
}
.history-empty {
    text-align: center;
    color: var(--secondary-color);
    padding: 2rem;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    background-color: var(--background-color);
    margin-bottom: 0.75rem;
}

.history-item-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}

.history-item-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
}
.history-item-info strong, .history-item-info span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-info strong {
    font-size: 1rem;
}
.history-item-info span {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.history-item .btn {
    flex-shrink: 0;
    width: auto;
}

.history-modal-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}
