/**
 * Fail: css/cart.css
 * Seotud failiga: cart.php
 * Eesmärk: Stiilida ostukorvi summad, toodete tabel ja mini-cart drawer.
 */

/* ---------------------------------------------------------
   1. OSTUKORVI SUMMAD JA KUPONGIVORM
--------------------------------------------------------- */
.akt-custom-cart-totals-wrapper {
    background-color: #f9f9f9;
    border: 1px solid #e5e5e5;
    padding: 20px;
    border-radius: 5px;
}

.akt-custom-cart-totals-wrapper table.shop_table {
    border: none !important;
    margin-bottom: 20px !important;
    width: 100%;
    border-collapse: collapse;
}

.akt-custom-cart-totals-wrapper table.shop_table th,
.akt-custom-cart-totals-wrapper table.shop_table td {
    border-top: 1px solid #e5e5e5;
    padding: 10px 0;
    text-align: left !important;
    vertical-align: middle;
}

.akt-custom-cart-totals-wrapper .cart_totals h2 {
    font-size: 1.25rem !important;
    margin-bottom: 15px;
    font-weight: 600;
}

/* Sooduskoodi vorm */
.akt-cart-coupon-form {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e5e5;
}

.akt-cart-coupon-form .coupon {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.akt-cart-coupon-form input.input-text {
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 4px;
    flex: 1;
    min-width: 150px;
}

.akt-cart-coupon-form button.button {
    padding: 10px 20px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.akt-cart-coupon-form button.button:hover {
    background-color: #555;
}

.akt-cart-coupon-form button.button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* "Mine maksma" nupp */
.wc-proceed-to-checkout .checkout-button {
    display: block;
    width: auto !important;
    min-width: 200px;
    margin: 0 auto;
    padding: 12px 25px;
    font-size: 14px;
    line-height: 1.2;
    text-align: center;
}

.wc-proceed-to-checkout br {
    display: none;
}

/* ---------------------------------------------------------
   2. OSTUKORVI SISU TABEL (FIX: HINNA VEERG)
--------------------------------------------------------- */
.akt-custom-cart-items-wrapper .shop_table {
    width: 100%;
    table-layout: auto; /* Laseme brauseril arvutada, aga suuname reeglitega */
}

/* Hinna veerg: hoiame selle stabiilsena */
.akt-custom-cart-items-wrapper .shop_table td.product-price {
    white-space: nowrap; /* Keelame murdumise */
    min-width: 100px;    /* Tagame minimaalse laiuse */
    vertical-align: top; /* Või middle, sõltub eelistusest */
    padding-top: 20px;   /* Visuaalne joondus, kui pilt on suur */
}

/* Toote nimi: sunnime murduma, kui on liiga pikk */
.akt-custom-cart-items-wrapper .shop_table td.product-name {
    word-break: break-word;
    white-space: normal;
    vertical-align: top;
}

/* Pilt */
.akt-custom-cart-items-wrapper .shop_table td.product-thumbnail {
    width: 80px; /* Fikseerime pildi veeru laiuse, et säästa ruumi */
    min-width: 60px;
    vertical-align: top;
}

/* Eemalda nupp */
.akt-custom-cart-items-wrapper .shop_table td.product-remove {
    width: 40px;
    text-align: center;
    vertical-align: top;
    padding-top: 20px;
}

/* Metaandmed (variatsioonid) */
.product-name dl.variation {
    margin-top: 5px;
    font-size: 0.9em;
    color: #777;
    display: grid; 
    grid-template-columns: auto 1fr;
    gap: 2px 10px;
}

.product-name dl.variation dt {
    font-weight: 600;
    margin: 0;
}

.product-name dl.variation dd {
    margin: 0;
}

.product-name dl.variation dd p {
    margin-bottom: 0;
    display: inline;
}

/* Prügikasti ikoon (kui dashicons on sees) */
.akt-custom-cart-items-wrapper .product-remove a.remove {
    color: #e2401c !important;
    font-size: 1.5em;
    font-weight: normal;
    border: none !important;
    background: transparent !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    box-shadow: none !important;
}

.akt-custom-cart-items-wrapper .product-remove a.remove:hover {
    color: #a00 !important;
}

/* Mobiilne vaade */
@media only screen and (max-width: 768px) {
    .akt-custom-cart-items-wrapper .shop_table td.product-price {
        white-space: normal;
        min-width: auto;
    }
}

/* ---------------------------------------------------------
   3. MINI CART (Drawer)
--------------------------------------------------------- */
/* Global box-sizing fix component scope sees */
.akt-mini-cart-component *,
.akt-mini-cart-component *::before,
.akt-mini-cart-component *::after {
    box-sizing: border-box;
}

.akt-mini-cart-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    font-size: 24px;
}

.akt-mini-cart-count {
    position: absolute;
    top: -5px;
    right: -10px;
    background: #e2401c;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Drawer ja Overlay */
.akt-mini-cart-drawer {
    visibility: hidden;
    z-index: 999999;
}

.akt-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1;
}

.akt-drawer-container {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    max-width: 85vw;
    height: 100%;
    background: #fff;
    z-index: 2;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
}

.akt-mini-cart-drawer.open {
    visibility: visible;
}

.akt-mini-cart-drawer.open .akt-drawer-overlay {
    opacity: 1;
}

.akt-mini-cart-drawer.open .akt-drawer-container {
    transform: translateX(0);
}

/* Header */
.akt-drawer-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.akt-drawer-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.akt-drawer-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    color: #333;
}

/* Sisu */
.akt-drawer-content-inner {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

/* Mini-cart list */
.akt-mini-cart-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.akt-mini-cart-item {
    display: flex;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

.akt-mini-cart-item img {
    width: 60px;
    height: auto;
    border-radius: 4px;
    object-fit: cover;
}

.akt-item-details {
    flex: 1;
    min-width: 0;
}

.akt-item-name {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    text-decoration: none;
    color: #333;
    line-height: 1.2;
}

.akt-item-price {
    display: block;
    color: #555;
    font-weight: 500;
}

.akt-item-remove {
    color: #ccc;
    font-size: 1.2em;
    text-decoration: none;
    padding: 0 5px;
    cursor: pointer;
    line-height: 1;
}

.akt-item-remove:hover {
    color: #e2401c;
}

/* Footer */
.akt-mini-cart-footer {
    margin-top: auto;
    border-top: 1px solid #eee;
    padding: 15px;
    flex-shrink: 0;
    background: #fff;
}

.akt-mini-cart-total {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.akt-mini-cart-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.akt-mini-cart-buttons .button {
    width: 100%;
    display: block;
    text-align: center;
    padding: 12px;
    background: #eee;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    border: none;
}

.akt-mini-cart-buttons .button.checkout {
    background: #333;
    color: #fff;
}

.akt-mini-cart-buttons .button:hover {
    opacity: 0.9;
}