/* ===============================================
   Awesome Mall - Components Library
   Bootstrap 5 Compatible Components
   =============================================== */

/* ========================================
   FORMS & INPUTS
   ======================================== */

/* Text Inputs, Textareas, Selects */
.form-control,
.form-select {
    height: var(--input-height);
    padding: var(--input-padding-y) var(--input-padding-x);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: 1.5;
    color: var(--input-text);
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--input-radius);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    color: var(--input-text);
    background-color: var(--input-bg);
    border-color: var(--input-border-focus);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(232, 102, 61, 0.1);
}

.form-control::placeholder {
    color: var(--input-placeholder);
    opacity: 1;
}

.form-control:disabled,
.form-select:disabled {
    background-color: var(--input-bg-disabled);
    opacity: 0.6;
    cursor: not-allowed;
}

textarea.form-control {
    height: auto;
    min-height: 100px;
}

/* Form Validation States */
.form-control.is-valid,
.form-select.is-valid {
    border-color: var(--input-valid-border);
    background-color: var(--input-valid-bg);
}

.form-control.is-valid:focus {
    border-color: var(--input-valid-border);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--input-invalid-border);
    background-color: var(--input-invalid-bg);
}

.form-control.is-invalid:focus {
    border-color: var(--input-invalid-border);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.valid-feedback {
    display: block;
    margin-top: 0.25rem;
    font-size: var(--font-size-sm);
    color: var(--am-success);
}

.invalid-feedback {
    display: block;
    margin-top: 0.25rem;
    font-size: var(--font-size-sm);
    color: var(--am-danger);
}

/* Input Groups */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-radius: 0;
}

.input-group .form-control:first-child {
    border-top-left-radius: var(--input-radius);
    border-bottom-left-radius: var(--input-radius);
}

.input-group .form-control:last-child {
    border-top-right-radius: var(--input-radius);
    border-bottom-right-radius: var(--input-radius);
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: var(--input-padding-y) var(--input-padding-x);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    color: var(--am-text-muted);
    background-color: var(--am-bg-light);
    border: 1px solid var(--input-border);
}

/* Checkboxes and Radio Buttons */
.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
    vertical-align: top;
    border: 1px solid var(--input-border);
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--am-primary);
    border-color: var(--am-primary);
}

.form-check-input:focus {
    border-color: var(--am-primary);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(232, 102, 61, 0.1);
}

.form-check-label {
    margin-left: 0.5rem;
    cursor: pointer;
}

/* Form Labels */
.form-label {
    margin-bottom: 0.5rem;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--am-text-dark);
}

.form-label span {
    color: var(--am-danger);
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    display: inline-block;
    padding: var(--btn-padding-y) var(--btn-padding-x);
    font-size: var(--btn-font-size);
    font-weight: var(--btn-font-weight);
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: var(--button-radius);
    transition: all var(--transition-fast);
    user-select: none;
}

.btn:hover {
    text-decoration: none;
}

.btn:focus {
    outline: 0;
    box-shadow: 0 0 0 3px rgba(232, 102, 61, 0.15);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button Variants */
.btn-primary {
    color: var(--am-white);
    background-color: var(--am-primary);
    border-color: var(--am-primary);
}

.btn-primary:hover {
    background-color: var(--am-primary-hover);
    border-color: var(--am-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    color: var(--am-white);
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #5a6268;
}

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

.btn-success:hover {
    background-color: #c74520;
    border-color: #c74520;
}

.btn-danger {
    color: var(--am-white);
    background-color: var(--am-danger);
    border-color: var(--am-danger);
}

.btn-danger:hover {
    background-color: #dc2626;
    border-color: #dc2626;
}

.btn-warning {
    color: var(--am-white);
    background-color: var(--am-warning);
    border-color: var(--am-warning);
}

.btn-warning:hover {
    background-color: #d97706;
    border-color: #d97706;
}

.btn-info {
    color: var(--am-white);
    background-color: var(--am-info);
    border-color: var(--am-info);
}

.btn-info:hover {
    background-color: #2563eb;
    border-color: #2563eb;
}

/* Outline Buttons */
.btn-outline-primary {
    color: var(--am-primary);
    border-color: var(--am-primary);
    background-color: transparent;
}

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

.btn-outline-secondary {
    color: #6c757d;
    border-color: #6c757d;
}

.btn-outline-secondary:hover {
    color: var(--am-white);
    background-color: #6c757d;
}

.btn-outline-danger {
    color: var(--am-danger);
    border-color: var(--am-danger);
}

.btn-outline-danger:hover {
    color: var(--am-white);
    background-color: var(--am-danger);
}

/* Button Sizes */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: var(--font-size-lg);
}

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

/* Icon Buttons */
.btn .fa {
    margin-right: 0.5rem;
}

.btn .fa:only-child {
    margin-right: 0;
}

/* ========================================
   CARDS
   ======================================== */

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: var(--card-bg);
    border: var(--card-border);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
}

