/**
 * DigiCamera Malaysia - Main Stylesheet
 * 
 * Custom styles, animations, and utilities
 * Uses Tailwind CSS as base framework
 */

/* ===================================
   GLOBAL STYLES
   =================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===================================
   CUSTOM ANIMATIONS
   =================================== */

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

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

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Animation Classes */
.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-in;
}

.animate-slide-in-right {
    animation: slideInRight 0.5s ease-out;
}

.animate-slide-in-left {
    animation: slideInLeft 0.5s ease-out;
}

.animate-scale-in {
    animation: scaleIn 0.4s ease-out;
}

/* ===================================
   LOADING STATES
   =================================== */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

.skeleton-text {
    height: 1rem;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

.skeleton-image {
    width: 100%;
    padding-bottom: 100%; /* 1:1 aspect ratio */
    border-radius: 0.5rem;
}

/* ===================================
   BUTTONS & INTERACTIONS
   =================================== */

.btn {
    @apply inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-lg shadow-sm transition-all duration-300 focus:outline-none focus:ring-2 focus:ring-offset-2;
}

.btn-primary {
    @apply bg-primary-600 text-white hover:bg-primary-700 focus:ring-primary-500;
}

.btn-secondary {
    @apply bg-gray-600 text-white hover:bg-gray-700 focus:ring-gray-500;
}

.btn-outline {
    @apply bg-transparent border-2 border-primary-600 text-primary-600 hover:bg-primary-600 hover:text-white focus:ring-primary-500;
}

.btn-danger {
    @apply bg-red-600 text-white hover:bg-red-700 focus:ring-red-500;
}

.btn-success {
    @apply bg-green-600 text-white hover:bg-green-700 focus:ring-green-500;
}

.btn-sm {
    @apply px-4 py-2 text-sm;
}

.btn-lg {
    @apply px-8 py-4 text-lg;
}

.btn:disabled {
    @apply opacity-50 cursor-not-allowed;
}

/* Hover Effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* ===================================
   FORMS
   =================================== */

.form-input,
.form-textarea,
.form-select {
    @apply w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500 transition-all duration-300;
}

.form-input:disabled,
.form-textarea:disabled,
.form-select:disabled {
    @apply bg-gray-100 cursor-not-allowed;
}

.form-label {
    @apply block text-sm font-medium text-gray-700 mb-2;
}

.form-error {
    @apply text-sm text-red-600 mt-1;
}

.form-helper {
    @apply text-sm text-gray-500 mt-1;
}

/* Custom Checkbox */
.custom-checkbox {
    @apply w-5 h-5 text-primary-600 border-gray-300 rounded focus:ring-primary-500;
}

/* Custom Radio */
.custom-radio {
    @apply w-5 h-5 text-primary-600 border-gray-300 focus:ring-primary-500;
}

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

.card {
    @apply bg-white rounded-lg shadow-md overflow-hidden transition-shadow duration-300;
}

.card:hover {
    @apply shadow-xl;
}

.card-header {
    @apply px-6 py-4 border-b border-gray-200;
}

.card-body {
    @apply px-6 py-4;
}

.card-footer {
    @apply px-6 py-4 border-t border-gray-200 bg-gray-50;
}

/* Product Card Specific */
.product-card {
    @apply bg-white rounded-lg overflow-hidden shadow-md transition-all duration-300;
}

.product-card:hover {
    @apply shadow-2xl transform -translate-y-1;
}

.product-card img {
    @apply w-full h-64 object-cover transition-transform duration-500;
}

.product-card:hover img {
    @apply scale-110;
}

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

.badge {
    @apply inline-flex items-center px-3 py-1 rounded-full text-xs font-medium;
}

.badge-primary {
    @apply bg-primary-100 text-primary-800;
}

.badge-success {
    @apply bg-green-100 text-green-800;
}

.badge-warning {
    @apply bg-yellow-100 text-yellow-800;
}

.badge-danger {
    @apply bg-red-100 text-red-800;
}

.badge-info {
    @apply bg-blue-100 text-blue-800;
}

/* ===================================
   ALERTS & TOASTS
   =================================== */

.alert {
    @apply p-4 rounded-lg border flex items-start space-x-3;
}

.alert-success {
    @apply bg-green-50 border-green-200 text-green-800;
}

.alert-error {
    @apply bg-red-50 border-red-200 text-red-800;
}

.alert-warning {
    @apply bg-yellow-50 border-yellow-200 text-yellow-800;
}

.alert-info {
    @apply bg-blue-50 border-blue-200 text-blue-800;
}

/* Toast Notifications */
.toast {
    @apply bg-white rounded-lg shadow-lg p-4 mb-2 animate-slide-in-right;
}

.toast-success {
    @apply border-l-4 border-green-500;
}

.toast-error {
    @apply border-l-4 border-red-500;
}

.toast-warning {
    @apply border-l-4 border-yellow-500;
}

.toast-info {
    @apply border-l-4 border-blue-500;
}

/* ===================================
   MODAL & OVERLAY
   =================================== */

.modal-overlay {
    @apply fixed inset-0 bg-black bg-opacity-50 z-50 flex items-center justify-center p-4;
}

.modal {
    @apply bg-white rounded-lg shadow-2xl max-w-lg w-full max-h-screen overflow-y-auto animate-scale-in;
}

.modal-header {
    @apply px-6 py-4 border-b border-gray-200 flex items-center justify-between;
}

.modal-body {
    @apply px-6 py-4;
}

.modal-footer {
    @apply px-6 py-4 border-t border-gray-200 flex items-center justify-end space-x-3;
}

/* ===================================
   LIGHTBOX / IMAGE GALLERY
   =================================== */

.lightbox {
    @apply fixed inset-0 bg-black bg-opacity-90 z-50 flex items-center justify-center p-4;
}

.lightbox-image {
    @apply max-w-full max-h-full object-contain;
}

.lightbox-close {
    @apply absolute top-4 right-4 text-white hover:text-gray-300 transition-colors;
}

.lightbox-nav {
    @apply absolute top-1/2 transform -translate-y-1/2 text-white hover:text-gray-300 transition-colors p-4;
}

.lightbox-nav-prev {
    @apply left-4;
}

.lightbox-nav-next {
    @apply right-4;
}

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

.pagination {
    @apply flex items-center space-x-1;
}

.pagination-item {
    @apply w-10 h-10 flex items-center justify-center rounded-lg border border-gray-300 text-gray-700 hover:bg-primary-50 hover:border-primary-500 hover:text-primary-600 transition-all;
}

.pagination-item.active {
    @apply bg-primary-600 border-primary-600 text-white;
}

.pagination-item:disabled {
    @apply opacity-50 cursor-not-allowed;
}

/* ===================================
   PRICE FORMATTING
   =================================== */

.price {
    @apply text-gray-900 font-bold;
}

.price-currency {
    @apply text-sm font-normal;
}

.price-original {
    @apply text-gray-500 line-through text-sm font-normal;
}

.price-discount {
    @apply text-red-600 text-sm font-medium ml-2;
}

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

/* Hide scrollbar but keep functionality */
.hide-scrollbar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.hide-scrollbar::-webkit-scrollbar {
    display: none;  /* Chrome, Safari, Opera */
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #0ea5e9;
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #0284c7;
}

/* ===================================
   ASPECT RATIO HELPERS
   =================================== */

.aspect-square {
    aspect-ratio: 1 / 1;
}

.aspect-portrait {
    aspect-ratio: 9 / 16;
}

.aspect-landscape {
    aspect-ratio: 16 / 9;
}

.aspect-video {
    aspect-ratio: 16 / 9;
}

/* ===================================
   TEXT UTILITIES
   =================================== */

.text-gradient {
    background: linear-gradient(135deg, #0ea5e9 0%, #d946ef 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.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;
}

/* ===================================
   DIVIDERS
   =================================== */

.divider {
    @apply border-t border-gray-200 my-6;
}

.divider-text {
    @apply flex items-center text-sm text-gray-500 my-6;
}

.divider-text::before,
.divider-text::after {
    content: '';
    @apply flex-1 border-t border-gray-200;
}

.divider-text::before {
    @apply mr-4;
}

.divider-text::after {
    @apply ml-4;
}

/* ===================================
   UTILITY CLASSES
   =================================== */

.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.shadow-soft {
    box-shadow: 0 2px 15px -3px rgba(0, 0, 0, 0.07), 0 10px 20px -2px rgba(0, 0, 0, 0.04);
}

.shadow-hard {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ===================================
   PRINT STYLES
   =================================== */

@media print {
    .no-print {
        display: none !important;
    }
    
    header,
    footer,
    .back-to-top {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
    }
    
    a {
        text-decoration: underline;
    }
}

/* ===================================
   ACCESSIBILITY
   =================================== */

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

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #0ea5e9;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
