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

body {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

main {
    position: relative;
    display: grid;
    grid-template-areas: "sidebar mainbar";
    grid-template-columns: 16rem 1fr;
    grid-template-rows: 1fr;
}

.sidebar {
    position: fixed;
    top: 3.5rem;
    bottom: 0;
    width: 16rem;
    grid-area: sidebar;
    padding: 2rem 1.5rem 1.5rem;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
}

.sidebar_list {
    list-style-type: none;
    font-size: 1rem;
}

.sidebar_list li {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    height: 2.5rem;
    margin: 0.7rem 0;
    background-color: var(--bg-primary);
}

.sidebar_list li a {
    height: 100%;
    display: grid;
    grid-template-columns: 3rem 1fr;
    grid-template-rows: 1fr;
    row-gap: 5px;
}

a:any-link {
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar_list li:hover {
    background-color: var(--deco-red-muted);
}

.item-svg {
    display: flex;
    flex-wrap: wrap;
    align-self: center;
    justify-self: center;
    stroke: var(--deco-red);
    color: var(--deco-red);
}

.item-name {
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    justify-content: start;
    font-size: 1rem;
}

.sidebar_list li:last-child {
    height: 3rem;
}

.sidebar_list li:last-child svg {
    height: 24px;
    width: 24px;
}

.settings {
    display: grid;
    grid-template-columns: 3rem 1fr;
    grid-template-rows: 1fr;
    row-gap: 5px;
    position: absolute;
    bottom: 2rem;
}

.mainbar {
    grid-area: mainbar;
    background-color: var(--bg-secondary);
}

/* Dashboard Navbar Styles */
.nav-bar {
    width: 100%;
    height: 3.5rem;
    background-color: var(--nav-bg);
    position: sticky;
    top: 0;
    left: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-content: center;
    padding: 0 3rem;
    border-bottom: 1px solid var(--border-color);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.brand-logo {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    object-fit: cover;
}

.brand h2 {
    font-size: 1.4rem;
}

.nav-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    align-content: center;
}

.nav-item {
    display: inline-block;
    margin-inline: 0.5rem;
    border-radius: 10px;
}

.add-btn {
    height: 2.5rem;
    width: 12rem;
    display: grid;
    /* padding: 0.5rem 1.5rem; */
    border-radius: 10px;
    grid-template-columns: 2rem 1fr;
    grid-template-rows: 1fr;
    column-gap: 0.5rem;
    background-color: #C54344;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    border: none;
    /* align-content: center;
    flex-wrap: wrap; */
}

.add-svg {
    grid-column: 1/2;
    grid-row: 1/2;
    display: flex;
    align-self: center;
    justify-self: end;
}

.add-item {
    grid-column: 2/3;
    grid-row: 1/2;
    display: flex;
    align-self: center;
    justify-self: start;
}

.add-btn:active {
    transform: translate3d(0px, 1px, -5px);
}

.toggle-theme {
    position: relative;
    height: 2rem;
    width: 3.8rem;
    border: var(--border-color) 1px solid;
    border-radius: 15px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
    align-self: center;
    cursor: pointer;
    background-color: var(--bg-primary);
}

.slider {
    width: 1.4rem;
    height: 1.4rem;
    background-color: var(--deco-red);
    border-radius: 50%;
    position: absolute;
    top: 4px;
    left: 4px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sun-theme,
.moon-theme {
    display: flex;
    flex-wrap: wrap;
    justify-self: center;
    align-self: center;
}

 
.navbar {
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0.875rem 2rem;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.logo {
    font-size: 1.5rem;
    color: #C54344;
}

.brand-name {
    color: var(--text-primary);
}

/* Removed dashboard-only navbar overrides that pushed the brand off-center. */

/* Breadcrumb */
.breadcrumb {
    max-width: 1400px;
    margin: 1.25rem auto 0;
    padding: 0 2rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.breadcrumb a {
    color: #6e6e73;
    text-decoration: none;
}

.breadcrumb a:hover {
    color: #1d1d1f;
}

.breadcrumb span {
    color: var(--text-primary);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 2rem 1.5rem;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 2.125rem;
    font-weight: 700;
    margin-bottom: 0.375rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.938rem;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.75rem;
    margin-bottom: 1.5rem;
}

/* Card */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.25rem;
    border: 1px solid var(--border-color);
}

.section-title {
    font-size: 1.063rem;
    font-weight: 600;
    margin-bottom: 1.125rem;
}

.type-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    background-color: var(--bg-secondary);
    border-radius: 10px;
    padding: 4px;
    border: 1px solid var(--border-color);
}

.type-btn {
    padding: 0.75rem 1.25rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.type-btn:hover {
    color: #1d1d1f;
}

.type-btn.active {
    background-color: var(--card-bg);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: var(--card-shadow);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.938rem;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #C54344;
}

.form-group input::placeholder {
    color: #86868b;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.875rem;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2.5rem 1.75rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--input-bg);
}

.upload-area:hover {
    border-color: #C54344;
    background-color: #f5f9ff;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 0.875rem;
    color: #C54344;
}

.upload-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.upload-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.link {
    color: #C54344;
    cursor: pointer;
}

.upload-info {
    color: #86868b;
    font-size: 0.813rem;
}

.image-preview {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.remove-btn {
    position: absolute;
    top: 0.875rem;
    right: 0.875rem;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Buttons */
.btn-primary {
    background-color: #C54344;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #083452;
}

.btn-secondary {
    background-color: white;
    color: #1d1d1f;
    border: 1px solid #d2d2d7;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background-color: #f5f5f7;
}
/* Dark Mode Styles (Cleaned up as variables handle most things) */
body.dark-mode .btn-secondary {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

body.dark-mode .btn-secondary:hover {
    background-color: var(--bg-secondary);
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.875rem;
}

/* Sidebar overrides simplified by variables */

/* Responsive */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .right-section {
        order: -1;
    }
}

@media (max-width: 768px) {
    main {
        grid-template-areas: "mainbar";
        grid-template-columns: 1fr;
        padding-bottom: 5rem;
    }

    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        top: auto;
        width: 100%;
        height: 5rem;
        padding: 0;
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        border-top: 1px solid #d0d0d0;
        border-right: none;
        z-index: 100;
        background-color: #fff;
    }

    body.dark-mode .sidebar {
        border-top: 1px solid #404040;
    }

    .sidebar h2 {
        display: none;
    }

    .sidebar_list {
        display: flex;
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        align-items: center;
        margin: 0;
        padding: 0;
    }

    .sidebar_list li {
        width: auto;
        height: 100%;
        border: none;
        margin: 0;
        flex: 1;
        display: flex;
        justify-content: center;
    }

    .sidebar_list li a {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 4px;
        padding: 0.5rem 0;
    }

    .item-name {
        font-size: 0.7rem;
        text-align: center;
        line-height: 1.1;
    }

    .settings {
        display: none;
    }

    .mainbar {
        margin-left: 0;
    }

    .nav-bar {
        padding: 0 0.8rem;
        height: 4rem;
        flex-wrap: nowrap;
        gap: 0.5rem;
    }

    .brand h2 {
        font-size: 1rem;
        white-space: nowrap;
    }

    .nav-actions {
        gap: 0.3rem;
        flex-wrap: nowrap;
    }

    .nav-bar .add-btn {
        width: 2.5rem !important;
        padding: 0 !important;
        grid-template-columns: 1fr !important;
        height: 2.5rem !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 0 !important;
    }

    .nav-bar .add-item {
        display: none !important;
    }
    
    .nav-bar .add-svg {
        margin: 0 !important;
        grid-column: unset !important;
        grid-row: unset !important;
    }

    .toggle-theme {
        margin-inline: 0.1rem;
        transform: scale(0.85);
    }

    .form-row {
        grid-template-columns: 1fr;
    }
    
    .type-selector {
        grid-template-columns: 1fr;
    }
    
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .container {
        padding: 1rem;
    }

    .breadcrumb {
        padding: 0 1rem;
    }
}
/* Location Entry Styling */
.location-entry {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
    padding: 14px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    align-items: center;
    box-shadow: var(--card-shadow);
}

.location-entry .location-select,
.location-entry .custom-location-input,
.location-entry .location-quantity {
    margin-bottom: 0 !important;
}

.remove-location-btn {
    background-color: #ff4d4f !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 0 14px !important;
    height: 42px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-location-btn:hover {
    background-color: #d9363e !important;
}
/* Photo Choice Modal Styles */
.choice-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 10000;
    transition: all 0.3s ease;
}

.choice-modal.open {
    display: flex;
}

.choice-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.choice-modal.open .choice-modal-backdrop {
    opacity: 1;
}

.choice-modal-content {
    background: var(--card-bg);
    width: min(100%, 400px);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.choice-modal.open .choice-modal-content {
    transform: scale(1);
    opacity: 1;
}

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

.choice-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

.close-choice-btn {
    background: var(--bg-secondary);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: 1rem;
}

.choice-options {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.choice-option-btn {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.choice-option-btn:hover {
    border-color: #C54344;
    background: var(--card-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.option-icon {
    font-size: 1.75rem;
}

.option-text {
    display: flex;
    flex-direction: column;
}

.option-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.option-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.choice-cancel-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    background: transparent;
    color: #C54344;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 12px;
}

.choice-cancel-btn:hover {
    background: var(--bg-secondary);
}

/* Mobile Action Sheet Style */
@media (max-width: 768px) {
    .choice-modal {
        align-items: flex-end;
        padding: 0;
    }

    .choice-modal-content {
        width: 100%;
        border-radius: 24px 24px 0 0;
        transform: translateY(100%);
        max-width: none;
        border-bottom: none;
    }

    .choice-modal.open .choice-modal-content {
        transform: translateY(0);
    }
}