.card-header {
    padding: var(--card-padding);
    background-color: var(--am-bg-light);
    border-bottom: 1px solid var(--am-border);
    font-weight: var(--font-weight-semibold);
    color: var(--am-text-dark);
    border-radius: var(--card-radius) var(--card-radius) 0 0;
}

.card-body {
    flex: 1 1 auto;
    padding: var(--card-padding);
}

.card-footer {
    padding: var(--card-padding);
    background-color: var(--am-bg-light);
    border-top: 1px solid var(--am-border);
    border-radius: 0 0 var(--card-radius) var(--card-radius);
}

.card-title {
    margin-bottom: 0.75rem;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
}

.card-text {
    margin-bottom: 1rem;
}

/* Card Hover Effect */
.card-hover {
    transition: all var(--transition-normal);
}

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

/* ========================================
   TABLES
   ======================================== */

.table {
    width: 100%;
    margin-bottom: 1rem;
    color: var(--am-text-dark);
}

.table th,
.table td {
    padding: var(--table-cell-padding);
    vertical-align: top;
    border-top: var(--table-border);
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid var(--am-border);
    font-weight: var(--font-weight-semibold);
    background-color: var(--am-bg-light);
}

.table tbody+tbody {
    border-top: 2px solid var(--am-border);
}

/* Table Bordered */
.table-bordered {
    border: var(--table-border);
}

.table-bordered th,
.table-bordered td {
    border: var(--table-border);
}

/* Table Striped */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--table-stripe-bg);
}

/* Table Hover */
.table-hover tbody tr:hover {
    background-color: var(--table-hover-bg);
}

/* Responsive Tables */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
}

/* ========================================
   ALERTS
   ======================================== */

.alert {
    position: relative;
    padding: var(--alert-padding);
    margin-bottom: 1rem;
    border: var(--alert-border-width) solid transparent;
    border-radius: var(--alert-border-radius);
}

.alert-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}

.alert-danger,
.alert-error {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

.alert-warning {
    color: #664d03;
    background-color: #fff3cd;
    border-color: #ffecb5;
}

.alert-info {
    color: #055160;
    background-color: #cff4fc;
    border-color: #b6effb;
}

/* Dismissible Alerts */
.alert-dismissible {
    padding-right: 3rem;
}

.alert-dismissible .btn-close {
    position: absolute;
    top: 0;
    right: 0;
    padding: 1rem;
    color: inherit;
}

/* ========================================
   BADGES
   ======================================== */

.badge {
    display: inline-block;
    padding: var(--badge-padding-y) var(--badge-padding-x);
    font-size: var(--badge-font-size);
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: var(--badge-border-radius);
}

.badge-primary {
    color: var(--am-white);
    background-color: var(--am-primary);
}

.badge-secondary {
    color: var(--am-white);
    background-color: #6c757d;
}

.badge-success {
    color: var(--am-white);
    background-color: var(--am-success);
}

.badge-danger {
    color: var(--am-white);
    background-color: var(--am-danger);
}

.badge-warning {
    color: var(--am-text-dark);
    background-color: var(--am-warning);
}

.badge-info {
    color: var(--am-white);
    background-color: var(--am-info);
}

/* Order Status Badges */
.badge-order-new {
    background-color: #3b82f6;
    color: white;
}

.badge-order-packed {
    background-color: #f59e0b;
    color: white;
}

.badge-order-shipped {
    background-color: #8b5cf6;
    color: white;
}

.badge-order-delivered {
    background-color: #E8663D;
    color: white;
}

.badge-order-cancelled {
    background-color: #ef4444;
    color: white;
}

/* ========================================
   BREADCRUMBS
   ======================================== */

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    list-style: none;
    background-color: var(--am-bg-light);
    border-radius: var(--radius-md);
}

