/* ===== ROOT VARIABLES ===== */
:root {
    --primary: #6C63FF;
    --primary-dark: #5A52D5;
    --primary-light: #8B83FF;
    --secondary: #FF6B6B;
    --accent: #4ECDC4;
    --dark: #1a1a2e;
    --dark-2: #16213e;
    --dark-3: #0f3460;
    --light: #f8f9fa;
    --gray: #6c757d;
    --gray-light: #e9ecef;
    --gradient-1: linear-gradient(135deg, #6C63FF 0%, #4ECDC4 100%);
    --gradient-2: linear-gradient(135deg, #FF6B6B 0%, #6C63FF 100%);
    --gradient-3: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.16);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--light);
    color: #333;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

a { text-decoration: none; transition: var(--transition); }

.text-gradient {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== GLASSMORPHISM NAVBAR ===== */
.glass-navbar {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.3);
    box-shadow: var(--shadow-sm);
    padding: 0.8rem 0;
    z-index: 1050;
}

.navbar-brand {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--dark) !important;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.nav-link {
    color: var(--dark) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    color: var(--primary) !important;
    background: rgba(108,99,255,0.08);
}

/* ===== BUTTONS ===== */
.btn-gradient {
    background: var(--gradient-1);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-gradient:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108,99,255,0.4);
}

.btn-gradient::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}

.btn-gradient:hover::after { left: 100%; }

.btn-login {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 0.5rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: var(--transition);
}

.btn-login:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.btn-register {
    background: var(--gradient-1);
    color: white;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: var(--transition);
}

.btn-register:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108,99,255,0.4);
}

.btn-cart {
    background: var(--dark);
    color: white;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
}

.btn-cart:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--secondary);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-user {
    background: var(--gray-light);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: var(--transition);
}

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

/* ===== HERO SECTION ===== */
.hero-section {
    background: var(--gradient-3);
    position: relative;
    overflow: hidden;
    min-height: 85vh;
    display: flex;
    align-items: center;
    padding: 6rem 0 4rem;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(108,99,255,0.15) 0%, transparent 70%);
    border-radius: 50%;
    animation: float 8s ease-in-out infinite;
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(78,205,196,0.1) 0%, transparent 70%);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite reverse;
}

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

.hero-title {
    font-size: 3.5rem;
    font-weight: 900;
    color: white;
    line-height: 1.15;
    margin-bottom: 1.5rem;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 2rem;
    line-height: 1.7;
}

.hero-stats {
    display: flex;
    gap: 2.5rem;
    margin-top: 3rem;
}

.stat-item h3 {
    font-size: 2rem;
    font-weight: 800;
    color: white;
}

.stat-item p {
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
    margin: 0;
}

.hero-image {
    position: relative;
    z-index: 2;
}

.hero-image img {
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-height: 500px;
    object-fit: cover;
    width: 100%;
}

.floating-card {
    position: absolute;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    color: white;
    animation: floatCard 4s ease-in-out infinite;
}

.floating-card.card-1 { top: 10%; left: -10%; animation-delay: 0s; }
.floating-card.card-2 { bottom: 15%; right: -5%; animation-delay: 2s; }

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

/* ===== PRODUCT CARDS ===== */
.product-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--gray-light);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.product-card .card-img-wrapper {
    position: relative;
    overflow: hidden;
    height: 220px;
}

.product-card .card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

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

.product-card .badge-category {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-ebook { background: rgba(108,99,255,0.9); color: white; }
.badge-template { background: rgba(78,205,196,0.9); color: white; }

.product-card .card-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card .card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .card-text {
    font-size: 0.85rem;
    color: var(--gray);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.product-card .price-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.product-card .current-price {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
}

.product-card .original-price {
    font-size: 0.85rem;
    color: var(--gray);
    text-decoration: line-through;
}

.product-card .discount-badge {
    background: var(--secondary);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
}

.product-card .card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-add-cart {
    flex: 1;
    background: var(--gradient-1);
    color: white;
    border: none;
    padding: 0.6rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
    cursor: pointer;
}

.btn-add-cart:hover {
    box-shadow: 0 4px 15px rgba(108,99,255,0.4);
    transform: translateY(-2px);
    color: white;
}

.btn-wishlist {
    width: 42px;
    height: 42px;
    border: 2px solid var(--gray-light);
    background: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    cursor: pointer;
    color: var(--gray);
}

.btn-wishlist:hover {
    border-color: var(--secondary);
    color: var(--secondary);
}

/* ===== SECTION STYLES ===== */
.section-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.section-subtitle {
    color: var(--gray);
    font-size: 1.05rem;
    margin-bottom: 2.5rem;
}

/* ===== FEATURES SECTION ===== */
.feature-card {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-light);
    transition: var(--transition);
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: transparent;
}

.feature-icon {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 1.2rem;
}

.feature-icon.purple { background: rgba(108,99,255,0.1); color: var(--primary); }
.feature-icon.teal { background: rgba(78,205,196,0.1); color: var(--accent); }
.feature-icon.red { background: rgba(255,107,107,0.1); color: var(--secondary); }

/* ===== CATEGORY FILTER ===== */
.filter-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.filter-pill {
    padding: 0.5rem 1.2rem;
    border-radius: 25px;
    border: 2px solid var(--gray-light);
    background: white;
    color: var(--dark);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.filter-pill:hover, .filter-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===== AUTH PAGES ===== */
.auth-section {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    padding: 4rem 0;
    background: var(--gradient-3);
    position: relative;
}

.auth-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-xl);
    max-width: 450px;
    width: 100%;
    margin: 0 auto;
}

