/**
 * Maulamvideo - Custom Styles
 * Main stylesheet for the e-commerce platform
 * Uses Tailwind CSS for utility classes, this file contains custom components
 */

/* ================================
   CSS Variables & Root Settings
   ================================ */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --accent: #ec4899;
    --accent-dark: #db2777;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --success: #22c55e;
    --warning: #eab308;
    --error: #ef4444;
}

/* ================================
   Base Styles
   ================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

img {
    max-width: 100%;
    height: auto;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ================================
   Animations
   ================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

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

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

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

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

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

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

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

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

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-bounce {
    animation: bounce 2s infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Shimmer Loading Effect */
.skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

/* ================================
   Buttons
   ================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-weight: 500;
    border-radius: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    font-size: 14px;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: white;
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(236, 72, 153, 0.3);
}

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

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 10px;
}

/* ================================
   Cards
   ================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: var(--primary);
}

.card-body {
    padding: 20px;
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* Product Card */
.product-card {
    position: relative;
}

.product-card .badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
}

.product-card .product-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.product-card:hover .product-actions {
    opacity: 1;
    transform: translateY(0);
}

/* ================================
   Badges & Tags
   ================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

.badge-accent {
    background: rgba(236, 72, 153, 0.2);
    color: #f472b6;
}

.badge-success {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.badge-warning {
    background: rgba(234, 179, 8, 0.2);
    color: #facc15;
}

.badge-error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Flash Sale Badge */
.badge-flash {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    animation: pulse 1s infinite;
}

/* ================================
   Flash Sale Timer
   ================================ */
.flash-timer {
    display: flex;
    align-items: center;
    gap: 8px;
}

.flash-timer .timer-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 8px 12px;
    min-width: 50px;
}

.flash-timer .timer-value {
    font-size: 24px;
    font-weight: 700;
    color: #f87171;
    line-height: 1;
}

.flash-timer .timer-label {
    font-size: 10px;
    color: #94a3b8;
    text-transform: uppercase;
}

.flash-timer .timer-separator {
    font-size: 24px;
    font-weight: 700;
    color: #f87171;
}

/* ================================
   Forms
   ================================ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-input::placeholder {
    color: #64748b;
}

.form-input.error {
    border-color: var(--error);
}

.form-error {
    color: var(--error);
    font-size: 12px;
    margin-top: 6px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

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

/* Quantity Input */
.quantity-input {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.quantity-input button {
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
}

.quantity-input button:hover {
    background: var(--primary);
}

.quantity-input input {
    width: 60px;
    height: 40px;
    text-align: center;
    background: var(--bg-dark);
    border: none;
    color: var(--text-primary);
    font-weight: 600;
}

/* ================================
   Navigation
   ================================ */
.nav-link {
    position: relative;
    padding: 8px 16px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
}

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

.nav-link.active {
    color: var(--primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 16px;
    right: 16px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    z-index: 100;
    padding: 80px 20px 20px;
}

.mobile-menu.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ================================
   Dropdown
   ================================ */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    z-index: 50;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* ================================
   Modal
   ================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

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

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

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ================================
   Toast Notifications
   ================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideInRight 0.3s ease;
    min-width: 300px;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--error);
}

.toast.warning {
    border-color: var(--warning);
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast.success .toast-icon {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.toast.error .toast-icon {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 14px;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

/* ================================
   Tables
   ================================ */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
}

.table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* ================================
   Cart
   ================================ */
.cart-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-dark);
    flex-shrink: 0;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.cart-item-price {
    color: var(--accent);
    font-weight: 600;
}

.cart-item-original-price {
    text-decoration: line-through;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Cart Summary */
.cart-summary {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.cart-summary-total {
    font-size: 20px;
    font-weight: 700;
}

/* ================================
   Hero Banner
   ================================ */
.hero {
    position: relative;
    padding: 80px 0;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content {
    position: relative;
    z-index: 1;
}

/* ================================
   Footer
   ================================ */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 60px 0 30px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

.footer-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-links a:hover {
    color: var(--primary);
}

/* ================================
   Utilities
   ================================ */
.text-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.bg-gradient-accent {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
}

.bg-gradient-mixed {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
}

.glass {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.hover-glow {
    transition: box-shadow 0.2s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

/* ================================
   Responsive
   ================================ */
@media (max-width: 1024px) {
    .hero {
        padding: 60px 0;
    }
}

@media (max-width: 768px) {
    .hero {
        padding: 40px 0;
    }

    .btn {
        padding: 10px 20px;
    }

    .flash-timer .timer-unit {
        padding: 6px 8px;
        min-width: 40px;
    }

    .flash-timer .timer-value {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .flash-timer {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ================================
   Mobile Optimizations
   ================================ */

/* Safe area for notched devices (iPhone X+) */
body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Touch-friendly tap targets (minimum 44px per Apple/Google guidelines) */
@media (max-width: 768px) {
    a, button, [role="button"], input[type="submit"], 
    input[type="button"], select {
        min-height: 44px;
    }

    /* Better mobile typography */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.15rem; }

    /* Prevent text overflow */
    .container {
        overflow-x: hidden;
    }

    /* Better card spacing on mobile */
    .card-body {
        padding: 16px;
    }

    /* Improve table scrolling on mobile */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Fix input zoom on iOS (font-size must be >= 16px) */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="search"],
    input[type="tel"],
    input[type="url"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

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

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

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

/* ================================
   Print Styles
   ================================ */
@media print {
    body {
        background: white;
        color: black;
    }

    .no-print {
        display: none !important;
    }
}
