:root {
    --bg-color: #f8f9fc;
    --text-color: #1a1a2e;
    --header-bg: #ffffff;
    --card-bg: #ffffff;
    --border-color: #e0e4f0;
    --primary-color: #6366f1;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --hover-color: #4f46e5;
    --tag-bg: #f1f5f9;
    --shadow-light: rgba(99, 102, 241, 0.08);
    --shadow-medium: rgba(99, 102, 241, 0.15);
    --shadow-strong: rgba(99, 102, 241, 0.25);
    --success-color: #10b981;
    --error-color: #ef4444;
}

[data-theme="dark"] {
    --bg-color: #0f0f1e;
    --text-color: #e5e7eb;
    --header-bg: #1a1a2e;
    --card-bg: #1e1e2e;
    --border-color: #2a2a3e;
    --primary-color: #818cf8;
    --primary-gradient: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
    --secondary-gradient: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
    --accent-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --hover-color: #a78bfa;
    --tag-bg: #2a2a3e;
    --shadow-light: rgba(129, 140, 248, 0.15);
    --shadow-medium: rgba(129, 140, 248, 0.25);
    --shadow-strong: rgba(129, 140, 248, 0.35);
}

[data-theme="brown"] {
    --bg-color: #f5f1ed;
    --text-color: #2d1f1a;
    --header-bg: #faf7f4;
    --card-bg: #ffffff;
    --border-color: #e8ddd4;
    --primary-color: #8b5a3c;
    --primary-gradient: linear-gradient(135deg, #a06b4a 0%, #7d4e2d 100%);
    --secondary-gradient: linear-gradient(135deg, #d4a574 0%, #b8865f 100%);
    --accent-gradient: linear-gradient(135deg, #c9a882 0%, #a67c52 100%);
    --hover-color: #6d4428;
    --tag-bg: #f0e6dc;
    --shadow-light: rgba(139, 90, 60, 0.08);
    --shadow-medium: rgba(139, 90, 60, 0.15);
    --shadow-strong: rgba(139, 90, 60, 0.25);
}

/* Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
    min-height: 100vh;
}

/* Header */
header {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 40px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px var(--shadow-light);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] header {
    background: rgba(26, 26, 46, 0.95);
}

[data-theme="brown"] header {
    background: rgba(250, 247, 244, 0.95);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--primary-color);
}

.actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Theme Toggle */
.theme-toggle {
    position: relative;
}

#theme-toggle-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.2em;
    padding: 10px;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s;
}

#theme-toggle-btn:hover {
    background-color: var(--tag-bg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-light);
    overflow: hidden;
    width: 120px;
    padding: 5px 0;
}

.dropdown-menu button {
    display: block;
    width: 100%;
    padding: 8px 15px;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

.dropdown-menu button:hover {
    background-color: var(--tag-bg);
}

.hidden {
    display: none;
}

/* Main Cart Container */
.cart-container {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 40px;
}

.cart-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
    align-items: start;
}

/* Product List Section */
.cart-products-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px var(--shadow-light);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.section-header h2 {
    font-size: 1.1em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-color);
    opacity: 0.8;
}

.total-header {
    margin-right: 20px;
}

/* Cart Items */
.cart-items {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.cart-item {
    display: grid;
    grid-template-columns: 100px 1fr auto;
    gap: 20px;
    align-items: center;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 12px;
    transition: all 0.3s ease;
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cart-item:hover {
    box-shadow: 0 4px 15px var(--shadow-light);
    transform: translateY(-2px);
}

.cart-item.removing {
    animation: slideOut 0.4s ease forwards;
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-100%);
    }
}

.item-image {
    width: 100px;
    height: 100px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--card-bg);
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item-name {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-color);
}

.item-vendor {
    font-size: 0.9em;
    color: var(--text-color);
    opacity: 0.6;
}

.item-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px 10px;
}

.quantity-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

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

.quantity-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

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

.delete-item-btn {
    background: none;
    border: none;
    color: var(--error-color);
    font-size: 1.2em;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 50%;
    transition: all 0.2s;
}

.delete-item-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.1);
}

.item-price-section {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.item-price {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--text-color);
}

.item-subtotal-label {
    font-size: 0.85em;
    opacity: 0.6;
}

/* Empty Cart */
.empty-cart {
    text-align: center;
    padding: 80px 20px;
}

.empty-cart i {
    font-size: 5em;
    color: var(--border-color);
    margin-bottom: 20px;
}

.empty-cart h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
}

.empty-cart p {
    color: var(--text-color);
    opacity: 0.6;
}

/* Cart Footer */
.cart-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.help-text {
    font-size: 0.9em;
    margin-bottom: 15px;
    color: var(--text-color);
    opacity: 0.7;
}

.help-text a {
    color: var(--primary-color);
    text-decoration: none;
}

.help-text a:hover {
    text-decoration: underline;
}

.back-btn {
    background: var(--tag-bg);
    color: var(--text-color);
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.back-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(-5px);
}

/* Order Summary Panel */
.order-summary-panel {
    position: sticky;
    top: 100px;
}

.order-summary-sticky {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 30px var(--shadow-medium);
    color: white;
}

[data-theme="dark"] .order-summary-sticky {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

[data-theme="brown"] .order-summary-sticky {
    background: linear-gradient(135deg, #7c2d12 0%, #92400e 100%);
}

.order-summary-sticky h2 {
    font-size: 1.5em;
    margin-bottom: 25px;
    font-weight: 700;
}

.summary-details {
    margin-bottom: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 1em;
}

.summary-row span:first-child {
    opacity: 0.9;
}

.summary-row span:last-child {
    font-weight: 600;
}

.discount-row {
    color: var(--success-color);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Coupon Section */
.coupon-section {
    margin: 25px 0;
    padding: 20px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.coupon-toggle {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    padding: 12px 15px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.coupon-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

.coupon-toggle i {
    transition: transform 0.3s;
}

.coupon-toggle.collapsed i {
    transform: rotate(180deg);
}

.coupon-form {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    animation: expandDown 0.3s ease;
}

@keyframes expandDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 100px;
    }
}

.coupon-form.hidden {
    display: none;
}

#coupon-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1em;
}

#coupon-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#coupon-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
}

.apply-coupon-btn {
    background: white;
    color: var(--primary-color);
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    transition: all 0.3s ease;
}

.apply-coupon-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.coupon-message {
    margin-top: 10px;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9em;
    animation: fadeIn 0.3s ease;
}

.coupon-message.success {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.coupon-message.error {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Summary Total */
.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 25px 0;
    padding: 20px 0;
    font-size: 1.3em;
    font-weight: 700;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
}

/* Checkout Button */
.checkout-btn {
    width: 100%;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #1a1a2e;
    border: none;
    padding: 16px;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
}

.checkout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(251, 191, 36, 0.6);
}

.checkout-btn:active {
    transform: translateY(0);
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--success-color);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    animation: slideInRight 0.4s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.toast-notification i {
    font-size: 1.3em;
}

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

    .order-summary-panel {
        position: static;
    }
}

@media (max-width: 768px) {
    .cart-container {
        padding: 0 20px;
        margin: 20px auto;
    }

    .cart-products-section {
        padding: 20px;
    }

    .cart-item {
        grid-template-columns: 80px 1fr;
        gap: 15px;
    }

    .item-price-section {
        grid-column: 2;
        align-items: flex-start;
        margin-top: 10px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .total-header {
        margin-right: 0;
    }
}
