/* ============================
   Nichonauta Store — App CSS
   Dark Space Theme inspired by Nichonauta logo
   ============================ */

/* --- 1. CSS Custom Properties --- */
:root {
    /* Core palette */
    --nicho-space-dark: #0F0E17;
    --nicho-space-medium: #1A1A2E;
    --nicho-purple: #7B2FF7;
    --nicho-purple-dark: #5B1CC4;
    --nicho-purple-light: #A855F7;
    --nicho-gold: #F5A623;
    --nicho-gold-light: #FFC857;
    --nicho-surface: #1E1E32;
    --nicho-surface-light: #2A2A45;
    --nicho-text: #E8E6F0;
    --nicho-text-muted: #9896A8;
    --nicho-success: #10B981;
    --nicho-success-dark: #059669;
    --nicho-danger: #EF4444;
    --nicho-info: #3B82F6;
    --nicho-warning: #F59E0B;

    /* Bootstrap overrides */
    --bs-body-bg: #0F0E17;
    --bs-body-color: #E8E6F0;
    --bs-primary: #7B2FF7;
    --bs-primary-rgb: 123, 47, 247;

    /* Shadows & Effects */
    --nicho-shadow-sm: 0 0.125rem 0.25rem rgba(123, 47, 247, 0.08);
    --nicho-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.4);
    --nicho-shadow-purple: 0 0.5rem 1.5rem rgba(123, 47, 247, 0.25);
    --nicho-shadow-gold: 0 0.5rem 1rem rgba(245, 166, 35, 0.2);
    --nicho-radius: 0.75rem;
    --nicho-radius-lg: 1rem;
    --nicho-transition: all 0.25s ease;
    --nicho-transition-slow: all 0.4s ease;
}

/* --- 2. Global Resets & Base --- */
::selection {
    background: var(--nicho-purple);
    color: #fff;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--nicho-purple-dark) var(--nicho-space-dark);
}

*::-webkit-scrollbar {
    width: 8px;
}
*::-webkit-scrollbar-track {
    background: var(--nicho-space-dark);
}
*::-webkit-scrollbar-thumb {
    background: var(--nicho-purple-dark);
    border-radius: 4px;
}
*::-webkit-scrollbar-thumb:hover {
    background: var(--nicho-purple);
}

html {
    scroll-behavior: smooth;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--nicho-space-dark);
    color: var(--nicho-text);
}

.container {
    flex: 1;
}

/* --- 3. Skip Link (Accessibility) --- */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--nicho-purple);
    color: #fff;
    padding: 0.5rem 1rem;
    z-index: 9999;
    text-decoration: none;
    font-weight: bold;
    border-radius: 0 0 var(--nicho-radius) 0;
}
.skip-link:focus {
    top: 0;
}

/* --- 4. Navbar --- */
.navbar {
    background: linear-gradient(135deg, var(--nicho-space-dark) 0%, var(--nicho-space-medium) 100%) !important;
    border-bottom: 1px solid rgba(123, 47, 247, 0.2);
    backdrop-filter: blur(10px);
    padding: 0.6rem 0;
}

.navbar-brand img {
    max-width: 100%;
    max-height: 36px;
    margin-right: 8px;
    filter: drop-shadow(0 0 8px rgba(123, 47, 247, 0.3));
    transition: var(--nicho-transition);
}
.navbar-brand:hover img {
    filter: drop-shadow(0 0 12px rgba(123, 47, 247, 0.5));
}

.navbar .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: var(--nicho-transition);
    color: rgba(232, 230, 240, 0.8) !important;
    font-weight: 500;
    border-radius: var(--nicho-radius);
    padding: 0.4rem 0.75rem !important;
}

.navbar .nav-link:hover {
    color: #fff !important;
    background: rgba(123, 47, 247, 0.15);
}

.navbar-toggler {
    border-color: rgba(123, 47, 247, 0.3) !important;
}
.navbar-toggler-icon {
    filter: brightness(1.5);
}

