/* Global Styles */
:root {
    --primary: #007bff;
    --secondary: #6c757d;
    --danger: #dc3545;
    --success: #28a745;
    --light: #f8f9fa;
    --dark: #212529;
    --border: #dee2e6;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light);
    color: var(--dark);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navbar */
.navbar {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 15px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar h1 {
    font-size: 24px;
    color: var(--primary);
}

.nav-items {
    display: flex;
    gap: 20px;
    align-items: center;
}

/* Auth Pages */
.page {
    display: none;
    padding: 40px 0;
}

.page.active {
    display: block;
}

#auth-container {
    display: none;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
}

#auth-container.active {
    display: flex;
}

#auth-container .container {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 400px;
}

#auth-container h1 {
    margin-bottom: 30px;
    text-align: center;
}

#auth-container form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#auth-container input {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
}

#auth-container p {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}

#auth-container a {
    color: var(--primary);
    text-decoration: none;
}

#auth-container a:hover {
    text-decoration: underline;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: inline-block;
}

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

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

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

.btn-secondary:hover {
    background-color: #545b62;
}

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

.btn-danger:hover {
    background-color: #c82333;
}

/* Lists Section */
.lists-section {
    padding: 40px 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 28px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.card h3 {
    margin-bottom: 10px;
}

.card p {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #999;
}

/* List Detail */
#list-detail {
    padding: 20px 0;
}

.list-detail-header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-detail-header h2 {
    margin: 0;
}

.list-actions {
    display: flex;
    gap: 10px;
}

.list-actions .btn {
    padding: 8px 16px;
    font-size: 13px;
}

/* Items */
.items-section {
    margin-top: 30px;
}

.items-list {
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s;
    position: relative;
}

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

.item:hover {
    background-color: var(--light);
}

.item-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.item-info input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.item-details h4 {
    margin: 0;
}

.item-details p {
    margin: 5px 0 0 0;
    color: #999;
    font-size: 13px;
}

.item.checked .item-details h4 {
    text-decoration: line-through;
    color: #999;
}

.item-quantity {
    font-weight: bold;
    margin: 0 20px;
}

.item-actions {
    display: flex;
    gap: 10px;
}

.item-actions button {
    padding: 5px 10px;
    font-size: 12px;
}

/* Mobile responsive - show delete button in top-right corner */
@media (max-width: 600px) {
    .item {
        padding: 15px 40px 15px 15px;
    }

    .item-quantity {
        display: none;
    }

    .item-actions {
        position: absolute;
        top: 10px;
        right: 10px;
        gap: 0;
    }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.modal-content h2 {
    margin-bottom: 20px;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-content input,
.modal-content select,
.modal-content textarea {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.modal-content textarea {
    resize: vertical;
    min-height: 100px;
}

.modal-content label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.modal-content input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: var(--dark);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 20px;
    background: #333;
    color: white;
    border-radius: 4px;
    display: none;
    z-index: 2000;
    max-width: 300px;
}

.toast.show {
    display: block;
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Admin Panel */
#admin-panel h2 {
    margin-bottom: 15px;
}

.pending-user {
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pending-user-info h4 {
    margin: 0 0 5px 0;
}

.pending-user-info p {
    margin: 0;
    font-size: 13px;
    color: #999;
}

/* Responsive */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .list-detail-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .list-actions {
        width: 100%;
        margin-top: 15px;
        flex-wrap: wrap;
    }

    .item {
        flex-direction: column;
        align-items: flex-start;
    }

    .item-quantity {
        margin-left: 0;
        margin-top: 10px;
    }

    .item-actions {
        margin-top: 10px;
        width: 100%;
    }

    .item-actions button {
        flex: 1;
    }
}

/* Page Header (for account and admin pages) */
.page-header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.page-header h2 {
    margin: 0;
    flex: 1;
}

/* Account Section */
.account-content,
.admin-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
}

.account-section,
.admin-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.account-section:last-child,
.admin-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.account-section h3,
.admin-section h3 {
    margin-bottom: 1rem;
    color: var(--dark);
}

#account-info p {
    margin: 0.75rem 0;
    font-size: 16px;
}

#account-info strong {
    display: inline-block;
    min-width: 120px;
}

.credential-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: white;
}

.credential-item:hover {
    background: var(--light);
}

/* Responsive for account page */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .credential-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .credential-item>div:last-child {
        width: 100%;
        display: flex;
        gap: 0.5rem;
    }

    .credential-item button {
        flex: 1;
    }
}