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

:root {
    --primary-color: #4285F4;
    --primary-color-dark: #3367D6;
    --primary-color-light: #5BA0F5;
    --accent-color: #4285F4;
    --bg-color: #F5F5F5;
    --card-bg: #FFFFFF;
    --text-primary: #202124;
    --text-secondary: #5F6368;
    --border-color: #E8EAED;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-hover: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Bree, Avenir;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.app-container {
    max-width: 100%;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
}

/* Header */
.header {
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.3px;
    color: var(--text-primary);
}

.cart-icon {
    position: relative;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    background: var(--bg-color);
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.cart-icon:hover {
    background: var(--border-color);
}

.cart-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    border: 2px solid var(--card-bg);
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error Message */
.error-message {
    background: #FFE5E5;
    color: #D32F2F;
    padding: 16px 20px;
    margin: 20px;
    border-radius: 8px;
    border-left: 4px solid #D32F2F;
}

/* Search Bar */
.search-container {
    padding: 12px 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    border-radius: 24px;
    padding: 10px 16px;
    gap: 12px;
}

.search-icon {
    font-size: 18px;
    color: var(--text-secondary);
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    color: var(--text-primary);
    outline: none;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    padding: 20px;
}

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

.good-card {
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

.good-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color-light);
}

.good-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: linear-gradient(135deg, #FAF9F7 0%, #F0EDEA 100%);
}

.good-info {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 120px;
}

.good-name {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--text-primary);
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: block;
}

.good-price {
    font-size: 18px;
    font-weight: 500;
    color: var(--primary-color);
    margin-top: auto;
    padding-top: 8px;
}

.good-actions {
    padding: 0 16px 16px;
    display: flex;
    gap: 10px;
}

.btn-add {
    flex: 1;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-add:hover {
    background: var(--primary-color-dark);
    box-shadow: 0 2px 4px rgba(66, 133, 244, 0.3);
}

.btn-add:active {
    transform: scale(0.98);
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.quantity-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--primary-color);
    border-radius: 50%;
    font-size: 20px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.quantity-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

.quantity-value {
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

/* Cart Sidebar */
.cart-sidebar {
    position: fixed;
    right: -100%;
    top: 0;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: var(--card-bg);
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}

.cart-sidebar.open {
    right: 0;
}

.cart-header {
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.cart-header h2 {
    font-size: 20px;
}

.close-cart {
    background: var(--bg-color);
    border: none;
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-cart:hover {
    background: var(--border-color);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
}

.cart-item-price {
    color: var(--text-secondary);
    font-size: 12px;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-item-quantity {
    font-weight: 600;
    min-width: 30px;
    text-align: center;
}

.cart-footer {
    padding: 20px;
    border-top: 2px solid var(--border-color);
    background: var(--bg-color);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.order-time-info {
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    text-align: center;
}

.order-time-allowed {
    background: #E8F5E9;
    color: #2E7D32;
    border: 1px solid #4CAF50;
}

.order-time-restricted {
    background: #FFEBEE;
    color: #C62828;
    border: 1px solid #F44336;
}

.btn-order {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-order:hover {
    background: var(--primary-color-dark);
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3);
}

.btn-order:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

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

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 500;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.1);
}

.order-summary {
    background: var(--bg-color);
    padding: 16px;
    border-radius: 8px;
    margin: 20px 0;
}

.order-summary h3 {
    margin-bottom: 12px;
    font-size: 16px;
}

.order-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

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

.order-total {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 18px;
    color: var(--text-primary);
    font-weight: 500;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn-cancel,
.btn-submit,
.btn-ok {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-cancel:hover {
    background: #e0e0e0;
}

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

.btn-submit:hover {
    background: var(--primary-color-dark);
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3);
}

.success-modal {
    text-align: center;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: #4CAF50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    margin: 0 auto 20px;
}

.success-modal h2 {
    color: #4CAF50;
    margin-bottom: 12px;
}

.success-modal p {
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
}

.success-modal p:last-child {
    margin-bottom: 24px;
}

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

.btn-ok:hover {
    background: var(--primary-color-dark);
}

/* Empty Cart */
.empty-cart {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-cart-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.cart-item-name {
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.cart-item-price {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Responsive */
@media (max-width: 480px) {
    .goods-grid {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
        gap: 16px;
    }

    .good-image {
        height: 160px;
    }

    .cart-sidebar {
        max-width: 100%;
    }
}