.auth-card h2 {
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.auth-card .text-muted { margin-bottom: 1.5rem; }

.form-floating-custom {
    position: relative;
    margin-bottom: 1rem;
}

.form-floating-custom .form-control {
    height: 52px;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-sm);
    padding: 0 1rem 0 2.8rem;
    font-size: 0.95rem;
    transition: var(--transition);
    background: white;
}

.form-floating-custom .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108,99,255,0.15);
}

.form-floating-custom .input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    font-size: 1.1rem;
}

.auth-card .btn-auth {
    width: 100%;
    height: 52px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1rem;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--gray);
    font-size: 0.85rem;
}

.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-light);
}

/* ===== CART PAGE ===== */
.cart-item {
    background: white;
    border-radius: var(--radius-md);
    padding: 1.25rem;
    border: 1px solid var(--gray-light);
    transition: var(--transition);
    margin-bottom: 1rem;
}

.cart-item:hover {
    box-shadow: var(--shadow-sm);
}

.cart-item img {
    width: 100px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.cart-summary {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    border: 1px solid var(--gray-light);
    position: sticky;
    top: 100px;
}

/* ===== DOWNLOADS PAGE ===== */
.download-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--gray-light);
    transition: var(--transition);
}

.download-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.download-icon {
    width: 60px;
    height: 60px;
    background: var(--gradient-1);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

/* ===== ADMIN DASHBOARD ===== */
.admin-wrapper {
    display: flex;
    min-height: calc(100vh - 80px);
}

.admin-sidebar {
    width: 260px;
    background: var(--dark);
    padding: 1.5rem;
    position: fixed;
    height: calc(100vh - 80px);
    overflow-y: auto;
    z-index: 100;
}

.admin-sidebar .nav-link {
    color: rgba(255,255,255,0.6) !important;
    padding: 0.75rem 1rem !important;
    border-radius: var(--radius-sm);
    margin-bottom: 0.25rem;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: rgba(108,99,255,0.2);
    color: white !important;
}

.admin-sidebar .nav-link i { margin-right: 0.75rem; }

.admin-content {
    margin-left: 260px;
    flex: 1;
    padding: 2rem;
    background: #f0f2f5;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--gray-light);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-card .stat-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--dark);
}

.stat-card .stat-label {
    color: var(--gray);
    font-size: 0.85rem;
}

/* ===== TABLE ===== */
.admin-table {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--gray-light);
}

.admin-table .table { margin-bottom: 0; }

.admin-table .table thead {
    background: var(--dark);
    color: white;
}

.admin-table .table thead th {
    font-weight: 600;
    font-size: 0.85rem;
    padding: 1rem;
    border: none;
}

.admin-table .table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-color: var(--gray-light);
}

.admin-table .table tbody tr:hover {
    background: rgba(108,99,255,0.03);
}

/* ===== FOOTER ===== */
.footer-section {
    background: var(--dark);
    color: rgba(255,255,255,0.7);
}

.footer-links a {
    color: rgba(255,255,255,0.6);
    font-size: 0.9rem;
    display: block;
    padding: 0.3rem 0;
}

.footer-links a:hover {
    color: var(--primary-light);
    padding-left: 5px;
}

.social-link {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.7);
    transition: var(--transition);
}

.social-link:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
}

/* ===== MODAL ===== */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.modal-header {
    background: var(--gradient-1);
    color: white;
    border: none;
    padding: 1.25rem 1.5rem;
}

.modal-header .btn-close { filter: brightness(0) invert(1); }

/* ===== RESPONSIVE ===== */
@media (max-width: 991.98px) {
    .hero-title { font-size: 2.5rem; }
    .hero-stats { gap: 1.5rem; }
    .admin-sidebar { display: none; }
    .admin-content { margin-left: 0; }
}

@media (max-width: 767.98px) {
    .hero-title { font-size: 2rem; }
    .hero-section { min-height: auto; padding: 5rem 0 3rem; }
    .hero-stats { flex-wrap: wrap; }
    .section-title { font-size: 1.75rem; }
    .auth-card { padding: 1.5rem; margin: 1rem; }
}

/* ===== ANIMATIONS ===== */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s forwards;
}

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

.fade-in:nth-child(1) { animation-delay: 0.1s; }
.fade-in:nth-child(2) { animation-delay: 0.2s; }
.fade-in:nth-child(3) { animation-delay: 0.3s; }
.fade-in:nth-child(4) { animation-delay: 0.4s; }

/* Loading spinner */
.spinner-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
    color: var(--primary);
}

/* Product detail */
.product-detail-img {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.product-detail-img img {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

/* Toast */
.toast.bg-success { background: #10b981 !important; color: white; }
.toast.bg-danger { background: #ef4444 !important; color: white; }
.toast.bg-primary { background: var(--primary) !important; color: white; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state i {
    font-size: 4rem;
    color: var(--gray-light);
    margin-bottom: 1rem;
}

.empty-state h4 {
    color: var(--dark);
    font-weight: 700;
}

.empty-state p {
    color: var(--gray);
}