/* Component Styles */
@import url('tokens.css');

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-weight: var(--font-weight-semibold);
    text-align: center;
    transition: all var(--transition-base);
    cursor: pointer;
    border: 2px solid transparent;
    font-size: var(--font-size-base);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-secondary), #c19d2e);
    color: var(--color-text-primary);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(212, 175, 55, 0.35);
    background: linear-gradient(135deg, #c19d2e, var(--color-secondary));
}

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

.btn-outline:hover {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-secondary {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border: 2px solid var(--color-border);
    font-weight: var(--font-weight-medium);
}

.btn-secondary:hover {
    background: var(--color-bg-card);
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: var(--error);
    color: var(--text-primary);
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-sm {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: var(--space-lg) var(--space-xl);
    font-size: var(--font-size-lg);
    min-height: 56px;
    font-weight: var(--font-weight-bold);
}

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

.btn-icon {
    background: transparent;
    color: var(--color-text-primary);
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xl);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
    border: none;
    cursor: pointer;
}

.btn-icon:hover {
    background: var(--color-bg-tertiary);
}

/* Cards */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.5s ease-out;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
    background: var(--bg-card-hover);
    border-color: var(--accent-blue);
}

.card-header {
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--glass-border);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    color: var(--text-secondary);
}

.card-footer {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--glass-border);
}

/* Product Card */
.product-card {
    background: var(--color-bg-primary);
    border: 3px solid var(--color-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    animation: fadeInUp 0.5s ease-out;
    box-shadow: var(--shadow-md);
    position: relative;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid transparent;
    border-radius: var(--radius-xl);
    pointer-events: none;
    transition: border-color 0.3s ease;
}

.product-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl);
    border-color: var(--color-primary);
}

.product-card:hover::before {
    border-color: var(--color-primary);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-image {
    width: 100%;
    height: 220px;
    background: var(--color-bg-secondary);
    border-bottom: 2px solid var(--color-border);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: var(--color-primary);
}

.product-card:hover .product-image img {
    transform: scale(1.1);
}

.product-image::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.product-info {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.product-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: var(--line-height-tight);
    min-height: 2.5em;
}

.product-vendor {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.product-price {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-secondary);
    margin: var(--space-xs) 0;
}

.product-stock {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    display: inline-block;
    width: fit-content;
}

.product-stock.in-stock {
    color: var(--color-success);
    background: rgba(16, 185, 129, 0.1);
}

.product-stock.low-stock {
    color: var(--color-warning);
    background: rgba(245, 158, 11, 0.1);
}

.product-stock.out-of-stock {
    color: var(--color-error);
    background: rgba(239, 68, 68, 0.1);
}

/* Vendor/Mechanic Card */
.vendor-card,
.mechanic-card {
    background: var(--color-bg-primary);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    animation: fadeInUp 0.5s ease-out;
    box-shadow: var(--shadow-sm);
}

.vendor-card:hover,
.mechanic-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--color-primary);
}

.vendor-image,
.mechanic-image {
    width: 100%;
    height: 180px;
    background: var(--color-bg-secondary);
    position: relative;
    overflow: hidden;
}

.vendor-image img,
.mechanic-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.vendor-image-placeholder,
.mechanic-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: var(--color-primary);
}

.vendor-card:hover .vendor-image img,
.mechanic-card:hover .mechanic-image img {
    transform: scale(1.1);
}

.vendor-header,
.mechanic-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
}

.vendor-avatar,
.mechanic-avatar {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-secondary), var(--color-primary));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 3px solid var(--color-bg-primary);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.vendor-avatar img,
.mechanic-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vendor-info,
.mechanic-info {
    flex: 1;
    min-width: 0;
}

.vendor-name,
.mechanic-name {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-xs);
}

.vendor-city,
.mechanic-city {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-xs);
}

.mechanic-specialty {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-xs);
    font-weight: var(--font-weight-medium);
}

.vendor-rating,
.mechanic-rating {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
    color: var(--color-secondary);
    font-weight: var(--font-weight-semibold);
}

.rating-count {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    font-weight: var(--font-weight-normal);
}

.vendor-hours {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

.icon-large {
    width: 4rem;
    height: 4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-sm {
    width: 1rem;
    height: 1rem;
}

/* Text Colors */
.text-success {
    color: var(--color-success);
}

.text-warning {
    color: var(--color-warning);
}

.text-error {
    color: var(--color-error);
}

.text-primary {
    color: var(--color-primary);
}

.text-secondary {
    color: var(--color-secondary);
}

.text-muted {
    color: var(--color-text-muted);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-primary {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

.badge-gold {
    background: var(--color-secondary);
    color: var(--color-text-primary);
}

.badge-success {
    background: var(--color-success);
    color: var(--color-text-inverse);
}

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

.badge-error {
    background: var(--color-error);
    color: var(--color-text-inverse);
}

.badge-pending {
    background: var(--color-warning);
    color: var(--color-text-inverse);
}

.badge-approved {
    background: var(--color-success);
    color: var(--color-text-inverse);
}

.badge-rejected {
    background: var(--color-error);
    color: var(--color-text-inverse);
}

.badge-processing {
    background: var(--color-info);
    color: var(--color-text-inverse);
}

.badge-completed {
    background: var(--color-success);
    color: var(--color-text-inverse);
}

/* Grids */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.vendors-grid,
.mechanics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-lg);
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: var(--space-md);
    }
    
    .vendors-grid,
    .mechanics-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
}

/* Forms */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--space-sm);
    color: var(--color-text-primary);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: var(--space-md);
    background: var(--color-bg-tertiary);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: var(--font-size-base);
    transition: all var(--transition-base);
    font-family: var(--font-family);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: var(--color-bg-primary);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-error {
    color: var(--color-error);
    font-size: var(--font-size-sm);
    margin-top: var(--space-xs);
    display: block;
}

