/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Poppins:wght@300;400;500;600&display=swap');

:root {
    --bg: #FFFFFF;
    --surface: #FFD1DC;
    --surface-light: #FFE9EF;
    --text-primary: #1A1A1A;
    --text-secondary: #4A4A4A;
    --accent: #1A1A1A;
    --accent-hover: #333333;
    --border: #E5E5E5;
    --shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.08);
    
    --success: #4CAF50;
    --error: #f44336;
    --warning: #ff9800;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg);
    color: var(--text-primary);
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, .logo {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.app {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: var(--bg);
    position: relative;
    padding: 0 20px 40px;
}

/* Header */
.header {
    background: var(--bg);
    padding: 24px 0;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border);
    margin-bottom: 32px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-image {
    height: 40px;
    width: auto;
    border-radius: 8px;
}

.logo {
    font-size: 24px;
    color: var(--text-primary);
    margin: 0;
}

.logo span {
    color: var(--accent);
}

.cart-icon {
    position: relative;
    cursor: pointer;
    padding: 10px;
    font-size: 22px;
    color: var(--text-primary);
    transition: color 0.2s;
}

.cart-icon:hover {
    color: var(--accent);
}

.cart-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--accent);
    color: white;
    font-size: 12px;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 8px rgba(26, 26, 26, 0.2);
}

/* Categories */
.categories {
    display: flex;
    gap: 12px;
    padding: 0 0 32px 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.categories::-webkit-scrollbar {
    display: none;
}

.category {
    background: var(--surface-light);
    border: 1px solid var(--border);
    padding: 10px 24px;
    border-radius: 40px;
    font-size: 15px;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.category:hover {
    background: var(--surface);
    border-color: var(--surface);
    color: var(--text-primary);
}

.category.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Cakes Grid - 2 столбца */
.cakes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    padding: 0 0 40px;
}

.cake-card {
    background: var(--surface-light);
    border-radius: 24px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.cake-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--surface);
}

.cake-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--surface);
    transition: transform 0.5s ease;
}

.cake-card:hover .cake-image {
    transform: scale(1.03);
}

.cake-info {
    padding: 20px;
}

.cake-name {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: 18px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.cake-weight {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-family: 'Poppins', sans-serif;
}

.cake-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 12px 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: 'Poppins', sans-serif;
}

.cake-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
}

.cake-price {
    font-weight: 700;
    color: var(--accent);
    font-size: 22px;
    font-family: 'Playfair Display', serif;
}

.add-to-cart {
    background: var(--accent);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(26, 26, 26, 0.2);
}

.add-to-cart:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.add-to-cart.added {
    background: var(--success);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

/* Cart Panel */
.cart-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 420px;
    height: 100vh;
    background: var(--bg);
    box-shadow: var(--shadow-hover);
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border);
}

.cart-panel.open {
    right: 0;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.cart-header h2 {
    font-size: 20px;
    font-family: 'Playfair Display', serif;
    color: var(--text-primary);
}

.close-cart {
    background: var(--surface-light);
    border: 1px solid var(--border);
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-cart:hover {
    background: var(--surface);
    color: var(--text-primary);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--surface-light);
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg);
    border-radius: 16px;
    margin-bottom: 12px;
    animation: slideIn 0.2s ease;
    border: 1px solid var(--border);
}

.cart-item-image {
    width: 70px;
    height: 70px;
    border-radius: 12px;
    object-fit: cover;
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 16px;
    color: var(--text-primary);
}

.cart-item-price {
    color: var(--accent);
    font-weight: 600;
    font-size: 15px;
    font-family: 'Poppins', sans-serif;
}

.remove-item {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s;
}

.remove-item:hover {
    color: var(--error);
}

.cart-footer {
    padding: 24px;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.checkout-btn {
    width: 100%;
    padding: 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 16px;
    font-weight: 600;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(26, 26, 26, 0.2);
}

.checkout-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 26, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
}

.modal.open {
    display: flex;
}

.modal-content {
    background: var(--bg);
    border-radius: 32px;
    max-width: 100%;
    width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
    box-shadow: var(--shadow-hover);
    border: 1px solid var(--border);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-header h2 {
    font-size: 22px;
    font-family: 'Playfair Display', serif;
    color: var(--text-primary);
}

.close-modal {
    background: var(--surface-light);
    border: 1px solid var(--border);
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-modal:hover {
    background: var(--surface);
    color: var(--text-primary);
}

/* Order Form */
.order-form {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
}

input, textarea, select {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: 16px;
    background: var(--surface-light);
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.2s;
    font-family: 'Poppins', sans-serif;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg);
}

.order-summary {
    background: var(--surface-light);
    padding: 20px;
    border-radius: 20px;
    margin: 24px 0;
    border: 1px solid var(--border);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 15px;
    color: var(--text-secondary);
    font-family: 'Poppins', sans-serif;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
}

.submit-order {
    width: 100%;
    padding: 18px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(26, 26, 26, 0.2);
}

.submit-order:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    width: 90%;
    max-width: 400px;
}

.toast {
    background: var(--bg);
    color: var(--text-primary);
    padding: 16px 20px;
    border-radius: 100px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-hover);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideUp 0.3s ease;
    border-left: 4px solid var(--accent);
    font-weight: 500;
    border: 1px solid var(--border);
    font-family: 'Poppins', sans-serif;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--error);
}

.toast.warning {
    border-left-color: var(--warning);
}

/* Loading */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    margin-left: 12px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}

/* Empty state */
.empty-cart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    text-align: center;
    background: var(--surface-light);
    border-radius: 24px;
    border: 1px solid var(--border);
}

.empty-cart i {
    font-size: 48px;
    color: var(--border);
    margin-bottom: 16px;
}

/* Admin specific styles */
.admin-header h1 {
    font-family: 'Playfair Display', serif;
}

.admin-tab {
    font-family: 'Poppins', sans-serif;
}

.order-id, .cake-name, .category-name, .user-name {
    font-family: 'Playfair Display', serif;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .app {
        padding: 0 16px 30px;
    }

    .header {
        padding: 20px 0;
        margin-bottom: 24px;
    }

    .logo {
        font-size: 22px;
    }

    .logo-image {
        height: 35px;
    }

    .categories {
        padding-bottom: 24px;
    }

    .cakes-grid {
        gap: 16px;
    }

    .cake-info {
        padding: 16px;
    }

    .cake-name {
        font-size: 16px;
    }

    .cake-price {
        font-size: 20px;
    }

    .add-to-cart {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .cakes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .cake-info {
        padding: 12px;
    }

    .cake-name {
        font-size: 15px;
    }

    .cake-price {
        font-size: 18px;
    }

    .add-to-cart {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .logo-container {
        gap: 8px;
    }

    .logo-image {
        height: 30px;
    }

    .logo {
        font-size: 18px;
    }

    .modal-content {
        border-radius: 24px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .toast {
        padding: 14px 16px;
        font-size: 14px;
    }
}

@media (max-width: 360px) {
    .cake-name {
        font-size: 14px;
    }

    .cake-price {
        font-size: 16px;
    }

    .cake-weight {
        font-size: 12px;
    }
}