/* Dropdown menu in navbar */
.dropdown-menu {
    background: var(--nicho-surface);
    border: 1px solid rgba(123, 47, 247, 0.2);
    border-radius: var(--nicho-radius);
    box-shadow: var(--nicho-shadow);
}
.dropdown-item {
    color: var(--nicho-text);
    transition: var(--nicho-transition);
}
.dropdown-item:hover {
    background: rgba(123, 47, 247, 0.15);
    color: #fff;
}
.dropdown-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.15);
}
.dropdown-divider {
    border-color: rgba(123, 47, 247, 0.15);
}

/* --- 5. Breadcrumbs --- */
.breadcrumb {
    background-color: var(--nicho-surface);
    padding: 0.5rem 1rem;
    border-radius: var(--nicho-radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    border: 1px solid rgba(123, 47, 247, 0.1);
}
.breadcrumb-item a {
    color: var(--nicho-purple-light);
}
.breadcrumb-item.active {
    color: var(--nicho-text-muted);
}
.breadcrumb-item + .breadcrumb-item::before {
    color: var(--nicho-text-muted);
}

/* --- 6. Product Cards (Home) --- */
.product-card {
    transition: var(--nicho-transition-slow);
    border: 1px solid rgba(123, 47, 247, 0.12);
    background: var(--nicho-surface);
    color: var(--nicho-text);
    border-radius: var(--nicho-radius-lg);
    overflow: hidden;
    position: relative;
    cursor: pointer;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--nicho-shadow-purple);
    border-color: rgba(123, 47, 247, 0.3);
}

/* Clickable card wrapper */
.col a:hover .product-card,
.col a:focus .product-card {
    transform: translateY(-4px);
    box-shadow: var(--nicho-shadow-purple);
    border-color: rgba(123, 47, 247, 0.3);
}

.card-img-top {
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.product-card .card-body {
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
}

.product-card .card-title {
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.25rem;
}

.product-card .card-text {
    color: var(--nicho-text-muted);
}

/* --- 7. Product Page --- */
.product-image-wrapper {
    background: var(--nicho-surface);
    border-radius: var(--nicho-radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(123, 47, 247, 0.1);
}

.product-page .product-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--nicho-radius);
}

.product-price-tag {
    color: var(--nicho-gold);
}

.product-price-box {
    background: linear-gradient(135deg, var(--nicho-surface) 0%, var(--nicho-surface-light) 100%);
    border-radius: var(--nicho-radius);
    padding: 1.25rem;
    text-align: center;
    border: 1px solid rgba(245, 166, 35, 0.15);
}

/* --- 8. Auth Pages (Login / Signup) --- */
.auth-container {
    padding-top: 5vh;
}

.auth-card {
    border: 1px solid rgba(123, 47, 247, 0.2);
    border-radius: var(--nicho-radius-lg);
    overflow: hidden;
    background: var(--nicho-surface);
    color: var(--nicho-text);
}

.auth-card .card-body {
    padding: 2rem;
}

.auth-icon {
    font-size: 3rem;
    color: var(--nicho-purple);
    filter: drop-shadow(0 0 10px rgba(123, 47, 247, 0.3));
}

/* --- 9. Profile Page --- */
.profile-avatar {
    font-size: 4rem;
    color: var(--nicho-purple);
    filter: drop-shadow(0 0 12px rgba(123, 47, 247, 0.3));
}

.section-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
}
.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(123, 47, 247, 0.2);
}
.section-divider span {
    padding: 0 0.75rem;
    color: var(--nicho-purple-light);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- 10. Empty States --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--nicho-text-muted);
}
.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
    color: var(--nicho-purple);
}

/* --- 12. Error Page --- */
.error-icon {
    font-size: 5rem;
    color: var(--nicho-danger);
    filter: drop-shadow(0 0 15px rgba(239, 68, 68, 0.3));
}

/* --- 13. Tables --- */
.table {
    color: var(--nicho-text);
    --bs-table-bg: var(--nicho-surface);
    --bs-table-hover-bg: var(--nicho-surface-light);
    --bs-table-striped-bg: var(--nicho-surface-light);
    --bs-table-border-color: rgba(123, 47, 247, 0.1);
}

.table th {
    white-space: nowrap;
}

.table-dark {
    --bs-table-bg: var(--nicho-space-medium);
    --bs-table-border-color: rgba(123, 47, 247, 0.15);
}

.table-hover > tbody > tr:hover > * {
    --bs-table-hover-bg: var(--nicho-surface-light);
    --bs-table-hover-color: #fff;
}

