/* ============================================================
   Krishna Developments - Custom Styles
   Premium dark-mode SaaS design system
   ============================================================ */

/* Base & Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Selection */
::selection {
    background: rgba(139, 92, 246, 0.3);
    color: #fff;
}

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

::-webkit-scrollbar-track {
    background: #0f0a2a;
}

::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.5);
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    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 float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
    }

    50% {
        box-shadow: 0 0 40px rgba(139, 92, 246, 0.4);
    }
}

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

    100% {
        background-position: 200% center;
    }
}

@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes spin-slow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fade-in-down {
    animation: fadeInDown 0.5s ease-out forwards;
}

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

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

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

.animate-pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

.delay-100 {
    animation-delay: 0.1s;
}

.delay-200 {
    animation-delay: 0.2s;
}

.delay-300 {
    animation-delay: 0.3s;
}

.delay-400 {
    animation-delay: 0.4s;
}

.delay-500 {
    animation-delay: 0.5s;
}

/* ============================================================
   Glassmorphism Cards
   ============================================================ */
.glass-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1rem;
    transition: all 0.3s ease;
}

.glass-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(139, 92, 246, 0.2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 40px rgba(139, 92, 246, 0.1);
    transform: translateY(-4px);
}

.glass-card-static {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1rem;
}

/* ============================================================
   Gradient Text
   ============================================================ */
.gradient-text {
    background: linear-gradient(135deg, #8b5cf6, #a855f7, #d946ef);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-text-gold {
    background: linear-gradient(135deg, #f59e0b, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3);
    text-decoration: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #6d28d9, #7c3aed);
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.5);
    transform: translateY(-2px);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-2px);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #dc2626, #ef4444);
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.3);
    text-decoration: none;
}

.btn-danger:hover {
    box-shadow: 0 8px 30px rgba(220, 38, 38, 0.5);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 1rem 2.5rem;
    font-size: 1rem;
}

/* ============================================================
   Form Inputs
   ============================================================ */
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: white;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    outline: none;
    transition: all 0.3s ease;
}

.form-input:focus {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
    background: rgba(255, 255, 255, 0.08);
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
}

.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: white;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem;
    transition: all 0.3s ease;
}

.form-select:focus {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

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

/* ============================================================
   Product Cards
   ============================================================ */
.product-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1rem;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover {
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4), 0 0 40px rgba(139, 92, 246, 0.1);
    transform: translateY(-6px);
}

.product-card .product-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/10;
}

.product-card .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.08);
}

.product-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 9999px;
}

.badge-digital {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-physical {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-redirect {
    background: rgba(249, 115, 22, 0.2);
    color: #fb923c;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

/* ============================================================
   Star Ratings
   ============================================================ */
.stars {
    display: inline-flex;
    gap: 2px;
    color: #fbbf24;
}

.stars .empty {
    color: rgba(255, 255, 255, 0.15);
}

/* ============================================================
   Status Badges
   ============================================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
}

.status-pending {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.status-paid,
.status-completed {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.status-failed,
.status-cancelled {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.status-processing {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.status-shipped {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

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

.data-table thead th {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-align: left;
}

.data-table tbody td {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

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

/* ============================================================
   Hero Section
   ============================================================ */
.hero-gradient {
    background: radial-gradient(ellipse at 50% 0%, rgba(139, 92, 246, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(168, 85, 247, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.08) 0%, transparent 50%);
}

.hero-grid {
    background-image: linear-gradient(rgba(255, 255, 255, .02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .02) 1px, transparent 1px);
    background-size: 60px 60px;
}

/* ============================================================
   Loading States
   ============================================================ */
.skeleton {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 25%, rgba(255, 255, 255, 0.06) 50%, rgba(255, 255, 255, 0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.5rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin-slow 0.8s linear infinite;
}

/* ============================================================
   Responsive Utilities
   ============================================================ */
@media (max-width: 768px) {
    .glass-card:hover {
        transform: none;
    }

    .product-card:hover {
        transform: none;
    }

    .auth-card {
        padding: 1.5rem;
    }

    .data-table {
        font-size: 0.8125rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.625rem 0.5rem;
    }
}

/* ============================================================
   Flash Messages
   ============================================================ */
.flash-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    animation: fadeInDown 0.3s ease;
}

.flash-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.flash-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.flash-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

/* ============================================================
   Auth Forms
   ============================================================ */
.auth-container {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1.5rem;
    padding: 2.5rem;
    backdrop-filter: blur(20px);
}

/* ============================================================
   Divider
   ============================================================ */
.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.75rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border-radius: 0.625rem;
    font-size: 0.875rem;
    transition: all 0.2s;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.5);
}

.pagination a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.pagination .active {
    background: #7c3aed;
    color: white;
    font-weight: 600;
}

/* ============================================================
   Mobile Nav
   ============================================================ */
.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: #0f0f1a;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 60;
    transition: right 0.3s ease;
    overflow-y: auto;
    padding: 2rem 1.5rem;
}

.mobile-nav.open {
    right: 0;
}

.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 55;
}

