/**
 * CSS untuk Keranjang Belanja GuruSinergi
 * 
 * Styling untuk keranjang belanja dan komponen terkait
 */

/* Variabel CSS (dapat disesuaikan) */
:root {
    --gs-primary-color: #4273FA;
    --gs-secondary-color: #8A56FF;
    --gs-success-color: #2ecc71;
    --gs-danger-color: #e74c3c;
    --gs-warning-color: #f39c12;
    --gs-info-color: #3498db;
    --gs-light-color: #f8f9fa;
    --gs-dark-color: #343a40;
    --gs-white-color: #ffffff;
    --gs-black-color: #222222;
    --gs-gray-color: #6c757d;
    --gs-light-gray-color: #e9ecef;
    
    --gs-border-radius: 6px;
    --gs-box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --gs-transition: all 0.3s ease;
    
    --gs-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Reset beberapa styling default */
.gs-button,
.gs-add-to-cart-button,
.gs-mini-cart-toggle,
.gs-cart-qty-minus,
.gs-cart-qty-plus,
.gs-cart-item-remove,
.gs-mini-cart-close {
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--gs-font-family);
    padding: 0;
    margin: 0;
    outline: none;
}

/* Tombol Umum */
.gs-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: var(--gs-border-radius);
    font-size: 14px;
    line-height: 1.5;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    transition: var(--gs-transition);
    cursor: pointer;
    background-color: var(--gs-light-gray-color);
    color: var(--gs-dark-color);
}

.gs-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: var(--gs-box-shadow);
}

.gs-button-primary {
    background: linear-gradient(135deg, var(--gs-primary-color), var(--gs-secondary-color));
    color: var(--gs-white-color);
}

.gs-button-secondary {
    background-color: var(--gs-light-gray-color);
    color: var(--gs-dark-color);
}

.gs-button-success {
    background-color: var(--gs-success-color);
    color: var(--gs-white-color);
}

.gs-button-danger {
    background-color: var(--gs-danger-color);
    color: var(--gs-white-color);
}

.gs-button-block {
    display: block;
    width: 100%;
    margin-bottom: 10px;
}

.gs-button-small {
    padding: 5px 10px;
    font-size: 12px;
}

/* Tombol Tambah ke Keranjang */
.gs-add-to-cart-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: var(--gs-border-radius);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    background: linear-gradient(135deg, var(--gs-primary-color), var(--gs-secondary-color));
    color: var(--gs-white-color);
    transition: var(--gs-transition);
    box-shadow: var(--gs-box-shadow);
}

.gs-add-to-cart-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.gs-add-to-cart-button .gs-cart-icon {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    fill: currentColor;
}

.gs-add-to-cart-button.is-adding {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

.gs-add-to-cart-button.is-adding::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--gs-white-color);
    border-radius: 50%;
    animation: gs-spin 0.8s infinite linear;
}

.gs-add-to-cart-button.is-adding .gs-button-text,
.gs-add-to-cart-button.is-adding .gs-cart-icon {
    opacity: 0;
}

.gs-add-to-cart-button.is-added {
    background: var(--gs-success-color);
}

@keyframes gs-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mini Cart */
.gs-mini-cart-wrapper {
    position: relative;
    display: inline-block;
}

.gs-mini-cart-toggle {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: var(--gs-border-radius);
    transition: var(--gs-transition);
    background-color: transparent;
}

.gs-mini-cart-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.gs-mini-cart-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gs-mini-cart-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.gs-mini-cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 10px;
    font-weight: bold;
    border-radius: 50%;
    background-color: var(--gs-primary-color);
    color: var(--gs-white-color);
}

.gs-mini-cart-summary {
    margin-left: 8px;
    text-align: left;
}

.gs-mini-cart-label {
    display: block;
    font-size: 12px;
    line-height: 1.2;
    color: var(--gs-gray-color);
}

.gs-mini-cart-total {
    display: block;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
}

.gs-mini-cart-icon-only .gs-mini-cart-summary {
    display: none;
}

.gs-mini-cart-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 300px;
    max-width: 90vw;
    background-color: var(--gs-white-color);
    border-radius: var(--gs-border-radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--gs-transition);
}

.gs-mini-cart-wrapper.is-active .gs-mini-cart-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.gs-mini-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gs-light-gray-color);
}

.gs-mini-cart-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.gs-mini-cart-close {
    font-size: 20px;
    color: var(--gs-gray-color);
    transition: var(--gs-transition);
}

.gs-mini-cart-close:hover {
    color: var(--gs-danger-color);
}

.gs-mini-cart-content {
    max-height: 70vh;
    overflow-y: auto;
    padding: 16px;
}

.gs-cart-empty {
    padding: 20px;
    text-align: center;
    color: var(--gs-gray-color);
}

.gs-cart-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.gs-cart-item {
    display: flex;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--gs-light-gray-color);
}

.gs-cart-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.gs-cart-item-thumbnail {
    width: 60px;
    height: 60px;
    margin-right: 10px;
}