/* --- 14. Utility Classes --- */
.text-xs {
    font-size: 0.7rem;
}

.img-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--nicho-radius);
    border: 1px solid rgba(123, 47, 247, 0.15);
}

.bg-footer {
    background: linear-gradient(180deg, var(--nicho-space-medium) 0%, var(--nicho-space-dark) 100%);
}
.bg-footer .social-link {
    transition: color 0.25s ease, transform 0.25s ease;
}
.bg-footer .social-link:hover {
    color: #fff !important;
    transform: scale(1.15);
}

/* --- 15. Admin Layout --- */
.admin-sidebar {
    min-height: calc(100vh - 56px);
    background-color: var(--nicho-space-medium);
    border-right: 1px solid rgba(123, 47, 247, 0.15);
}
.admin-sidebar .nav-link {
    color: var(--nicho-text-muted);
    padding: 0.65rem 1rem;
    border-radius: var(--nicho-radius);
    margin-bottom: 2px;
    transition: var(--nicho-transition);
}
.admin-sidebar .nav-link:hover {
    background-color: rgba(123, 47, 247, 0.1);
    color: var(--nicho-text);
}
.admin-sidebar .nav-link.active {
    font-weight: bold;
    color: var(--nicho-purple-light);
    background-color: rgba(123, 47, 247, 0.15);
}

@media (max-width: 991.98px) {
    .admin-sidebar {
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid rgba(123, 47, 247, 0.15);
        margin-bottom: 1rem;
    }
}

/* --- 16. Filter Bar (Category & Price pills) --- */
.filter-bar .btn {
    transition: var(--nicho-transition);
    border-radius: 50rem;
}
.filter-bar .btn:hover {
    transform: scale(1.03);
}
.filter-bar .filter-divider {
    width: 1px;
    height: 1.5rem;
    background: rgba(123, 47, 247, 0.25);
    margin: 0 0.25rem;
}

/* --- 17. Hero Section --- */
.hero-section {
    background: linear-gradient(135deg, var(--nicho-purple-dark) 0%, var(--nicho-space-dark) 50%, var(--nicho-space-medium) 100%);
    color: #fff;
    border-radius: var(--nicho-radius-lg);
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(123, 47, 247, 0.2);
}
.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(123, 47, 247, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(245, 166, 35, 0.08) 0%, transparent 40%);
    pointer-events: none;
}
.hero-section h1 {
    font-weight: 700;
    position: relative;
    z-index: 1;
}
.hero-section .lead {
    position: relative;
    z-index: 1;
}
.hero-section .btn-light {
    font-weight: 600;
    background: var(--nicho-gold);
    border-color: var(--nicho-gold);
    color: var(--nicho-space-dark);
    position: relative;
    z-index: 1;
    transition: var(--nicho-transition);
}
.hero-section .btn-light:hover {
    background: var(--nicho-gold-light);
    border-color: var(--nicho-gold-light);
    transform: translateY(-2px);
    box-shadow: var(--nicho-shadow-gold);
}

/* --- 18. Premium Badge --- */
.premium-badge {
    background: linear-gradient(135deg, var(--nicho-gold) 0%, #FF9800 100%);
    color: var(--nicho-space-dark);
    font-weight: 700;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 50rem;
    box-shadow: 0 0 10px rgba(245, 166, 35, 0.3);
}

/* --- 19. Free Badge --- */
.free-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
}
.free-badge .badge {
    font-size: 0.65rem;
    padding: 0.25em 0.5em;
}

/* --- 20. Card Overrides --- */
.card {
    background: var(--nicho-surface);
    border: 1px solid rgba(123, 47, 247, 0.1);
    color: var(--nicho-text);
}
.card-header {
    background: var(--nicho-surface-light);
    border-bottom: 1px solid rgba(123, 47, 247, 0.15);
    color: var(--nicho-text);
}
.card-footer {
    background: var(--nicho-surface-light);
    border-top: 1px solid rgba(123, 47, 247, 0.15);
}

