:root {
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --primary-color: #000000;
    --secondary-color: #666666;
    --border-color: #e0e0e0;
    --accent-color: #3b82f6;
    --danger-color: #ef4444;
    --spacing-unit: 1rem;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f172a;
        --text-color: #f1f5f9;
        --primary-color: #ffffff;
        --secondary-color: #94a3b8;
        --border-color: #334155;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-unit);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.logo {
    font-weight: 600;
    font-size: 1.25rem;
    text-decoration: none;
    color: var(--primary-color);
    letter-spacing: -0.025em;
}

nav ul {
    list-style: none;
    display: flex;
    gap: var(--spacing-unit);
}

nav a {
    text-decoration: none;
    color: var(--secondary-color);
    font-size: 0.85rem;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--primary-color);
}

main {
    flex: 1;
    padding: var(--spacing-unit);
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.hero {
    text-align: center;
    margin-top: calc(var(--spacing-unit) * 4);
}

h1 {
    font-size: 2.0rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.05em;
}

body.condensed-mode {
    font-size: 0.8rem;
}

body.condensed-mode h1 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

body.condensed-mode .list-card h3 {
    font-size: 1rem;
}

body.condensed-mode main {
    padding: var(--spacing-unit);
}

body.condensed-mode .item-row {
    padding: 0.25rem 0.5rem;
    /* Reduced padding */
    min-height: auto;
}

/* Swipe Actions */
.item-row {
    position: relative;
    overflow: hidden;
    /* transition: transform 0.2s ease-out; removed */
    background: var(--bg-secondary);
    /* From lists_detail.html */

    padding: 0.25rem 1rem;
    /* Reduced vertical padding as requested */
    display: flex;
    /* From lists_detail.html */
    align-items: center;
    /* From lists_detail.html */
    justify-content: space-between;
    /* From lists_detail.html */
}

.item-row.htmx-swapping,
.list-card-wrapper.htmx-swapping {
    opacity: 0;
    transition: opacity 0.3s ease-out;
}




.item-content {
    background: var(--bg-color);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
}


p {
    color: var(--secondary-color);
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.actions {
    display: flex;
    gap: var(--spacing-unit);
    justify-content: center;
}

.button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: opacity 0.2s;
    cursor: pointer;
    border: none;
}

.button:hover {
    opacity: 0.9;
}

.button.primary {
    background-color: var(--primary-color);
    color: var(--bg-color);
}

.button.secondary {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}



/* Forms */
input,
button,
textarea {
    font-family: inherit;
    font-size: 1rem;
}

.centred-form-container {
    max-width: 400px;
    margin: 2rem auto;
}

.auth-form {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: 8px;
    margin-top: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: border-color 0.2s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.error-message {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

small {
    display: block;
    margin-top: 0.25rem;
    color: var(--secondary-color);
    font-size: 0.85rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

/* Lists */
.lists-container {
    max-width: 800px;
    margin: 0 auto;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-actions:empty {
    display: none;
}

.lists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.5rem;
}

.list-card-wrapper {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding-left: 10px;
    /* Space for handle */
    padding-right: 15px;
    /* Space for actions */
    min-height: 0;
}

.list-card {
    flex: 1;
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    min-width: 0;
    /* Enable text truncation */
    padding: 0.5rem 1rem;
    text-align: left;
}

.list-card h3 {
    margin: 0;
}

.list-drag-handle {
    cursor: grab;
    color: var(--text-secondary);
    padding: 10px;
    user-select: none;
    flex-shrink: 0;
}

.list-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    margin-left: 10px;
}

.list-delete-btn {
    flex-shrink: 0;
    margin-left: 10px;
}

.list-meta {
    font-size: 0.875rem;
    color: var(--secondary-color);
}

/* List Details */
.list-detail-container {
    max-width: 600px;
    margin: 0 auto;
}

.add-item-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.add-item-form input {
    flex: 1;
}

.items-list {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.item-row {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.item-row:last-child {
    border-bottom: none;
}

.empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--secondary-color);
}

/* Import Page */
.list-import-container {
    max-width: 800px;
    margin: 0 auto;
}

textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-color);
    color: var(--text-color);
    resize: vertical;
    min-height: 400px;
    line-height: 1.6;
}

.button-group {
    display: flex;
    gap: 0.5rem;
}

/* Hamburger Menu */
.hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex-direction: column;
    justify-content: space-around;
    width: 1.5rem;
    height: 1.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
}

.hamburger-btn span {
    width: 1.5rem;
    height: 0.2rem;
    background: var(--secondary-color);
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

.nav-menu {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100%;
    background: var(--bg-color);
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease-in-out;
    z-index: 100;
    padding: 4rem 2rem;
}

.nav-menu.active {
    right: 0;
}

.nav-menu ul {
    flex-direction: column;
    align-items: flex-start;
}

.nav-menu li {
    width: 100%;
    margin-bottom: 1.5rem;
}

.nav-menu a,
.nav-menu button {
    font-size: 1rem;
    color: var(--text-color);
    width: 100%;
    text-align: left;
}

.nav-menu .logout-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    color: var(--secondary-color);
}

.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.menu-overlay.active {
    display: block;
}

/* Auth Links for non-logged in users */
.auth-links {
    display: flex;
    gap: var(--spacing-unit);
    list-style: none;
}

.auth-links a {
    text-decoration: none;
    color: var(--secondary-color);
    font-size: 0.95rem;
    transition: color 0.2s;
}

.auth-links a:hover {
    color: var(--primary-color);
}

/* Adjust Import Textarea */
.import-form textarea {
    min-height: 200px;
}



/* Item Row Layout - ported from lists_detail.html */
.item-left {
    display: flex;
    align-items: center;
    flex-grow: 1;
    overflow: hidden;
    margin-right: 10px;
}

.drag-handle {
    cursor: grab;
    padding-right: 15px;
    flex-shrink: 0;
    color: var(--secondary-color);
    user-select: none;
}

.item-content-wrapper {
    flex-grow: 1;
    min-width: 0;
}

.item-text {
    display: block;
    width: 100%;
    outline: none;
    word-break: break-word;
}

/* Heading Styles */
.item-row.is-heading {
    background: transparent;
    border-bottom: none;
    padding-top: 1.5rem;
}

.item-row.is-heading .item-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
}

.hidden-hash {
    display: none;
}

/* Archive Header Alignment */
.archived-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    margin-top: 2rem;
}

/* Delete Button Alignment */
.item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

@media (hover: hover) {
    .icon-btn:hover {
        color: var(--primary-color);
    }

    .icon-btn.danger:hover {
        color: var(--danger-color);
    }
}

.help-section {
    color: var(--secondary-color);
}

.help-section strong {
    color: var(--primary-color);
}