.breadcrumb-item {
    display: flex;
}

.breadcrumb-item+.breadcrumb-item {
    padding-left: 0.5rem;
}

.breadcrumb-item+.breadcrumb-item::before {
    display: inline-block;
    padding-right: 0.5rem;
    color: var(--am-text-muted);
    content: "/";
}

.breadcrumb-item a {
    color: var(--am-primary);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--am-primary-hover);
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--am-text-muted);
}

/* ========================================
   PAGINATION
   ======================================== */

.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    border-radius: var(--radius-md);
}

.page-item {
    margin: 0 0.25rem;
}

.page-link {
    position: relative;
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--am-primary);
    text-decoration: none;
    background-color: var(--am-white);
    border: 1px solid var(--am-border);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.page-link:hover {
    color: var(--am-white);
    background-color: var(--am-primary);
    border-color: var(--am-primary);
}

.page-item.active .page-link {
    color: var(--am-white);
    background-color: var(--am-primary);
    border-color: var(--am-primary);
}

.page-item.disabled .page-link {
    color: var(--am-text-muted);
    pointer-events: none;
    background-color: var(--am-bg-light);
}

/* ========================================
   LOADING SPINNER
   ======================================== */

.spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 0.25rem solid var(--am-border);
    border-top-color: var(--am-primary);
    border-radius: 50%;
    animation: spinner-rotate 0.75s linear infinite;
}

@keyframes spinner-rotate {
    to {
        transform: rotate(360deg);
    }
}

.spinner-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15rem;
}

/* ========================================
   EMPTY STATES
   ======================================== */

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--am-text-light);
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--am-text-dark);
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: var(--am-text-muted);
    margin-bottom: 1.5rem;
}

/* ========================================
   QUANTITY SELECTOR
   ======================================== */

.quantity-selector {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--input-border);
    border-radius: var(--input-radius);
    overflow: hidden;
}

.quantity-btn {
    background-color: var(--am-bg-light);
    border: none;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    color: var(--am-text-dark);
    transition: background-color var(--transition-fast);
}

.quantity-btn:hover {
    background-color: var(--am-border);
}

.quantity-input {
    border: none;
    border-left: 1px solid var(--input-border);
    border-right: 1px solid var(--input-border);
    text-align: center;
    width: 60px;
    padding: 0.5rem;
    font-weight: var(--font-weight-medium);
}

/* ========================================
   RATING STARS
   ======================================== */

.rating-stars {
    display: inline-flex;
    gap: 0.25rem;
}

.rating-stars .fa-star {
    color: var(--am-warning);
}

.rating-stars .fa-star-o {
    color: var(--am-border);
}

/* ========================================
   TABS (Bootstrap 5 Compatible)
   ======================================== */

.nav-tabs {
    border-bottom: 2px solid var(--am-border);
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.75rem 1.5rem;
    color: var(--am-text-muted);
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-fast);
}

.nav-tabs .nav-link:hover {
    color: var(--am-primary);
    border-bottom-color: var(--am-border);
}

.nav-tabs .nav-link.active {
    color: var(--am-primary);
    border-bottom-color: var(--am-primary);
}

.tab-content {
    padding: 1.5rem 0;
}

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

@media (max-width: 767.98px) {
    .table-responsive {
        border: none;
    }

    .btn-block-mobile {
        display: block;
        width: 100%;
    }

    .card {
        margin-bottom: 1rem;
    }
}
