:root {
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --border-color: #dee2e6;
    --purchased-color: #198754;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #f8f9fa;
    --primary-color: #0d6efd;
    --secondary-color: #adb5bd;
    --border-color: #495057;
    --purchased-color: #20c997;
}

/* GENERAL BODY */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

/* HEADER */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: var(--primary-color);
    color: white;
}

/* THEME SWITCH */
.theme-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-color);
  transition: 0.4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary-color);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

/* APP BAR */
.app-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--primary-color);
    color: white;
}

.app-bar select {
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
}

[data-theme="dark"] .app-bar select {
    background-color: #1e1e1e;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

/* MENU */
.menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.menu input, .menu button {
    padding: 0.6rem;
    font-size: 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
}

.menu button {
    cursor: pointer;
}

.danger {
    background-color: #dc3545;
    color: white;
}

.hidden { display: none; }

/* ITEM LIST */
.item-list { padding-bottom: 120px; }

.item-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: white;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s;
}

[data-theme="dark"] .item-card {
    background: #1e1e1e;
}

.item-card.purchased .item-text {
    text-decoration: line-through;
    color: var(--purchased-color);
}

.item-text { flex: 1; }

.delete-btn {
    background: none;
    border: none;
    color: var(--secondary-color);
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
}

/* FLOATING BUTTON */
.fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-size: 2rem;
    border: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* BOTTOM SHEET */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-color);
    padding: 1rem;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.2);
    transition: background-color 0.3s, color 0.3s;
}

.bottom-sheet input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
}

.bottom-sheet button {
    width: 100%;
    padding: 0.75rem;
    border-radius: 6px;
    border: none;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
}

/* NO LISTS */
.no-lists {
    padding: 2rem;
    text-align: center;
}

.no-lists input, .no-lists button {
    padding: 0.75rem;
    margin-top: 0.5rem;
    width: 80%;
    max-width: 300px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
}

.no-lists button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
}

/* Login form styling */
.login-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 20px;
    text-align: center;
    background: var(--bg-color);
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    width: 90%; /* Ensures it doesn't stretch too wide on small screens */
}

.login-container input[type="text"],
.login-container input[type="password"] {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box; /* Ensures padding doesn't affect width */
    font-size: 16px; /* Makes text readable on mobile */
}

.login-container button {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
}

.login-container label {
    display: block;
    margin: 10px 0;
    text-align: left;
    font-size: 14px;
}

/* Alert messages */
.alert {
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    color: white;
    background: #dc3545;
    font-size: 14px;
}

/* Responsive adjustments for mobile */
@media (max-width: 600px) {
    .login-container {
        margin: 20px auto;
        padding: 15px;
    }
}