/* =========================================
   SOUKPRO COMPONENTS
   Buttons, Cards, Forms, Tables, Badges, Notices
   ========================================= */

/* --- Base Reset (scoped by component classes) --- */

/* =========================================
   BUTTONS
   ========================================= */
.sp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-space-sm);
    padding: var(--sp-space-sm) var(--sp-space-xl);
    border: 1px solid transparent;
    border-radius: var(--sp-radius-md);
    font-family: var(--sp-font-body);
    font-size: var(--sp-text-base);
    font-weight: var(--sp-font-weight-semibold);
    line-height: 1.5;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--sp-transition-fast);
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
}

.sp-btn:focus-visible {
    outline: none;
    box-shadow: var(--sp-focus-ring);
}

.sp-btn--primary {
    background: var(--sp-color-primary);
    color: var(--sp-color-white);
}

.sp-btn--primary:hover {
    background: var(--sp-color-primary-dark);
    color: var(--sp-color-white);
}

.sp-btn--outline {
    background: transparent;
    border-color: var(--sp-color-border);
    color: var(--sp-color-text);
}

.sp-btn--outline:hover {
    border-color: var(--sp-color-primary);
    color: var(--sp-color-primary);
    background: var(--sp-color-primary-bg);
}

.sp-btn--ghost {
    background: transparent;
    color: var(--sp-color-text-light);
}

.sp-btn--ghost:hover {
    background: var(--sp-color-bg-alt);
    color: var(--sp-color-text);
}

.sp-btn--success {
    background: var(--sp-color-success);
    color: var(--sp-color-white);
}

.sp-btn--success:hover {
    background: var(--sp-color-success-dark);
    color: var(--sp-color-white);
}

.sp-btn--danger {
    background: var(--sp-color-error);
    color: var(--sp-color-white);
}

.sp-btn--danger:hover {
    background: var(--sp-color-error-dark);
    color: var(--sp-color-white);
}

.sp-btn--whatsapp {
    background: var(--sp-color-whatsapp);
    color: var(--sp-color-white);
}

.sp-btn--whatsapp:hover {
    background: var(--sp-color-whatsapp-dark);
    color: var(--sp-color-white);
}

.sp-btn--sm {
    padding: calc(var(--sp-space-xs) + 2px) var(--sp-space-md);
    font-size: var(--sp-text-sm);
}

.sp-btn--lg {
    padding: var(--sp-space-md) var(--sp-space-2xl);
    font-size: var(--sp-text-lg);
}

.sp-btn--block {
    width: 100%;
}

.sp-btn[disabled],
.sp-btn.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Icon-only buttons */
.sp-btn--icon {
    padding: var(--sp-space-sm);
    width: 40px;
    height: 40px;
}

/* =========================================
   CARDS
   ========================================= */
.sp-card {
    background: var(--sp-color-white);
    border: 1px solid var(--sp-color-border-light);
    border-radius: var(--sp-radius-xl);
    overflow: hidden;
    transition: box-shadow var(--sp-transition-base), transform var(--sp-transition-base);
}

.sp-card:hover {
    box-shadow: var(--sp-shadow-md);
}

.sp-card--interactive {
    cursor: pointer;
}

.sp-card--interactive:hover {
    transform: translateY(-2px);
    box-shadow: var(--sp-shadow-lg);
}

.sp-card__image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.sp-card__body {
    padding: var(--sp-space-lg);
}

.sp-card__title {
    font-family: var(--sp-font-heading);
    font-size: var(--sp-text-lg);
    font-weight: var(--sp-font-weight-bold);
    color: var(--sp-color-text);
    margin: 0 0 var(--sp-space-xs);
}

.sp-card__text {
    font-size: var(--sp-text-sm);
    color: var(--sp-color-text-light);
    line-height: 1.6;
}

/* =========================================
   FORMS & FIELDS
   ========================================= */
.sp-field {
    display: flex;
    flex-direction: column;
    gap: var(--sp-space-xs);
    margin-bottom: var(--sp-space-md);
}

.sp-field__label {
    font-size: var(--sp-text-sm);
    font-weight: var(--sp-font-weight-medium);
    color: var(--sp-color-text);
}

.sp-field__input,
.sp-field__select,
.sp-field__textarea {
    width: 100%;
    padding: var(--sp-space-sm) var(--sp-space-md);
    border: 1px solid var(--sp-color-border);
    border-radius: var(--sp-radius-md);
    font-family: var(--sp-font-body);
    font-size: var(--sp-text-base);
    color: var(--sp-color-text);
    background: var(--sp-color-white);
    transition: border-color var(--sp-transition-fast), box-shadow var(--sp-transition-fast);
}

