/* IT Center E-commerce - Shared Components CSS */
/* Following the architecture defined in ARCHITECTURE.md */

/* ===== CSS CUSTOM PROPERTIES (VARIABLES) ===== */
:root {
    /* Primary Colors */
    --primary-dark: #1f2937;
    --primary-blue: #2563eb;
    --primary-light-blue: #3b82f6;
    --primary-gray: #111827;
    
    /* Secondary Colors */
    --secondary-orange: #e69270;
    --secondary-red: #ef4444;
    --secondary-green: #10b981;
    --secondary-yellow: #f59e0b;
    
    /* Background Colors */
    --bg-primary: #fafafa;
    --bg-secondary: #f5f5f5;
    --bg-card: #ffffff;
    --bg-dark: #1a1a1a;
    
    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-white: #ffffff;
    
    /* Spacing Scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 50px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.15);
    
    /* Typography Scale */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    --transition-bounce: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== TYPOGRAPHY ===== */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }

.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

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

/* ===== LAYOUT COMPONENTS ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-8);
    width: 100%;
    box-sizing: border-box;
}

.section {
    padding: var(--space-16) 0;
}

.section-sm {
    padding: var(--space-12) 0;
}

.section-lg {
    padding: var(--space-20) 0;
}

/* ===== CARD COMPONENTS ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-bounce);
    overflow: hidden;
}

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

.card-header {
    padding: var(--space-6);
    border-bottom: 1px solid #e5e7eb;
}

.card-body {
    padding: var(--space-6);
}

.card-footer {
    padding: var(--space-6);
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

/* Product Card Specific */
.product-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-bounce);
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.product-card-image {
    width: 100%;
    height: 200px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: var(--space-4);
}

.product-card-image img {
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
    transition: transform var(--transition-normal);
}

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

.product-card-content {
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-card-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-description {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.product-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: var(--space-3);
    border-top: 1px solid #f1f5f9;
}

.product-price {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.product-price-original {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-weight: 500;
}

/* ===== BUTTON COMPONENTS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: var(--text-sm);
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition-bounce);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-gray) 100%);
    color: var(--text-white);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(31, 41, 55, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--primary-blue);
    color: var(--text-white);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--secondary-green) 0%, #059669 100%);
    color: var(--text-white);
}

.btn-danger {
    background: linear-gradient(135deg, var(--secondary-red) 0%, #dc2626 100%);
    color: var(--text-white);
}

.btn-warning {
    background: linear-gradient(135deg, var(--secondary-yellow) 0%, #d97706 100%);
    color: var(--text-white);
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-lg);
}

.btn-xl {
    padding: var(--space-5) var(--space-10);
    font-size: var(--text-xl);
}

/* Button Shapes */
.btn-rounded {
    border-radius: var(--radius-full);
}

.btn-square {
    border-radius: var(--radius-sm);
}

/* Icon Buttons */
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== FORM COMPONENTS ===== */
.form-group {
    margin-bottom: var(--space-6);
}

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

.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    transition: all var(--transition-normal);
    background: var(--bg-card);
    color: var(--text-primary);
}

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

.form-input:invalid {
    border-color: var(--secondary-red);
}

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

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

[dir="rtl"] .form-select {
    background-position: left 0.5rem center;
    padding-right: var(--space-4);
    padding-left: 2.5rem;
}

/* ===== BADGE COMPONENTS ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

[dir="rtl"] .badge {
    text-transform: none;
    letter-spacing: normal;
}

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

.badge-success {
    background: var(--secondary-green);
    color: var(--text-white);
}

.badge-danger {
    background: var(--secondary-red);
    color: var(--text-white);
}

.badge-warning {
    background: var(--secondary-yellow);
    color: var(--text-white);
}

.badge-secondary {
    background: #f1f5f9;
    color: var(--text-secondary);
}

/* ===== ALERT COMPONENTS ===== */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.alert-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fed7aa;
    color: #92400e;
}

.alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

/* ===== LOADING COMPONENTS ===== */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-dots {
    display: inline-flex;
    gap: var(--space-1);
}

.loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-blue);
    animation: bounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ===== MODAL COMPONENTS ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: var(--space-6);
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--text-xl);
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: all var(--transition-normal);
}

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

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