/* --- 21. Form Controls --- */
.form-control,
.form-select {
    background-color: var(--nicho-space-dark);
    border-color: rgba(123, 47, 247, 0.2);
    color: var(--nicho-text);
    transition: var(--nicho-transition);
}
.form-control:focus,
.form-select:focus {
    background-color: var(--nicho-space-dark);
    border-color: var(--nicho-purple);
    color: var(--nicho-text);
    box-shadow: 0 0 0 0.2rem rgba(123, 47, 247, 0.25);
}
.form-control::placeholder {
    color: var(--nicho-text-muted);
}
.form-control[readonly] {
    background-color: var(--nicho-surface-light);
    color: var(--nicho-text-muted);
}
.form-label {
    color: var(--nicho-text);
    font-weight: 500;
}
.form-text {
    color: var(--nicho-text-muted);
}
.input-group-text {
    background-color: var(--nicho-surface-light);
    border-color: rgba(123, 47, 247, 0.2);
    color: var(--nicho-purple-light);
}

/* --- 22. Button Overrides --- */
.btn-primary {
    background: linear-gradient(135deg, var(--nicho-purple) 0%, var(--nicho-purple-dark) 100%);
    border-color: var(--nicho-purple);
    color: #fff;
    transition: var(--nicho-transition);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--nicho-purple-light) 0%, var(--nicho-purple) 100%);
    border-color: var(--nicho-purple-light);
    transform: translateY(-1px);
    box-shadow: var(--nicho-shadow-purple);
}

.btn-outline-primary {
    color: var(--nicho-purple-light);
    border-color: var(--nicho-purple);
    transition: var(--nicho-transition);
}
.btn-outline-primary:hover {
    background: linear-gradient(135deg, var(--nicho-purple) 0%, var(--nicho-purple-dark) 100%);
    border-color: var(--nicho-purple);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--nicho-shadow-purple);
}

.btn-success {
    background: linear-gradient(135deg, var(--nicho-success) 0%, var(--nicho-success-dark) 100%);
    border-color: var(--nicho-success);
    transition: var(--nicho-transition);
}
.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.5rem 1rem rgba(16, 185, 129, 0.25);
}

.btn-warning {
    background: linear-gradient(135deg, var(--nicho-gold) 0%, var(--nicho-gold-light) 100%);
    border-color: var(--nicho-gold);
    color: var(--nicho-space-dark);
    transition: var(--nicho-transition);
}
.btn-warning:hover {
    transform: translateY(-1px);
    box-shadow: var(--nicho-shadow-gold);
}

.btn-outline-warning {
    color: var(--nicho-gold);
    border-color: var(--nicho-gold);
    transition: var(--nicho-transition);
}
.btn-outline-warning:hover {
    background: var(--nicho-gold);
    color: var(--nicho-space-dark);
}

.btn-outline-success {
    color: var(--nicho-success);
    border-color: var(--nicho-success);
    transition: var(--nicho-transition);
}
.btn-outline-success:hover {
    background: var(--nicho-success);
    color: #fff;
}