.sp-field__input:focus,
.sp-field__select:focus,
.sp-field__textarea:focus {
    outline: none;
    border-color: var(--sp-color-primary);
    box-shadow: var(--sp-focus-ring);
}

.sp-field__textarea {
    resize: vertical;
    min-height: 80px;
}

.sp-field__select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236B7280'%3e%3cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left var(--sp-space-sm) center;
    background-size: 1em;
    padding-left: var(--sp-space-2xl);
}

.sp-field__select--sm {
    width: auto;
    min-width: 120px;
}

.sp-field__input-wrap {
    position: relative;
}

.sp-field__input-wrap .sp-field__icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: var(--sp-space-md);
    color: var(--sp-color-text-muted);
    font-size: 18px;
    pointer-events: none;
}

.sp-field__input-wrap .sp-field__input {
    padding-right: var(--sp-space-3xl);
}

.sp-field__toggle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: var(--sp-space-sm);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--sp-color-text-muted);
    padding: 4px;
}

.sp-field__hint {
    font-size: var(--sp-text-xs);
    color: var(--sp-color-text-muted);
}

.sp-field__input--error {
    border-color: var(--sp-color-error) !important;
}

.sp-field__checkbox {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-space-sm);
    cursor: pointer;
    font-size: var(--sp-text-sm);
    color: var(--sp-color-text);
}

.sp-field__checkbox input[type="checkbox"],
.sp-field__checkbox input[type="radio"] {
    accent-color: var(--sp-color-primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.sp-field__checkbox--full {
    display: flex;
}

.sp-field.sp-field--radios label {
    display: flex;
    align-items: center;
    gap: var(--sp-space-sm);
    cursor: pointer;
    font-weight: var(--sp-font-weight-normal);
    line-height: 1.5;
}

.sp-field.sp-field--radios input[type="radio"] {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    margin: 0;
    accent-color: var(--sp-color-primary);
}

.sp-field__input--sm {
    padding: 0.375rem var(--sp-space-md);
    font-size: var(--sp-text-sm);
}

/* =========================================
   TABLES
   ========================================= */
.sp-table {
    width: 100%;
    border-collapse: collapse;
}

.sp-table th {
    text-align: right;
    padding: var(--sp-space-md);
    font-size: var(--sp-text-xs);
    font-weight: var(--sp-font-weight-semibold);
    color: var(--sp-color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--sp-color-bg-alt);
    border-bottom: 1px solid var(--sp-color-border-light);
}

.sp-table td {
    padding: var(--sp-space-md);
    border-bottom: 1px solid var(--sp-color-border-light);
    font-size: var(--sp-text-sm);
    color: var(--sp-color-text);
}

.sp-table tbody tr:hover {
    background: var(--sp-color-bg-alt);
}

.sp-table tr:last-child td {
    border-bottom: none;
}

/* =========================================
   STATUS BADGES
   ========================================= */
.sp-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: var(--sp-radius-full);
    font-size: var(--sp-text-xs);
    font-weight: var(--sp-font-weight-semibold);
    white-space: nowrap;
    line-height: 1.4;
}

.sp-status--success,
.sp-status--wc-completed,
.sp-status--wc-delivered {
    background: var(--sp-color-success-bg);
    color: var(--sp-color-success);
}

.sp-status--warning,
.sp-status--wc-pending {
    background: var(--sp-color-warning-bg);
    color: var(--sp-color-warning);
}

.sp-status--error,
.sp-status--wc-cancelled {
    background: var(--sp-color-error-bg);
    color: var(--sp-color-error);
}

.sp-status--info,
.sp-status--wc-processing,
.sp-status--wc-shipped {
    background: var(--sp-color-info-bg);
    color: var(--sp-color-info);
}

.sp-status--active {
    background: var(--sp-color-success-bg);
    color: var(--sp-color-success);
}

.sp-status--draft,
.sp-status--inactive {
    background: var(--sp-color-border-light);
    color: var(--sp-color-text-muted);
}

/* =========================================
   NOTICES / ALERTS
   ========================================= */
.sp-notice {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-space-sm);
    padding: var(--sp-space-md) var(--sp-space-lg);
    border-radius: var(--sp-radius-md);
    font-size: var(--sp-text-sm);
    line-height: 1.5;
    margin-bottom: var(--sp-space-md);
}

.sp-notice .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    flex-shrink: 0;
}

.sp-notice--error {
    background: var(--sp-color-error-bg);
    color: var(--sp-color-error-dark);
}

.sp-notice--success {
    background: var(--sp-color-success-bg);
    color: var(--sp-color-success-dark);
}