.form-help {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    margin-top: var(--space-xs);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: var(--z-modal-backdrop);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--color-bg-primary);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: var(--z-modal);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: var(--space-lg);
    border-bottom: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-bg-secondary);
}

.modal-title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
}

.modal-close {
    background: transparent;
    color: var(--color-text-secondary);
    font-size: var(--font-size-2xl);
    padding: var(--space-xs);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
}

.modal-close:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    padding: var(--space-lg);
    border-top: 2px solid var(--color-border);
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
    background: var(--color-bg-secondary);
}

/* Toast */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    left: var(--space-lg);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-width: 400px;
}

.toast {
    background: var(--color-bg-primary);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md) var(--space-lg);
    min-width: 300px;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-success {
    border-right: 4px solid var(--color-success);
    background: #f0fdf4;
}

.toast-error {
    border-right: 4px solid var(--color-error);
    background: #fef2f2;
}

.toast-info {
    border-right: 4px solid var(--color-info);
    background: #eff6ff;
}

.toast-warning {
    border-right: 4px solid var(--color-warning);
    background: #fffbeb;
}

.toast-icon {
    font-size: var(--font-size-xl);
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    color: var(--color-text-primary);
    font-weight: var(--font-weight-medium);
}

/* Filters */
.filters-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.filters-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.filter-group {
    margin-bottom: var(--spacing-md);
}

.filter-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-3xl);
    color: var(--color-text-muted);
    margin: var(--space-2xl) 0;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
    color: var(--color-text-muted);
}

.empty-state-icon .icon {
    width: 4rem;
    height: 4rem;
}

.empty-state-title {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-sm);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-semibold);
}

.empty-state-desc {
    color: var(--color-text-muted);
    font-size: var(--font-size-base);
}

/* Image Slider */
.image-slider-wrapper {
    position: relative;
    width: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-bg-secondary);
    box-shadow: var(--shadow-md);
    border: 3px solid var(--color-border);
}

.image-slider-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.image-slide {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    transform: translateX(0);
}

.image-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
}

.image-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-slide-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: var(--color-primary);
}

/* Back Button */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-bg-secondary);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-base);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.btn-back:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-primary);
    transform: translateX(-4px);
    box-shadow: var(--shadow-md);
}

.btn-back .icon {
    width: 1.25rem;
    height: 1.25rem;
    transition: transform var(--transition-fast);
}

.btn-back:hover .icon {
    transform: translateX(4px);
}

/* Dashboard Back Button (compact) */
.btn-back.btn-back--dashboard {
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-lg);
    margin-bottom: 0;
    background: var(--color-bg-primary);
}

[dir="rtl"] .btn-back.btn-back--dashboard:hover {
    transform: translateX(2px);
}

[dir="ltr"] .btn-back.btn-back--dashboard:hover {
    transform: translateX(-2px);
}

[dir="rtl"] .btn-back.btn-back--dashboard:hover .icon {
    transform: translateX(4px);
}

[dir="ltr"] .btn-back.btn-back--dashboard:hover .icon {
    transform: translateX(-4px);
}

.dashboard-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

.dashboard-topbar-title {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.dashboard-topbar-title h2 {
    margin: 0;
}

.dashboard-topbar-subtitle {
    margin: 0;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

/* Product images (dashboard forms) */
.product-images-panel {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-bg-secondary);
    padding: var(--space-md);
}

.product-images-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    align-items: center;
    margin-top: var(--space-sm);
}

.product-images-actions .form-input {
    flex: 1;
    min-width: 220px;
}

.product-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.product-image-thumb {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--color-border);
    background: var(--color-bg-primary);
    aspect-ratio: 1 / 1;
    box-shadow: var(--shadow-sm);
}

.product-image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.product-image-thumb .remove {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--color-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.product-image-thumb .remove:hover {
    transform: scale(1.05);
    border-color: var(--color-error);
}

.image-slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    height: 3rem;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all var(--transition-fast);
    color: var(--color-text-primary);
    box-shadow: var(--shadow-md);
}

.image-slider-btn:hover {
    background: var(--color-bg-primary);
    border-color: var(--color-primary);
    transform: translateY(-50%) scale(1.1);
    box-shadow: var(--shadow-lg);
}

.image-slider-prev {
    right: var(--space-md);
}

.image-slider-next {
    left: var(--space-md);
}

.image-slider-dots {
    position: absolute;
    bottom: var(--space-md);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--space-sm);
    z-index: 10;
}

.image-slider-dot {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    border: 2px solid rgba(255, 255, 255, 0.8);
    background: transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
}

.image-slider-dot.active {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.2);
}

