/**
 * Blueprint Commerce - Public App Styles
 * Luxury Dark E-Commerce Theme
 */

/* Import Design System */
@import url('./design-system.css');

/* ========================================
   GLOBAL STYLES
   ======================================== */

html, body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: var(--leading-relaxed);
    background: var(--color-primary-700);
    color: var(--color-neutral-100);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-primary-800);
}

::-webkit-scrollbar-thumb {
    background: var(--color-neutral-700);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-accent-500);
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

h1, h2, h3, h4, h5, h6,
.rz-text-h1, .rz-text-h2, .rz-text-h3,
.rz-text-h4, .rz-text-h5, .rz-text-h6 {
    font-family: var(--font-display);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    letter-spacing: -0.02em;
    color: white;
    margin-top: 0;
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
    margin-top: 0;
    margin-bottom: var(--space-4);
}

a {
    color: var(--color-accent-500);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-in-out);
}

a:hover {
    color: var(--color-accent-300);
}

strong, b {
    font-weight: var(--font-bold);
}

code, pre {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

code {
    background: var(--color-neutral-800);
    padding: 0.2em 0.4em;
    border-radius: var(--radius-sm);
    color: var(--color-accent-300);
}

/* ========================================
   DNA HELIX ANIMATED BACKGROUND
   ======================================== */

/* Base gradient background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, var(--color-primary-700) 0%, var(--color-primary-800) 50%, var(--color-primary-900) 100%);
    z-index: -2;
    pointer-events: none;
}

/* DNA Helix Pattern Layer */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        /* DNA helix strands - diagonal repeating pattern */
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 100px,
            rgba(0, 187, 255, 0.03) 100px,
            rgba(0, 187, 255, 0.03) 102px,
            transparent 102px,
            transparent 150px,
            rgba(92, 228, 255, 0.02) 150px,
            rgba(92, 228, 255, 0.02) 152px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 100px,
            rgba(0, 187, 255, 0.03) 100px,
            rgba(0, 187, 255, 0.03) 102px,
            transparent 102px,
            transparent 150px,
            rgba(92, 228, 255, 0.02) 150px,
            rgba(92, 228, 255, 0.02) 152px
        ),
        /* Connection points (base pairs) */
        radial-gradient(circle at 25% 25%, rgba(0, 187, 255, 0.08) 0%, transparent 2%),
        radial-gradient(circle at 75% 25%, rgba(92, 228, 255, 0.06) 0%, transparent 2%),
        radial-gradient(circle at 50% 50%, rgba(0, 187, 255, 0.08) 0%, transparent 2%),
        radial-gradient(circle at 25% 75%, rgba(92, 228, 255, 0.06) 0%, transparent 2%),
        radial-gradient(circle at 75% 75%, rgba(0, 187, 255, 0.08) 0%, transparent 2%),
        /* Ambient glow layers */
        radial-gradient(ellipse at 20% 30%, rgba(0, 187, 255, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(92, 228, 255, 0.06) 0%, transparent 50%);
    background-size:
        300px 300px,
        300px 300px,
        800px 800px,
        800px 800px,
        800px 800px,
        800px 800px,
        800px 800px,
        100% 100%,
        100% 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 1;
    animation: dnaHelixShift 60s linear infinite, atmospherePulse 20s ease-in-out infinite alternate;
}

@keyframes dnaHelixShift {
    0% {
        background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 20% 30%, 80% 70%;
    }
    100% {
        background-position: 300px 300px, -300px -300px, 100px 100px, 200px 200px, 150px 150px, 250px 250px, 175px 175px, 25% 35%, 75% 65%;
    }
}

@keyframes atmospherePulse {
    0% { opacity: 0.9; }
    50% { opacity: 1; }
    100% { opacity: 0.9; }
}

/* ========================================
   LAYOUT
   ======================================== */

.page-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
    padding-top: var(--space-6);
    padding-bottom: var(--space-12);
    animation: fadeInContent 0.5s ease-out;
}

