:root {
    --bg: #f5f7fb;
    --card: #fff;
    --hover: #d3d3d3;
    --secondary: #edf2f7;
    --secondary-hover: #cdd6e2;
    --accent: #2b6cb0;
    --accent-hover: #2c5282;
}

* {
    box-sizing: border-box;
}

body {
    font-family: DM Sans, sans-serif;
    margin: 0;
    background: var(--bg);
    color: #111;
}

header {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 100;
    background: linear-gradient(90deg, var(--accent), #2c5282);
    color: white;
    padding: 20px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header h1 {
    margin: 0;
    font-size: 18px;
}

.logo-icon {
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-right: 6px;
}

.container {
    max-width: 1100px;
    margin: 24px auto;
    padding: 0 16px;
}

.controls {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.controls input[type=text] {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.controls button {
    padding: 10px 14px;
    border-radius: 8px;
    border: 0;
    background: var(--accent);
    color: white;
    cursor: pointer;
}
.controls button:hover {
    background-color: var(--accent-hover);
}

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

.card {
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.card-body {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.title {
    font-weight: 600;
    margin-bottom: 6px;
}

.price {
    margin-top: auto;
    font-weight: 700;
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.btn {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
}
.btn:hover {
    background-color: var(--hover);
}

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

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.5);
}

.modal-panel {
    position: relative;
    background: var(--card);
    width: 360px;
    max-width: calc(100% - 32px);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 30px rgba(2, 6, 23, 0.2);
    z-index: 1;

    transform: translateY(-20px);
    opacity: 0;
    transition: all 0.3s ease;
}

.modal.show .modal-panel {
    transform: translateY(0);
    opacity: 1;
}

.modal-close {
    position: absolute;
    right: 10px;
    top: 10px;
    border: 0;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
    border-radius: 10px;
}

.cart-items {
    max-height: 70vh;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    gap: 8px;
    align-items: center;
    border-bottom: 1px dashed #e6eef8;
    padding: 8px 0;
}

.cart-item img {
    width: 56px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
}

.qty-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}

.total {
    font-weight: 800;
    margin-top: 12px;
    text-align: right;
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
}

button {
    transition: background 0.2s ease, transform 0.1s ease;
}
button:hover {
    background-color: #2c5282;
}
button:active {
    transform: scale(0.96);
}

@media (max-width: 600px) {
    .modal {
        align-items: flex-end;
    }

    .modal-panel {
        width: 100%;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }
}