.mobile-overlay.open {
    display: block;
}

/* ============================================================
   Line Clamp
   ============================================================ */
.line-clamp-1 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
}

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

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

/* ============================================================
   Prose Typography (Blog / Page Content)
   ============================================================ */
.prose h1,
.prose h2,
.prose h3,
.prose h4 {
    color: white;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.prose p {
    margin-bottom: 1em;
}

.prose a {
    color: #818cf8;
    text-decoration: underline;
}

.prose ul,
.prose ol {
    margin-bottom: 1em;
    padding-left: 1.5em;
}

.prose li {
    margin-bottom: 0.25em;
}

.prose code {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.15em 0.4em;
    border-radius: 0.25em;
    font-size: 0.9em;
}

/* ============================================================
   3D Book Animation
   ============================================================ */
.book-scene {
    width: 300px;
    height: 400px;
    perspective: 1500px;
    margin: 0 auto;
}

.book {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateY(-30deg) rotateX(10deg);
    transition: transform 1s ease-in-out;
}

.book:hover, .book.open {
    transform: rotateY(0deg) rotateX(0deg) translateZ(50px);
}

.book-page {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    transform-origin: left center;
    transition: transform 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backface-visibility: hidden; /* Or visible, depending on desired effect */
    border-radius: 4px;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.3);
}

.cover-front {
    z-index: 5;
    background: #1e1b4b; /* Fallback */
    transform-style: preserve-3d;
}

.book:hover .cover-front, .book.open .cover-front {
    transform: rotateY(-180deg);
}

.cover-inside {
    z-index: 4;
    background: #fff;
    transform: rotateY(0deg); 
}
/* When front cover opens (-180), the inside of it (if we had a backface) would show. 
   But here, let's treat cover-inside as the page BEHIND the cover.
*/

.page-right {
    z-index: 3;
    background: #f8fafc;
    transform: rotateY(0deg);
}

.cover-back {
    z-index: 1;
    background: #0f0a2a;
    transform: rotateY(0deg) translateZ(-10px);
}

/* 
   Refined Book Structure for a "Opening" effect 
   Structure:
   .book
     .face-front (Image 1) -> Rotates open
     .face-inside-left (Image 2) -> Attached to back of front face
     .face-inside-right (Image 3) -> The "page" staying flat
     .face-back (Image 4) -> The back cover
*/

.book-3d {
    position: relative;
    width: 260px;
    height: 360px;
    transform-style: preserve-3d;
    transform: rotateY(-25deg);
    transition: transform 1s ease;
}

.book-scene:hover .book-3d, .book-scene.in-view .book-3d {
    transform: rotateY(0deg) translateX(50%); /* Center it when open */
}

/* Front Cover Group */
.book-cover-group {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform-origin: left;
    transition: transform 1s ease;
    z-index: 10;
}

.book-scene:hover .book-cover-group, .book-scene.in-view .book-cover-group {
    transform: rotateY(-180deg);
}

.face-front {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background-size: cover;
    background-position: center;
    border-radius: 4px 12px 12px 4px;
    box-shadow: inset 4px 0 10px rgba(0,0,0,0.1);
}

.face-inside-left {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    transform: rotateY(180deg);
    background-size: cover;
    background-position: center;
    border-radius: 12px 4px 4px 12px;
}

/* Fixed Right Side */
.face-inside-right {
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    border-radius: 4px 12px 12px 4px;
    z-index: 5;
    box-shadow: -5px 0 20px rgba(0,0,0,0.2);
}

.face-back {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: translateZ(-15px);
    background-color: #333;
    border-radius: 4px 12px 12px 4px;
    box-shadow: 10px 10px 30px rgba(0,0,0,0.5);
    background-size: cover;
    background-position: center;
}

/* Spine */
.book-spine {
    position: absolute;
    top: 0;
    left: 0;
    width: 15px;
    height: 100%;
    background: linear-gradient(90deg, #eee, #ccc);
    transform: rotateY(-90deg) translateX(-7.5px);
    transform-origin: center;
}

.prose img {
    border-radius: 0.75rem;
    margin: 1.5em 0;
}

/* ============================================================
   Form Checkbox
   ============================================================ */
.form-checkbox {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: #7c3aed;
}

/* ============================================================
   Print Styles
   ============================================================ */
@media print {

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

    body {
        background: white;
        color: black;
    }

    .glass-card {
        background: white;
        border: 1px solid #ddd;
    }
}