/**
 * Digital Template Store - Custom Styles
 */

/* Root variables */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
}

/* Body */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-800);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar enhancements */
.navbar {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Hero section */
.hero-section {
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    border-bottom: 1px solid var(--gray-200);
}

/* Product cards */
.product-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--gray-200);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.product-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 12px;
    color: white !important;
}

.product-icon i {
    font-size: 1.75rem;
    color: white;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    font-weight: 500;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #1e40af 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    border: none;
}

/* Cards */
.card {
    border-radius: 12px;
    overflow: hidden;
}

.card-header {
    border-bottom: 1px solid var(--gray-100);
}

/* Form controls */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-control-lg {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border-radius: 8px;
}

/* Tables */
.table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    border-bottom-width: 1px;
}

.table td {
    vertical-align: middle;
    padding: 1rem 0.75rem;
}

.table-hover tbody tr:hover {
    background-color: var(--gray-50);
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.4em 0.8em;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 8px;
}

/* Success page animation */
.success-icon {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Footer */
footer {
    margin-top: auto;
}

/* Sticky sidebar card */
.sticky-top {
    z-index: 100;
}

/* Price display */
.price-display {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Loading state */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Product description formatting */
.product-description {
    line-height: 1.8;
    color: var(--gray-600);
}

/* Product image carousel */
#productCarousel .carousel-item img {
    transition: opacity 0.3s ease;
}

#productCarousel .carousel-item img:hover {
    opacity: 0.95;
}

/* Thumbnail navigation */
.thumbnail-nav {
    transition: opacity 0.2s ease, transform 0.2s ease;
    border: 2px solid transparent;
}

.thumbnail-nav:hover {
    opacity: 1 !important;
    transform: scale(1.05);
}

.thumbnail-nav.active {
    border-color: var(--primary-color);
    opacity: 1 !important;
}

/* Product card image */
.product-card .card-img-top {
    transition: transform 0.3s ease;
}

.product-card:hover .card-img-top {
    transform: scale(1.02);
}

/* Image gallery in admin */
#imageGrid .card {
    transition: transform 0.2s ease;
}

#imageGrid .card:hover {
    transform: translateY(-2px);
}

/* Admin specific */
.admin-sidebar .nav {
    padding-bottom: 2rem;
}

.admin-content {
    overflow-x: hidden;
}

/* KPI cards */
.kpi-card {
    border-left: 4px solid transparent;
}

.kpi-card.revenue { border-left-color: var(--success-color); }
.kpi-card.orders { border-left-color: var(--primary-color); }
.kpi-card.downloads { border-left-color: var(--warning-color); }
.kpi-card.products { border-left-color: var(--danger-color); }

/* File input styling */
.form-control[type="file"] {
    padding: 0.5rem;
}

.form-control[type="file"]::file-selector-button {
    padding: 0.5rem 1rem;
    margin-right: 1rem;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 4px;
    cursor: pointer;
}

.form-control[type="file"]::file-selector-button:hover {
    background: var(--primary-dark);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 1.75rem;
    }
    
    .product-card .card-body {
        padding: 1.25rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
}

/* Print styles */
@media print {
    .navbar,
    .admin-sidebar,
    .btn,
    footer {
        display: none !important;
    }
    
    .admin-content {
        margin-left: 0 !important;
    }
}

/* Accessibility */
.visually-hidden {
    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 */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}
