/* ============================================================
   Amazon Produkt Box – Stylesheet
   ============================================================ */

:root {
    --apb-primary:       #2d7a27;
    --apb-primary-dark:  #1f5a1b;
    --apb-primary-light: #e8f5e6;
    --apb-accent:        #e53935;   /* dashed-border accent */
    --apb-bg:            #f5f5f5;
    --apb-border-radius: 6px;
    --apb-shadow:        0 2px 8px rgba(0,0,0,0.10);
    --apb-font:          -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---- Outer Card ---- */
.apb-product-box {
    font-family:      var(--apb-font);
    background:       var(--apb-bg);
    border:           3px solid var(--apb-primary);
    border-radius:    var(--apb-border-radius);
    box-shadow:       var(--apb-shadow);
    padding:          16px 16px 10px;
    margin:           24px 0;
    max-width:        860px;
    box-sizing:       border-box;
}

/* ---- Inner row ---- */
.apb-inner {
    display:     flex;
    align-items: stretch;
    gap:         0;
    flex-wrap:   nowrap;
}

/* ---- Image column ---- */
.apb-col-image {
    flex:        0 0 auto;
    width:       130px;
    min-width:   100px;
}

.apb-image-wrap {
    border:        2px dashed var(--apb-accent);
    border-radius: 4px;
    padding:       6px;
    display:       flex;
    align-items:   center;
    justify-content: center;
    height:        100%;
    box-sizing:    border-box;
    background:    #fff;
}

.apb-product-image {
    display:    block;
    max-width:  100%;
    max-height: 160px;
    width:      auto;
    height:     auto;
    object-fit: contain;
}

/* ---- Title column ---- */
.apb-col-title {
    flex:    1 1 auto;
    padding: 0 16px;
}

.apb-title-inner {
    border:        2px dashed var(--apb-accent);
    border-radius: 4px;
    padding:       10px 12px;
    height:        100%;
    box-sizing:    border-box;
    display:       flex;
    align-items:   flex-start;
}

.apb-product-title {
    font-size:   1.15rem;
    font-weight: 700;
    color:       var(--apb-primary);
    line-height: 1.35;
    margin:      0;
    padding:     0;
}

/* ---- Action column ---- */
.apb-col-action {
    flex:           0 0 auto;
    width:          180px;
    min-width:      160px;
    display:        flex;
    flex-direction: column;
    align-items:    flex-end;
    justify-content: center;
    gap:            10px;
    padding-left:   16px;
}

.apb-price {
    font-size:   1.1rem;
    font-weight: 700;
    color:       #111;
    text-align:  right;
    white-space: nowrap;
}

/* ---- Buy Button ---- */
.apb-buy-button {
    display:         inline-flex;
    align-items:     center;
    gap:             8px;
    background:      var(--apb-primary);
    color:           #fff !important;
    text-decoration: none !important;
    font-size:       0.88rem;
    font-weight:     600;
    padding:         9px 14px;
    border-radius:   4px;
    border:          none;
    cursor:          pointer;
    transition:      background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    white-space:     nowrap;
    line-height:     1.3;
    box-shadow:      0 2px 4px rgba(0,0,0,0.18);
}

.apb-buy-button:hover,
.apb-buy-button:focus {
    background:  var(--apb-primary-dark);
    transform:   translateY(-1px);
    box-shadow:  0 4px 10px rgba(0,0,0,0.22);
    color:       #fff !important;
    outline:     none;
}

.apb-buy-button:active {
    transform:   translateY(0);
    box-shadow:  0 1px 3px rgba(0,0,0,0.15);
}

.apb-cart-icon {
    width:       16px;
    height:      16px;
    flex-shrink: 0;
    fill:        currentColor;
}

/* ---- Disclosure ---- */
.apb-disclosure {
    margin-top:  10px;
    padding-top: 8px;
    border-top:  1px solid #ddd;
    font-size:   0.72rem;
    font-weight: 700;
    color:       #555;
    line-height: 1.4;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet */
@media (max-width: 640px) {
    .apb-inner {
        flex-wrap: wrap;
    }
    .apb-col-image {
        width:   90px;
        min-width: 80px;
    }
    .apb-col-title {
        padding: 0 10px;
    }
    .apb-col-action {
        width:      100%;
        min-width:  0;
        padding:    12px 0 0 0;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        border-top: 1px solid #ddd;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .apb-product-box {
        padding: 12px 10px 8px;
    }
    .apb-inner {
        flex-direction: column;
        gap: 12px;
    }
    .apb-col-image {
        width: 100%;
        max-width: 140px;
    }
    .apb-col-title {
        padding: 0;
    }
    .apb-col-action {
        padding:        0;
        border-top:     0;
        flex-direction: row;
        justify-content: space-between;
        align-items:    center;
        width:          100%;
    }
    .apb-product-title {
        font-size: 1rem;
    }
    .apb-buy-button {
        font-size: 0.82rem;
        padding:   8px 10px;
    }
}

/* ============================================================
   ADMIN PAGE STYLES
   ============================================================ */

.apb-admin-wrap h1 {
    display:     flex;
    align-items: baseline;
    gap:         10px;
}

.apb-version {
    font-size:   0.65em;
    font-weight: 400;
    color:       #777;
    background:  #f0f0f0;
    padding:     2px 8px;
    border-radius: 10px;
}

.apb-admin-grid {
    display:               grid;
    grid-template-columns: 1fr 1fr;
    gap:                   20px;
    margin-top:            16px;
}

.apb-full-width {
    grid-column: 1 / -1;
}

.apb-admin-card {
    background:    #fff;
    border:        1px solid #ddd;
    border-radius: 6px;
    padding:       20px 24px;
    box-shadow:    0 1px 3px rgba(0,0,0,0.06);
}

.apb-admin-card h2 {
    margin-top:    0;
    padding-top:   0;
    border-bottom: 2px solid var(--apb-primary);
    padding-bottom: 8px;
    color:         var(--apb-primary);
}

.apb-admin-card h3 {
    color:      #333;
    margin-top: 18px;
}

.apb-admin-card pre {
    background:    #f6f8fa;
    border:        1px solid #e1e4e8;
    border-radius: 4px;
    padding:       12px 14px;
    font-size:     0.82rem;
    overflow-x:    auto;
    white-space:   pre-wrap;
    word-break:    break-all;
}

.apb-admin-card ul {
    margin:     0;
    padding:    0 0 0 18px;
}

.apb-admin-card ul li {
    margin-bottom: 4px;
    font-size:     0.9rem;
}

.apb-admin-card code {
    background:    #f3f4f6;
    padding:       2px 5px;
    border-radius: 3px;
    font-size:     0.85em;
}

.apb-generated-shortcode {
    margin-top:    16px;
    padding:       14px;
    background:    #f6f8fa;
    border:        1px solid #ddd;
    border-radius: 4px;
}

.apb-shortcode-output {
    display:     flex;
    align-items: center;
    gap:         10px;
    margin-top:  6px;
}

.apb-shortcode-output code {
    flex:       1;
    background: #fff;
    border:     1px solid #ccc;
    padding:    8px 10px;
    border-radius: 3px;
    font-size:  0.8rem;
    word-break: break-all;
    display:    block;
}

.apb-usage-grid {
    display:               grid;
    grid-template-columns: 1fr 1fr;
    gap:                   24px;
}

@media (max-width: 900px) {
    .apb-admin-grid {
        grid-template-columns: 1fr;
    }
    .apb-usage-grid {
        grid-template-columns: 1fr;
    }
}

/* Live preview wrapper in admin */
#apb-live-preview .apb-product-box {
    max-width: 100%;
}