.modal-footer {
    padding: var(--space-6);
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* ===== UTILITY CLASSES ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.m-1 { margin: var(--space-1); }
.m-2 { margin: var(--space-2); }
.m-3 { margin: var(--space-3); }
.m-4 { margin: var(--space-4); }
.m-6 { margin: var(--space-6); }
.m-8 { margin: var(--space-8); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

.transition { transition: all var(--transition-normal); }
.transition-fast { transition: all var(--transition-fast); }
.transition-slow { transition: all var(--transition-slow); }

.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

.select-none { user-select: none; }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-0 { top: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }

.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

/* ===== RESPONSIVE UTILITIES ===== */
@media (max-width: 640px) {
    .container { padding: 0 var(--space-4); }
    .sm\:grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
    .sm\:text-sm { font-size: var(--text-sm); }
    .sm\:p-4 { padding: var(--space-4); }
}

@media (max-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:text-base { font-size: var(--text-base); }
    .md\:p-6 { padding: var(--space-6); }
}

@media (max-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:text-lg { font-size: var(--text-lg); }
}

@media (max-width: 1280px) {
    .xl\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ===== RTL SUPPORT ===== */
[dir="rtl"] .form-group {
    text-align: right;
}

[dir="rtl"] .form-label {
    text-align: right;
}

[dir="rtl"] .form-input {
    text-align: right;
    direction: rtl;
}

[dir="rtl"] .modal-footer {
    direction: rtl;
}

[dir="rtl"] .modal-header {
    direction: rtl;
}

[dir="rtl"] .modal-body {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .product-card-content {
    text-align: right;
}

[dir="rtl"] .product-card-footer {
    direction: rtl;
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    .dark\:bg-gray-900 { background-color: #111827; }
    .dark\:text-white { color: #ffffff; }
    .dark\:border-gray-700 { border-color: #374151; }
}

/* ===== PRINT STYLES ===== */
@media print {
    .no-print { display: none !important; }
    .print\:block { display: block !important; }
    .print\:hidden { display: none !important; }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for accessibility */
.focus\:outline-none:focus { outline: none; }
.focus\:ring:focus { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .card {
        border: 1px solid currentColor;
    }
}

/* ===== PROMOTIONAL AD BANNER STYLES ===== */
.promotional-ad-overlay {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.promotional-ad-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    padding: 20px 40px;
    text-align: right;
    z-index: 2;
}

/* RTL: Align to left side instead */
[dir="rtl"] .promotional-ad-content {
    align-items: flex-start;
    text-align: left;
    padding: 20px 40px;
}

.promotional-ad-title {
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 8px 0;
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.5),
        0 4px 8px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
}

.promotional-ad-subtitle {
    font-weight: 500;
    line-height: 1.5;
    margin: 0 0 16px 0;
    text-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.5),
        0 2px 6px rgba(0, 0, 0, 0.3);
    max-width: 85%;
    opacity: 0.95;
}

.promotional-ad-button {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.3),
        0 2px 5px rgba(0, 0, 0, 0.2);
    border: none;
    cursor: pointer;
    text-decoration: none;
    min-width: 120px;
    text-align: center;
}

.promotional-ad-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.4),
        0 4px 10px rgba(0, 0, 0, 0.3);
}


/* Responsive adjustments for promotional ad content */
@media (max-width: 768px) {
    .promotional-ad-content {
        padding: 15px;
    }
    
    .promotional-ad-title {
        font-size: 22px !important;
        margin-bottom: 6px;
    }
    
    .promotional-ad-subtitle {
        font-size: 13px !important;
        max-width: 90%;
        margin-bottom: 12px;
    }
    
    .promotional-ad-button {
        padding: 10px 20px;
        font-size: 12px;
        min-width: 100px;
    }
}

@media (max-width: 480px) {
    .promotional-ad-content {
        padding: 10px;
    }
    
    .promotional-ad-title {
        font-size: 18px !important;
    }
    
    .promotional-ad-subtitle {
        font-size: 11px !important;
    }
    
    .promotional-ad-button {
        padding: 8px 16px;
        font-size: 11px;
        min-width: 80px;
    }
}
