/* Buylo Sticker Orders - Frontend Styles
   Colors match Buylo theme: primary #ee1a45, dark #021959 */

.bso-form-wrapper {
    --bso-primary: #ee1a45;
    --bso-dark: #021959;
    --bso-radius: 16px;
    --bso-shadow: 0 10px 40px rgba(2, 25, 89, 0.08);
    font-family: inherit;
    direction: rtl;
    max-width: 720px;
    margin: 40px auto;
    padding: 0 16px;
}

.bso-form-card {
    background: #fff;
    border-radius: var(--bso-radius);
    box-shadow: var(--bso-shadow);
    border: 1px solid rgba(2, 25, 89, 0.06);
    overflow: hidden;
}

.bso-form-header {
    background: linear-gradient(135deg, var(--bso-dark) 0%, #0a2a6e 100%);
    color: #fff;
    padding: 28px 32px;
    text-align: center;
}

.bso-title {
    margin: 0 0 8px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.bso-subtitle {
    margin: 0;
    opacity: 0.85;
    font-size: 0.95rem;
    line-height: 1.6;
}

.bso-section {
    padding: 24px 32px 8px;
}

.bso-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--bso-dark);
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(238, 26, 69, 0.15);
}

.bso-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.bso-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bso-field-full {
    grid-column: 1 / -1;
}

.bso-field label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #334155;
}

.bso-field .req {
    color: var(--bso-primary);
}

.bso-field input,
.bso-field select,
.bso-field textarea {
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #f8fafc;
    color: #1e293b;
    width: 100%;
    box-sizing: border-box;
}

.bso-field input:focus,
.bso-field select:focus,
.bso-field textarea:focus {
    outline: none;
    border-color: var(--bso-primary);
    box-shadow: 0 0 0 3px rgba(238, 26, 69, 0.12);
    background: #fff;
}

/* Upload zone */
.bso-upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s;
    background: #f8fafc;
    position: relative;
}
.bso-file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 5;
    margin: 0;
    padding: 0;
    font-size: 0;
}

.bso-upload-zone.has-file .bso-file-input {
    /* when preview is shown, keep input behind remove button */
    z-index: 1;
}

.bso-remove-file {
    z-index: 10;
    position: absolute;
}

.bso-change-file {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--bso-primary);
}


.bso-upload-zone:hover,
.bso-upload-zone.dragover {
    border-color: var(--bso-primary);
    background: rgba(238, 26, 69, 0.04);
}

.bso-upload-icon {
    color: var(--bso-primary);
    margin-bottom: 12px;
    opacity: 0.8;
}

.bso-upload-text {
    margin: 0 0 6px;
    font-size: 0.95rem;
    color: #475569;
}

.bso-upload-text span {
    color: var(--bso-primary);
    font-weight: 600;
    text-decoration: underline;
}

.bso-upload-hint {
    margin: 0;
    font-size: 0.8rem;
    color: #94a3b8;
}

.bso-upload-preview {
    position: relative;
    display: inline-block;
}

.bso-upload-preview img {
    max-width: 180px;
    max-height: 180px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    object-fit: contain;
}

.bso-remove-file {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bso-primary);
    color: #fff;
    border: none;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.bso-file-name {
    display: block;
    margin-top: 10px;
    font-size: 0.85rem;
    color: #64748b;
}

/* Price box */
.bso-price-box {
    margin: 16px 32px 8px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px 20px;
}

.bso-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.9rem;
    color: #475569;
}

.bso-price-row strong {
    color: var(--bso-dark);
}

.bso-discount {
    color: #16a34a !important;
}

.bso-total-row {
    border-top: 1px dashed #cbd5e1;
    margin-top: 8px;
    padding-top: 12px;
    font-size: 1.05rem;
}

.bso-total-row strong {
    color: var(--bso-primary);
    font-size: 1.2rem;
}

.bso-price-note {
    margin: 12px 0 0;
    font-size: 0.8rem;
    color: #94a3b8;
    line-height: 1.5;
}

/* Actions */
.bso-actions {
    padding: 20px 32px 32px;
}

.bso-submit-btn {
    width: 100%;
    background: var(--bso-primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 14px 24px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
    box-shadow: 0 4px 14px rgba(238, 26, 69, 0.35);
}

.bso-submit-btn:hover {
    background: #d4153c;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(238, 26, 69, 0.4);
}

.bso-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.bso-message {
    margin: 0 32px 24px;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.bso-message.success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.bso-message.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Responsive */
@media (max-width: 600px) {
    .bso-grid {
        grid-template-columns: 1fr;
    }
    .bso-section,
    .bso-actions,
    .bso-price-box {
        padding-left: 20px;
        padding-right: 20px;
    }
    .bso-form-header {
        padding: 22px 20px;
    }
    .bso-title {
        font-size: 1.25rem;
    }
}

/* Admin small helpers */
.bso-admin-table th {
    width: 180px;
    text-align: right;
}
.bso-actions-box .button {
    margin-bottom: 6px;
}

/* Product selection grid */
.bso-products-hint {
    margin: 0 0 14px;
    font-size: 0.85rem;
    color: #64748b;
}
.bso-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    max-height: 340px;
    overflow-y: auto;
    padding: 4px;
}
.bso-product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 8px 12px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    margin: 0;
}
.bso-product-card:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
}
.bso-product-card input.bso-product-check {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
}
.bso-product-check-icon {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e2e8f0;
    color: transparent;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.bso-product-card.is-selected {
    border-color: var(--bso-primary);
    background: rgba(238, 26, 69, 0.04);
    box-shadow: 0 0 0 3px rgba(238, 26, 69, 0.12);
}
.bso-product-card.is-selected .bso-product-check-icon {
    background: var(--bso-primary);
    color: #fff;
}
.bso-product-card img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
}
.bso-product-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: #1e293b;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
    min-height: 2.2em;
}
.bso-product-price {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bso-primary);
}
@media (max-width: 480px) {
    .bso-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
