/**
 * Component Styles - Eliminates inline styles
 * All OOP components should use these classes instead of inline styles
 */

/* ==========================================================================
   Base Component Styles
   ========================================================================== */

.component {
    position: relative;
    box-sizing: border-box;
}

.component-hidden {
    display: none !important;
}

.component-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ==========================================================================
   Form Field Component
   ========================================================================== */

.form-field {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--text-color);
}

.form-label .required-indicator {
    color: var(--error-color, #F44336);
}

.form-input-wrapper {
    position: relative;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--primary-color, #E6DAF0);
    border-radius: 5px;
    font-size: 1rem;
    background: white;
    transition: border-color 0.3s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--secondary-color, #B89FCE);
    box-shadow: 0 0 0 3px rgba(230, 218, 240, 0.2);
}

.form-field.invalid .form-input,
.form-field.invalid .form-select,
.form-field.invalid .form-textarea {
    border-color: var(--error-color, #F44336);
}

.form-field.valid .form-input,
.form-field.valid .form-select,
.form-field.valid .form-textarea {
    border-color: var(--success-color, #4CAF50);
}

.form-error {
    color: var(--error-color, #F44336);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-help {
    color: #666;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-radio-group,
.form-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-radio-label,
.form-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.form-radio-label input,
.form-checkbox-label input {
    margin-right: 0.5rem;
}

/* ==========================================================================
   Product Card Component
   ========================================================================== */

.product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.product-card.product-added {
    animation: productAdded 1s ease;
}

@keyframes productAdded {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.product-card-image {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #E6DAF0, #FDF6E3);
}

.product-card-image-small {
    height: 100px;
}

.product-card-image-medium {
    height: 200px;
}

.product-card-image-large {
    height: 300px;
}

.product-card-icon {
    font-size: 4rem;
}

.product-card-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--accent-color, #FDF6E3);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.875rem;
}

.product-card-info {
    padding: 1rem;
}

.product-card-info-featured {
    padding: 1.5rem;
}

.product-card-name {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: var(--text-color);
}

.product-card-category {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    text-transform: capitalize;
}

.product-card-description {
    font-size: 0.9rem;
    color: #777;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.product-card-price {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color, #E6DAF0);
    margin-bottom: 1rem;
}

.product-card-price-large {
    font-size: 1.5rem;
}

.product-card-stock {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.stock-in-stock {
    background: #E8F5E9;
    color: #2E7D32;
}

.stock-low-stock {
    background: #FFF3E0;
    color: #E65100;
}

.stock-out-of-stock {
    background: #FFEBEE;
    color: #C62828;
}

.product-card-actions {
    display: flex;
    gap: 0.5rem;
}

.product-card-actions-featured {
    gap: 1rem;
}

.product-card-actions button {
    flex: 1;
}

.product-card-sizes {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.size-option {
    padding: 0.5rem 1rem;
    border: 2px solid var(--primary-color, #E6DAF0);
    background: white;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.size-option:hover,
.size-option.active {
    background: var(--primary-color, #E6DAF0);
}

/* Compact variant */
.product-card-compact .product-card-compact-wrapper {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    gap: 1rem;
}

.product-card-compact .product-card-image-small {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
}

.product-card-compact .product-card-compact-info {
    flex: 1;
}

.product-card-compact .product-card-name {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.product-card-compact .btn-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--primary-color, #E6DAF0);
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.product-card-compact .btn-icon:hover {
    background: var(--primary-color, #E6DAF0);
}

/* Admin variant */
.product-card-admin {
    padding: 1rem;
}

.product-card-admin-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.product-card-admin-header h4 {
    margin: 0;
}

.product-id {
    color: #999;
    font-size: 0.875rem;
}

.product-card-admin-details {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.product-card-admin-details > div {
    margin-bottom: 0.5rem;
}

.product-card-admin-actions {
    display: flex;
    gap: 0.5rem;
}

.status-active {
    color: var(--success-color, #4CAF50);
}

.status-inactive {
    color: var(--error-color, #F44336);
}

/* ==========================================================================
   Modal Component
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: var(--z-modal, 1100);
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-container {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--primary-color, #E6DAF0);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* ==========================================================================
   Toast Component
   ========================================================================== */

.toast-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: var(--z-toast, 1200);
}

.toast {
    position: fixed;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    max-width: 350px;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.toast-top-right {
    top: 20px;
    right: 20px;
}

.toast-top-left {
    top: 20px;
    left: 20px;
}

.toast-bottom-right {
    bottom: 20px;
    right: 20px;
}

.toast-bottom-left {
    bottom: 20px;
    left: 20px;
}

.toast-info {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.toast-success {
    background: linear-gradient(135deg, #84fab0, #8fd3f4);
    color: #155724;
}

.toast-warning {
    background: linear-gradient(135deg, #ffd89b, #19547b);
    color: #856404;
}

.toast-error {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
}

.toast button {
    margin-left: 1rem;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.toast button:hover {
    opacity: 1;
}

/* ==========================================================================
   Page Component
   ========================================================================== */

.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: var(--z-overlay, 1000);
}

.page-loader-content {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color, #E6DAF0);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* ==========================================================================
   Cart Summary Component
   ========================================================================== */

.cart-items {
    max-height: 400px;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.cart-item:last-child {
    border-bottom: none;
}

.order-summary {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f9f9f9;
    border-radius: 8px;
}

/* ==========================================================================
   Shipping Form Component
   ========================================================================== */

.shipping-form .form-section {
    margin-bottom: 2rem;
}

.shipping-form h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.shipping-options label {
    display: block;
    padding: 1rem;
    border: 2px solid var(--primary-color, #E6DAF0);
    border-radius: 5px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.shipping-options label:hover {
    background: rgba(230, 218, 240, 0.1);
}

.shipping-options input[type="radio"]:checked + label {
    background: var(--primary-color, #E6DAF0);
}

/* ==========================================================================
   Checkout Page Component
   ========================================================================== */

.checkout-content {
    padding: 2rem;
}

.checkout-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.checkout-progress .step {
    flex: 1;
    text-align: center;
    padding: 1rem;
    background: #f0f0f0;
    border-radius: 5px;
    margin-right: 0.5rem;
}

.checkout-progress .step:last-child {
    margin-right: 0;
}

.checkout-progress .step.active {
    background: var(--primary-color, #E6DAF0);
}

.checkout-progress .step-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #ccc;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.5rem;
}

.checkout-progress .step.active .step-number {
    background: var(--secondary-color, #B89FCE);
}

.payment-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f9f9f9;
    border-radius: 8px;
}

/* ==========================================================================
   Button Styles
   ========================================================================== */

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    text-align: center;
    display: inline-block;
}

.btn-primary {
    background: var(--primary-color, #E6DAF0);
    color: #333;
}

.btn-primary:hover {
    background: var(--secondary-color, #B89FCE);
}

.btn-secondary {
    background: white;
    color: #333;
    border: 2px solid var(--primary-color, #E6DAF0);
}

.btn-secondary:hover {
    background: var(--primary-color, #E6DAF0);
}

.btn-danger {
    background: var(--error-color, #F44336);
    color: white;
}

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

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.flex-center {
    justify-content: center;
    align-items: center;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.gap-3 {
    gap: 1.5rem;
}

.gap-4 {
    gap: 2rem;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }