/* =============================================
   Consulex - Custom Styles
   ============================================= */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Line Clamp */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Product Card */
.product-card {
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.product-card:hover {
    transform: translateY(-2px);
}

/* Flash Messages */
.flash-message {
    animation: flashFadeIn 0.3s ease;
}

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

/* Cookie Banner Animation */
#cookie-banner.show {
    transform: translateY(0) !important;
}

/* Mobile Sidebar */
#mobile-sidebar.open {
    display: block !important;
}

#mobile-sidebar.open #sidebar-panel {
    transform: translateX(0);
}

/* Scrollbar Custom */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f3f4f6;
}

::-webkit-scrollbar-thumb {
    background: #9ca3af;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Search Autocomplete */
#search-results .search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    transition: background 0.15s ease;
    cursor: pointer;
}

#search-results .search-item:hover {
    background: #f3f4f6;
}

#search-results .search-item img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Product Gallery */
.gallery-thumb {
    border: 2px solid transparent;
    transition: border-color 0.2s ease;
    cursor: pointer;
}

.gallery-thumb.active,
.gallery-thumb:hover {
    border-color: #166534;
}

/* Quantity Input */
.qty-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    cursor: pointer;
    transition: background 0.15s ease;
    user-select: none;
}

.qty-btn:hover {
    background: #e5e7eb;
}

.qty-input {
    width: 50px;
    height: 36px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-left: none;
    border-right: none;
    outline: none;
    font-size: 14px;
}

/* Tab System */
.tab-btn {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab-btn:hover {
    color: #166534;
}

.tab-btn.active {
    color: #166534;
    border-bottom-color: #166534;
}

/* Tab content visibility controlled by Tailwind 'hidden' class */

/* Share Buttons */
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
    color: #6b7280;
}

.share-btn:hover {
    border-color: #166534;
    color: #166534;
}

.share-btn.facebook:hover {
    background: #1877f2;
    border-color: #1877f2;
    color: white;
}

.share-btn.twitter:hover {
    background: #000;
    border-color: #000;
    color: white;
}

.share-btn.whatsapp:hover {
    background: #25d366;
    border-color: #25d366;
    color: white;
}

.share-btn.copy:hover {
    background: #166534;
    border-color: #166534;
    color: white;
}

/* Notifications Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    padding: 14px 20px;
    border-radius: 2px;
    color: white;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 360px;
}

.toast.success {
    background: #166534;
}

.toast.error {
    background: #dc2626;
}

.toast.info {
    background: #1e40af;
}

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

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

/* Back to Top Button */
#btn-back-top.visible {
    display: flex !important;
}

/* No Image Placeholder */
.no-image {
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

/* Spec Table */
.spec-table tr:nth-child(even) {
    background: #f9fafb;
}

.spec-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
}

.spec-table td:first-child {
    font-weight: 500;
    color: #374151;
    width: 40%;
}

/* Input Focus */
input:focus, 
textarea:focus, 
select:focus {
    outline: none;
    border-color: #166534;
    box-shadow: 0 0 0 1px #166534;
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Breadcrumb */
.breadcrumb a:hover {
    text-decoration: underline;
}

/* Mobile-specific adjustments */
@media (max-width: 639px) {
    .product-card .text-lg {
        font-size: 1rem;
    }
    
    .product-card .text-sm {
        font-size: 0.75rem;
    }
    
    .product-card .p-4 {
        padding: 0.75rem;
    }
}

/* Print styles */
@media print {
    header, footer, #cookie-banner, #whatsapp-float, #btn-back-top, .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        color: #000;
    }
}

/* Aspect Ratio Helper */
.aspect-square {
    aspect-ratio: 1 / 1;
}

/* Badge pulse for cart */
@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

.badge-pulse {
    animation: pulse-badge 0.3s ease;
}

/* Discount badge */
.discount-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
}

/* Smooth image transitions */
img {
    transition: opacity 0.3s ease;
}

img[loading="lazy"] {
    opacity: 0;
}

img[loading="lazy"].loaded,
img:not([loading="lazy"]) {
    opacity: 1;
}

/* Form styling consistency */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
textarea,
select {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
}

/* Admin sidebar active indicator */
.admin-nav-active {
    background: rgba(22, 101, 52, 0.2);
    border-left: 3px solid #15803d;
}