@keyframes fadeInContent {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   BUTTONS - PREMIUM STYLING
   ======================================== */

.btn, .rz-button {
    font-family: var(--font-display);
    font-weight: var(--font-bold);
    font-size: var(--text-base);
    padding: var(--space-4) var(--space-8);
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-in-out);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn:focus, .rz-button:focus {
    outline: 2px solid var(--color-accent-500);
    outline-offset: 3px;
}

/* Primary Button - Cyan Accent */
.btn-primary, .rz-button.rz-button-primary {
    background: var(--color-accent-500);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover, .rz-button.rz-button-primary:hover {
    background: var(--color-accent-400);
    box-shadow: var(--shadow-lg), var(--glow-cyan);
    transform: translateY(-2px);
}

.btn-primary:active, .rz-button.rz-button-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Secondary Button - Outlined */
.btn-secondary, .rz-button.rz-button-secondary {
    background: transparent;
    color: var(--color-accent-500);
    border: 2px solid var(--color-accent-500);
}

.btn-secondary:hover, .rz-button.rz-button-secondary:hover {
    background: rgba(0, 187, 255, 0.1);
    border-color: var(--color-accent-300);
    color: var(--color-accent-300);
}

/* Light Button - For dark backgrounds */
.btn-light, .rz-button.rz-button-light {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-light:hover, .rz-button.rz-button-light:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Success/Danger Buttons */
.btn-success { background: var(--color-success); color: white; }
.btn-success:hover { background: var(--color-success-dark); box-shadow: var(--shadow-md); }

.btn-danger { background: var(--color-error); color: white; }
.btn-danger:hover { background: var(--color-error-dark); box-shadow: var(--shadow-md); }

/* ========================================
   CARDS - LUXURY ELEVATION
   ======================================== */

.card, .rz-card {
    background: var(--color-neutral-800) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: var(--radius-xl) !important;
    padding: var(--space-8);
    box-shadow: var(--shadow-lg) !important;
    transition: all var(--duration-base) var(--ease-in-out);
}

.card:hover, .rz-card:hover {
    border-color: rgba(0, 187, 255, 0.15) !important;
    box-shadow: var(--shadow-xl), var(--glow-cyan) !important;
    transform: translateY(-3px);
}

.card-header, .rz-card-header {
    font-family: var(--font-display);
    font-weight: var(--font-bold);
    font-size: var(--text-xl);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: var(--space-4);
    margin-bottom: var(--space-6);
}

/* ========================================
   FORMS - PREMIUM INPUTS
   ======================================== */

.form-control, .rz-textbox, .rz-dropdown, .rz-datepicker,
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], textarea, select {
    font-family: var(--font-body);
    font-size: var(--text-base);
    padding: var(--space-4);
    background: var(--color-neutral-800);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    color: black;
    transition: all var(--duration-fast) var(--ease-in-out);
}

.form-control:focus, .rz-textbox:focus, .rz-dropdown:focus,
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-accent-500);
    box-shadow: 0 0 0 3px rgba(0, 187, 255, 0.1);
    background: var(--color-neutral-700);
}

.form-control::placeholder, input::placeholder, textarea::placeholder {
    color: var(--color-neutral-400);
    opacity: 0.7;
}

/* Radzen-specific placeholder fix for light backgrounds */
.rz-textbox::placeholder,
.rz-textbox input::placeholder,
.rz-password-input::placeholder {
    color: rgba(0, 0, 0, 0.5) !important;
    opacity: 1 !important;
}

/* Form Validation */
.valid.modified:not([type=checkbox]) {
    border-color: var(--color-success);
}

.invalid {
    border-color: var(--color-error);
}

.validation-message {
    color: var(--color-error);
    font-size: var(--text-sm);
    margin-top: var(--space-2);
    display: block;
}

/* ========================================
   STAGGERED ANIMATIONS
   ======================================== */

.product-card, .rz-datalist-item, .fade-in-item {
    animation: fadeInUp 0.6s ease-out backwards;
}