.sp-notice--warning {
    background: var(--sp-color-warning-bg);
    color: var(--sp-color-warning-dark);
}

.sp-notice--info {
    background: var(--sp-color-info-bg);
    color: var(--sp-color-info-dark);
}

/* =========================================
   AVATARS
   ========================================= */
.sp-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--sp-color-primary-bg);
    color: var(--sp-color-primary);
    font-weight: var(--sp-font-weight-bold);
    font-size: var(--sp-text-sm);
    width: 40px;
    height: 40px;
}

.sp-avatar--sm {
    width: 32px;
    height: 32px;
    font-size: var(--sp-text-xs);
}

.sp-avatar--lg {
    width: 64px;
    height: 64px;
    font-size: var(--sp-text-xl);
}

/* =========================================
   EMPTY STATE
   ========================================= */
.sp-empty {
    text-align: center;
    padding: var(--sp-space-3xl) var(--sp-space-xl);
    color: var(--sp-color-text-muted);
}

.sp-empty .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    display: block;
    margin: 0 auto var(--sp-space-md);
    opacity: 0.4;
}

.sp-empty p {
    font-size: var(--sp-text-base);
}

/* =========================================
   STARS RATING
   ========================================= */
.sp-stars {
    display: inline-flex;
    gap: 2px;
    direction: ltr;
}

.sp-stars__star {
    color: var(--sp-color-border);
    font-size: 18px;
    line-height: 1;
}

.sp-stars__star.is-filled {
    color: #F59E0B;
}

/* =========================================
   VERIFIED BADGE
   ========================================= */
.sp-verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--sp-radius-full);
    background: var(--sp-color-success-bg);
    color: var(--sp-color-success);
    font-size: var(--sp-text-xs);
    font-weight: var(--sp-font-weight-semibold);
}

.sp-verified-badge .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.sp-verified-badge--sm {
    font-size: 11px;
    padding: 1px 6px;
}

/* =========================================
   SUBSCRIPTION BADGE (silver / gold)
   ========================================= */
.sp-sub-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--sp-radius-full);
    font-size: var(--sp-text-xs);
    font-weight: var(--sp-font-weight-bold);
    line-height: 1.5;
    white-space: nowrap;
    border: 1px solid transparent;
}

.sp-sub-badge--silver {
    background: linear-gradient(135deg, #f4f4f5 0%, #e4e4e7 100%);
    color: #3f3f46;
    border-color: #d4d4d8;
}

.sp-sub-badge--gold {
    background: linear-gradient(135deg, #fde68a 0%, #f59e0b 100%);
    color: #78350f;
    border-color: #d97706;
}

.sp-supplier-card__body .sp-sub-badge {
    margin-top: 6px;
}

.sp-supplier-profile__avatar .sp-sub-badge {
    display: flex;
    justify-content: center;
    margin-top: var(--sp-space-sm);
}

.sp-sub-badge--lg {
    padding: 4px 14px;
    font-size: var(--sp-text-sm);
}

/* =========================================
   MODAL
   ========================================= */
.sp-modal {
    position: fixed;
    inset: 0;
    z-index: var(--sp-z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-space-md);
}

/* Hidden by default; JavaScript removes/toggles the hidden attribute. */
.sp-modal[hidden] {
    display: none;
}

.sp-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.5);
    backdrop-filter: blur(2px);
}

.sp-modal__content {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--sp-color-white);
    border-radius: var(--sp-radius-xl);
    box-shadow: var(--sp-shadow-xl);
    z-index: 1;
}

.sp-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-space-lg) var(--sp-space-xl);
    border-bottom: 1px solid var(--sp-color-border-light);
}

.sp-modal__header h3 {
    font-family: var(--sp-font-heading);
    font-size: var(--sp-text-lg);
    font-weight: var(--sp-font-weight-bold);
    margin: 0;
}

.sp-modal__close {
    background: none;
    border: none;
    font-size: var(--sp-text-2xl);
    line-height: 1;
    color: var(--sp-color-text-muted);
    cursor: pointer;
    padding: 4px;
}

.sp-modal__close:hover {
    color: var(--sp-color-text);
}

.sp-modal__body {
    padding: var(--sp-space-xl);
}

.sp-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-space-sm);
    padding: var(--sp-space-md) var(--sp-space-xl);
    border-top: 1px solid var(--sp-color-border-light);
}

/* =========================================
   RESPONSIVE HELPERS
   ========================================= */
.sp-hide-sm {
    display: block;
}

@media (max-width: 768px) {
    .sp-hide-sm {
        display: none;
    }
}
