/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Navigation Bar */
.navbar {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar h1 {
    font-size: 1.5rem;
    color: #007bff;
}

.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 20px;
}

.login-container {
    max-width: 450px;
    margin-top: 5rem;
}

/* Login Box */
.login-box {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.login-box h1 {
    text-align: center;
    color: #007bff;
    margin-bottom: 0.5rem;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #666;
}

.default-accounts {
    margin-top: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 5px;
    font-size: 0.9rem;
}

.default-accounts h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.default-accounts code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-outline {
    background: transparent;
    color: #007bff;
    border: 2px solid #007bff;
}

.btn-outline:hover {
    background: #007bff;
    color: white;
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

.btn-icon {
    padding: 0.5rem;
    font-size: 1.2rem;
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.lists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.list-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.list-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.list-header h3 {
    margin: 0;
    color: #333;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

.status-badge.shopping {
    background: #fff3cd;
    color: #856404;
}

.status-badge.completed {
    background: #d1ecf1;
    color: #0c5460;
}

.list-info {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #666;
}

.list-info p {
    margin: 0.25rem 0;
}

.list-date {
    font-size: 0.85rem;
    color: #999;
}

.unavailable-notice {
    color: #dc3545;
    font-weight: 500;
}

.list-actions {
    display: flex;
    gap: 0.5rem;
}

.progress-bar {
    background: #e9ecef;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    background: #007bff;
    height: 100%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.9rem;
    color: #666;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #999;
    font-size: 1.1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

.modal-large {
    max-width: 800px;
}

.modal-fullscreen {
    max-width: 100%;
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
    overflow-y: auto;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover,
.close:focus {
    color: #000;
}

/* Items Display */
.items-list {
    margin-top: 1rem;
}

.items-table {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-header {
    background: #007bff;
    color: white;
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-radius: 5px;
    margin-top: 1rem;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    transition: background 0.2s;
}

.item-row:hover {
    background: #f8f9fa;
}

.item-row.checked {
    opacity: 0.6;
}

.item-row.unavailable {
    background: #fff3cd;
    border-color: #ffc107;
}

.item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.item-name {
    font-weight: 500;
    font-size: 1.1rem;
}

.item-row.checked .item-name {
    text-decoration: line-through;
}

.item-quantity {
    color: #666;
    font-size: 0.9rem;
}

.item-notes {
    color: #999;
    font-size: 0.85rem;
    font-style: italic;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
}

.replacement-info {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #fff;
    border-radius: 4px;
}

.unavailable-badge {
    background: #dc3545;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
}

.replacement-text {
    color: #28a745;
    font-weight: 500;
    margin-left: 0.5rem;
}

.replacement-notes {
    display: block;
    color: #666;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Shopping Interface */
.shopping-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #fff;
    border-bottom: 2px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.shopping-header .header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.shopping-stats {
    display: flex;
    justify-content: space-around;
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: #007bff;
}

.stat-label {
    font-size: 0.85rem;
    color: #666;
    text-transform: uppercase;
}

.shopping-items {
    padding: 1rem;
}

.category-header-shopping {
    background: #007bff;
    color: white;
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-radius: 5px;
    margin: 1rem 0 0.5rem 0;
    font-size: 1.1rem;
}

.shopping-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    transition: all 0.2s;
}

.shopping-item:hover {
    border-color: #007bff;
}

.shopping-item.checked {
    background: #f8f9fa;
    opacity: 0.7;
}

.shopping-item.unavailable {
    background: #fff3cd;
    border-color: #ffc107;
}

.item-checkbox input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
}

.item-details {
    flex: 1;
    cursor: pointer;
}

.item-main {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.item-name-label {
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
}

.shopping-item.checked .item-name-label {
    text-decoration: line-through;
    color: #999;
}

.item-quantity-badge {
    background: #007bff;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.item-notes-small {
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.item-actions-shopping {
    display: flex;
    gap: 0.5rem;
}

.unavailable-badge-shopping {
    background: #dc3545;
    color: white;
    padding: 0.5rem;
    border-radius: 5px;
    font-weight: 600;
    margin-top: 0.5rem;
    display: inline-block;
}

.replacement-info-shopping {
    color: #28a745;
    font-weight: 500;
}

.unavailable-item-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin: 1rem 0;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* LLM Helper Page */
.llm-helper-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.help-text {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.instructions-box {
    background: #e7f3ff;
    border-left: 4px solid #007bff;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 5px;
}

.instructions-box h3 {
    margin-top: 0;
    color: #007bff;
}

.instructions-box ul, .instructions-box ol {
    margin-left: 1.5rem;
    line-height: 1.8;
}

.prompt-box {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.prompt-header h4 {
    margin: 0;
}

.prompt-content pre {
    background: white;
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

.examples-section {
    margin: 2rem 0;
}

.example-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
    margin: 1rem 0;
}

.example-card {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.example-card h4 {
    margin-top: 0;
    color: #007bff;
}

.example-card pre {
    background: white;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    margin: 0;
}

.example-arrow {
    font-size: 2rem;
    color: #007bff;
    font-weight: bold;
}

.tips-section {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 5px;
}

.tips-section h3 {
    margin-top: 0;
    color: #856404;
}

.tips-section ul {
    margin-left: 1.5rem;
    line-height: 1.8;
}

.alternative-prompts {
    margin-top: 2rem;
}

.alt-prompt {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 1rem;
    margin: 1rem 0;
    position: relative;
}

.alt-prompt h4 {
    margin-top: 0;
    display: inline-block;
}

.alt-prompt button {
    float: right;
}

.alt-prompt pre {
    background: white;
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1rem;
    font-size: 0.85rem;
}

.user-list-placeholder {
    color: #999;
}

/* Store Layout Page */
.store-layout-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.layout-grid {
    display: grid;
    gap: 1rem;
    margin: 2rem 0;
}

.layout-card {
    display: flex;
    gap: 1rem;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s;
}

.layout-card:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.layout-order {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.order-badge {
    background: #007bff;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.order-controls {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.layout-content {
    flex: 1;
}

.layout-content h3 {
    margin-top: 0;
    color: #333;
}

.layout-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.layout-detail {
    display: flex;
    flex-direction: column;
}

.layout-detail.full-width {
    grid-column: 1 / -1;
}

.layout-detail label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.layout-detail input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.layout-examples {
    margin-top: 2rem;
}

.example-layouts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.example-layout-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
}

.example-layout-card h4 {
    color: #007bff;
    margin-top: 0;
}

.example-layout-card ol {
    margin-left: 1.5rem;
    line-height: 1.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .navbar h1 {
        font-size: 1.2rem;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        font-size: 0.9rem;
    }
    
    .lists-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 1rem;
    }
    
    .example-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .example-arrow {
        transform: rotate(90deg);
        text-align: center;
    }
    
    .layout-card {
        flex-direction: column;
    }
    
    .layout-details {
        grid-template-columns: 1fr;
    }
    
    .shopping-item {
        font-size: 0.95rem;
    }
    
    .item-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .shopping-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .shopping-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Animations for notifications and modals */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}