.btn-info {
    background: linear-gradient(135deg, var(--nicho-info) 0%, #2563EB 100%);
    border-color: var(--nicho-info);
    color: #fff;
    transition: var(--nicho-transition);
}
.btn-info:hover {
    transform: translateY(-1px);
}

.btn-outline-info {
    color: var(--nicho-info);
    border-color: var(--nicho-info);
    transition: var(--nicho-transition);
}
.btn-outline-info:hover {
    background: var(--nicho-info);
    color: #fff;
}

.btn-outline-danger {
    color: var(--nicho-danger);
    border-color: var(--nicho-danger);
    transition: var(--nicho-transition);
}
.btn-outline-danger:hover {
    background: var(--nicho-danger);
    color: #fff;
}

.btn-secondary {
    background: var(--nicho-surface-light);
    border-color: var(--nicho-surface-light);
    color: var(--nicho-text);
    transition: var(--nicho-transition);
}
.btn-secondary:hover {
    background: rgba(123, 47, 247, 0.15);
    border-color: rgba(123, 47, 247, 0.3);
    color: #fff;
}

.btn-outline-secondary {
    color: var(--nicho-text-muted);
    border-color: rgba(123, 47, 247, 0.2);
    transition: var(--nicho-transition);
}
.btn-outline-secondary:hover {
    background: rgba(123, 47, 247, 0.1);
    border-color: rgba(123, 47, 247, 0.3);
    color: var(--nicho-text);
}

/* --- 23. Alerts --- */
.alert {
    border-radius: var(--nicho-radius);
}
.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--nicho-gold-light);
}
.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--nicho-success);
}
.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--nicho-info);
}
.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--nicho-danger);
}
.alert-link {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

/* --- 24. Badges --- */
.badge.bg-primary {
    background: var(--nicho-purple) !important;
}
.badge.bg-success {
    background: var(--nicho-success) !important;
}
.badge.bg-warning {
    background: var(--nicho-gold) !important;
}
.badge.bg-info {
    background: var(--nicho-info) !important;
}
.badge.bg-danger {
    background: var(--nicho-danger) !important;
}
.badge.bg-secondary {
    background: var(--nicho-surface-light) !important;
    color: var(--nicho-text-muted);
}

/* --- 25. Accordion --- */
.accordion-item {
    background: var(--nicho-surface);
    border-color: rgba(123, 47, 247, 0.15);
}
.accordion-button {
    background: var(--nicho-surface);
    color: var(--nicho-text);
    font-weight: 500;
}
.accordion-button:not(.collapsed) {
    background: rgba(123, 47, 247, 0.1);
    color: var(--nicho-purple-light);
    box-shadow: inset 0 calc(-1 * 0) 0 rgba(123, 47, 247, 0.15);
}
.accordion-button::after {
    filter: brightness(0) invert(0.7);
}
.accordion-button:not(.collapsed)::after {
    filter: brightness(0) invert(0.7) sepia(1) saturate(5) hue-rotate(220deg);
}
.accordion-body {
    background: var(--nicho-surface);
    color: var(--nicho-text-muted);
}

/* --- 26. Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(245, 166, 35, 0.3);
    }
    50% {
        box-shadow: 0 0 15px rgba(245, 166, 35, 0.5);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.premium-badge {
    animation: glowPulse 2s ease-in-out infinite;
}

/* Staggered card animations */
.product-card {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}
.product-card:nth-child(1) { animation-delay: 0.05s; }

/* --- 27. Text Overrides --- */
.text-primary {
    color: var(--nicho-purple-light) !important;
}
.text-success {
    color: var(--nicho-success) !important;
}
.text-danger {
    color: var(--nicho-danger) !important;
}
.text-warning {
    color: var(--nicho-gold) !important;
}
.text-info {
    color: var(--nicho-info) !important;
}
.text-muted {
    color: var(--nicho-text-muted) !important;
}

/* --- 28. Link Overrides --- */
a {
    color: var(--nicho-purple-light);
    transition: var(--nicho-transition);
}
a:hover {
    color: var(--nicho-purple);
}

/* --- 29. Shadow Override --- */
.shadow {
    box-shadow: var(--nicho-shadow) !important;
}
.shadow-sm {
    box-shadow: var(--nicho-shadow-sm) !important;
}

/* --- 30. Code Tag --- */
code {
    color: var(--nicho-purple-light);
    background: rgba(123, 47, 247, 0.1);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

/* --- 31. Form Switch --- */
.form-check-input {
    background-color: var(--nicho-space-dark);
    border-color: rgba(123, 47, 247, 0.3);
}
.form-check-input:checked {
    background-color: var(--nicho-purple);
    border-color: var(--nicho-purple);
}
.form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(123, 47, 247, 0.25);
    border-color: var(--nicho-purple);
}

/* --- 36. Tooltip --- */
.tooltip-inner {
    background: var(--nicho-surface-light);
    color: var(--nicho-text);
}
.tooltip .tooltip-arrow::before {
    border-top-color: var(--nicho-surface-light);
}

/* --- 37. Invalid Feedback --- */
.invalid-feedback {
    color: var(--nicho-danger);
}
.is-invalid {
    border-color: var(--nicho-danger) !important;
}

/* --- 38. Horizontal Rule --- */
hr {
    border-color: rgba(123, 47, 247, 0.15);
}

/* --- 39. Small Text --- */
small, .small {
    color: var(--nicho-text-muted);
}

/* --- 40. Font Monospace --- */
.font-monospace {
    color: var(--nicho-purple-light);
}

/* --- 41. Hero Stars Effect --- */
.hero-stars {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    pointer-events: none;
}
.hero-stars span {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: float 4s ease-in-out infinite;
}