.product-card:nth-child(1), .rz-datalist-item:nth-child(1) { animation-delay: 0s; }
.product-card:nth-child(2), .rz-datalist-item:nth-child(2) { animation-delay: 0.1s; }
.product-card:nth-child(3), .rz-datalist-item:nth-child(3) { animation-delay: 0.15s; }
.product-card:nth-child(4), .rz-datalist-item:nth-child(4) { animation-delay: 0.2s; }
.product-card:nth-child(5), .rz-datalist-item:nth-child(5) { animation-delay: 0.25s; }
.product-card:nth-child(6), .rz-datalist-item:nth-child(6) { animation-delay: 0.3s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   RADZEN COMPONENT OVERRIDES
   ======================================== */

/* Radzen DataGrid */
.rz-datatable {
    background: var(--color-neutral-800);
    border-radius: var(--radius-xl);
}

.rz-datatable-header {
    background: var(--color-neutral-900);
    color: var(--color-accent-500);
    font-family: var(--font-display);
    font-weight: var(--font-semibold);
}

.rz-datatable-data {
    color: var(--color-neutral-100);
}

/* Radzen Notification */
.rz-notification {
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-xl) !important;
}

.rz-notification-success {
    background: var(--color-success) !important;
}

.rz-notification-success,
.rz-notification-success .rz-notification-content,
.rz-notification-success .rz-notification-message,
.rz-notification-success .rz-notification-summary,
.rz-notification-success .rz-notification-detail,
.rz-notification-success * {
    color: white !important;
}

.rz-notification-error {
    background: var(--color-error) !important;
}

.rz-notification-error,
.rz-notification-error .rz-notification-content,
.rz-notification-error .rz-notification-message,
.rz-notification-error .rz-notification-summary,
.rz-notification-error .rz-notification-detail,
.rz-notification-error * {
    color: white !important;
}

.rz-notification-info {
    background: var(--color-accent-500) !important;
}

.rz-notification-info,
.rz-notification-info .rz-notification-content,
.rz-notification-info .rz-notification-message,
.rz-notification-info .rz-notification-summary,
.rz-notification-info .rz-notification-detail,
.rz-notification-info * {
    color: white !important;
}

.rz-notification-warning {
    background: #F59E0B !important;
}

.rz-notification-warning,
.rz-notification-warning .rz-notification-content,
.rz-notification-warning .rz-notification-message,
.rz-notification-warning .rz-notification-summary,
.rz-notification-warning .rz-notification-detail,
.rz-notification-warning * {
    color: #1a1a1a !important;
}

/* ========================================
   LOADING & ERROR STATES
   ======================================== */

#blazor-error-ui {
    background: var(--color-error);
    color: white;
    bottom: 0;
    box-shadow: var(--shadow-2xl);
    display: none;
    left: 0;
    padding: var(--space-4) var(--space-6);
    position: fixed;
    width: 100%;
    z-index: var(--z-modal);
    font-family: var(--font-body);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: var(--space-6);
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--text-2xl);
}

.blazor-error-boundary {
    background: var(--color-error-dark);
    padding: var(--space-6);
    color: white;
    border-radius: var(--radius-lg);
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
    font-family: var(--font-display);
    font-weight: var(--font-bold);
}

/* Loading Spinner */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: var(--color-neutral-700);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--color-accent-500);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.1s ease-in-out;
    filter: drop-shadow(var(--glow-cyan));
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-family: var(--font-display);
    font-weight: var(--font-bold);
    font-size: var(--text-lg);
    color: var(--color-accent-500);
    inset: calc(20vh + 3.5rem) 0 auto;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-muted { color: var(--color-neutral-400); }
.text-accent { color: var(--color-accent-500); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }

.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.my-4 { margin-top: var(--space-4); margin-bottom: var(--space-4); }
.my-8 { margin-top: var(--space-8); margin-bottom: var(--space-8); }

/* ========================================
   RESPONSIVE UTILITIES
   ======================================== */

/* Mobile - 320px to 599px */
@media (max-width: 599px) {
    h1 { font-size: var(--text-4xl); }
    h2 { font-size: var(--text-3xl); }
    h3 { font-size: var(--text-2xl); }

    .content {
        padding-top: var(--space-4);
        padding-bottom: var(--space-8);
    }

    .card, .rz-card {
        padding: var(--space-6);
    }
}