.gs-cart-item-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--gs-border-radius);
}

.gs-cart-item-details {
    flex-grow: 1;
    position: relative;
    padding-right: 20px;
}

.gs-cart-item-title {
    margin: 0 0 5px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
}

.gs-cart-item-price {
    font-size: 13px;
    color: var(--gs-gray-color);
    margin-bottom: 5px;
}

.gs-cart-item-quantity {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.gs-cart-qty-minus,
.gs-cart-qty-plus {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background-color: var(--gs-light-gray-color);
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    transition: var(--gs-transition);
}

.gs-cart-qty-minus:hover,
.gs-cart-qty-plus:hover {
    background-color: var(--gs-primary-color);
    color: var(--gs-white-color);
}

.gs-cart-qty-input {
    width: 40px;
    height: 24px;
    margin: 0 5px;
    padding: 0 5px;
    border: 1px solid var(--gs-light-gray-color);
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

.gs-cart-qty-input::-webkit-inner-spin-button, 
.gs-cart-qty-input::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}

.gs-cart-item-subtotal {
    font-size: 14px;
    font-weight: 500;
}

.gs-cart-item-remove {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 20px;
    color: var(--gs-gray-color);
    transition: var(--gs-transition);
}

.gs-cart-item-remove:hover {
    color: var(--gs-danger-color);
}

.gs-cart-summary {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--gs-light-gray-color);
}

.gs-cart-subtotal,
.gs-cart-discount,
.gs-cart-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 14px;
}

.gs-cart-total {
    font-weight: 600;
    font-size: 16px;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px dashed var(--gs-light-gray-color);
}

.gs-cart-actions {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Halaman Keranjang Belanja */
.gs-cart-page-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

.gs-cart-page-title {
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: 600;
    text-align: center;
}

.gs-cart-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

.gs-cart-items-table th,
.gs-cart-items-table td {
    padding: 15px;
    border-bottom: 1px solid var(--gs-light-gray-color);
    text-align: left;
    vertical-align: middle;
}

.gs-cart-items-table th {
    font-weight: 600;
    color: var(--gs-dark-color);
    background-color: var(--gs-light-color);
}

.gs-cart-item-col-image {
    width: 80px;
}

.gs-cart-item-col-name {
    width: 40%;
}

.gs-cart-item-col-price,
.gs-cart-item-col-qty,
.gs-cart-item-col-subtotal {
    width: 15%;
}

.gs-cart-item-col-remove {
    width: 50px;
    text-align: center;
}

.gs-cart-items-table img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--gs-border-radius);
}

.gs-cart-items-table a {
    color: var(--gs-dark-color);
    text-decoration: none;
    transition: var(--gs-transition);
}

.gs-cart-items-table a:hover {
    color: var(--gs-primary-color);
}

.gs-cart-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-top: 30px;
}

.gs-cart-coupon,
.gs-cart-totals {
    flex: 1;
    min-width: 300px;
}

.gs-cart-coupon h3,
.gs-cart-totals h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
}

.gs-coupon-form {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.gs-coupon-form input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--gs-light-gray-color);
    border-radius: var(--gs-border-radius);
    font-size: 14px;
}

.gs-active-coupon {
    background-color: rgba(46, 204, 113, 0.1);
    padding: 10px 15px;
    border-radius: var(--gs-border-radius);
    margin-top: 10px;
}

.gs-active-coupon p {
    margin: 0 0 10px;
}

.gs-cart-totals-table {
    width: 100%;
    margin-bottom: 20px;
}

.gs-cart-totals-table th,
.gs-cart-totals-table td {
    padding: 10px 0;
    border-bottom: 1px solid var(--gs-light-gray-color);
}

.gs-cart-totals-table th {
    text-align: left;
    font-weight: 500;
}

.gs-cart-totals-table td {
    text-align: right;
}

.gs-cart-total-row {
    font-weight: 600;
    font-size: 18px;
}

.gs-cart-checkout {
    margin-top: 20px;
}

/* Notifikasi */
.gs-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--gs-border-radius);
    color: var(--gs-white-color);
    background-color: var(--gs-dark-color);
    box-shadow: var(--gs-box-shadow);
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--gs-transition);
}

.gs-notification.is-active {
    opacity: 1;
    transform: translateY(0);
}

.gs-notification-success {
    background-color: var(--gs-success-color);
}

.gs-notification-error {
    background-color: var(--gs-danger-color);
}

/* Responsif */
@media (max-width: 768px) {
    .gs-cart-items-table {
        display: block;
        overflow-x: auto;
    }
    
    .gs-cart-actions {
        flex-direction: column;
    }
    
    .gs-mini-cart-dropdown {
        width: 280px;
    }
}

@media (max-width: 576px) {
    .gs-cart-item-col-price {
        display: none;
    }
    
    .gs-cart-item-quantity {
        flex-wrap: wrap;
        justify-content: center;
    }
}