/* ===========================
   M.S.WebFusion — Design System 2026
   =========================== */

:root {
    /* Base */
    --msw-bg-primary: #0a0e27;
    --msw-bg-secondary: #0f1438;
    --msw-bg-tertiary: #141a45;
    --msw-bg-surface: #1a2150;

    /* Accent */
    --msw-cyan: #00d4ff;
    --msw-cyan-light: #5ce1ff;
    --msw-cyan-dark: #0098b8;
    --msw-cyan-glow: rgba(0, 212, 255, 0.15);
    --msw-cyan-muted: rgba(0, 212, 255, 0.08);

    /* Text */
    --msw-text-primary: #f0f4ff;
    --msw-text-secondary: #8892b0;
    --msw-text-muted: #5a6380;

    /* Secondary accents */
    --msw-gold: #f0b429;
    --msw-coral: #ff6b6b;

    /* Gradients */
    --msw-gradient-hero: linear-gradient(135deg, #0a0e27 0%, #0f1438 40%, #141a45 100%);
    --msw-gradient-accent: linear-gradient(135deg, #00d4ff 0%, #0098b8 100%);
    --msw-gradient-gold: linear-gradient(135deg, #f0b429 0%, #e08a1e 100%);
    --msw-gradient-glow: radial-gradient(ellipse at center, rgba(0, 212, 255, 0.12) 0%, transparent 70%);
    --msw-gradient-card: linear-gradient(135deg, rgba(0, 212, 255, 0.06) 0%, rgba(0, 212, 255, 0.02) 100%);

    /* Glass */
    --msw-glass-bg: rgba(15, 20, 56, 0.6);
    --msw-glass-border: rgba(0, 212, 255, 0.1);
    --msw-glass-blur: blur(20px);

    /* Shadows */
    --msw-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --msw-shadow-md: 0 4px 24px rgba(0, 0, 0, 0.4);
    --msw-shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.5);
    --msw-shadow-glow: 0 0 30px rgba(0, 212, 255, 0.15);

    /* Spacing */
    --msw-section-padding: clamp(4rem, 8vw, 8rem);
    --msw-container-max: 1280px;
    --msw-container-wide: 1440px;

    /* Transitions */
    --msw-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --msw-transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --msw-transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Radius */
    --msw-radius-sm: 8px;
    --msw-radius-md: 12px;
    --msw-radius-lg: 20px;
    --msw-radius-xl: 32px;

    /* Fonts */
    --msw-font-display: 'Space Grotesk', system-ui, sans-serif;
    --msw-font-body: 'Inter', system-ui, sans-serif;
    --msw-font-mono: 'JetBrains Mono', monospace;
}

/* Light mode */
[data-theme="light"] {
    --msw-bg-primary: #f8fafc;
    --msw-bg-secondary: #f1f5f9;
    --msw-bg-tertiary: #e2e8f0;
    --msw-bg-surface: #ffffff;
    --msw-cyan: #0088aa;
    --msw-cyan-light: #00a8d4;
    --msw-cyan-dark: #006080;
    --msw-cyan-glow: rgba(0, 136, 170, 0.1);
    --msw-cyan-muted: rgba(0, 136, 170, 0.05);
    --msw-text-primary: #1a202c;
    --msw-text-secondary: #4a5568;
    --msw-text-muted: #a0aec0;
    --msw-gradient-hero: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 40%, #e2e8f0 100%);
    --msw-gradient-card: linear-gradient(135deg, rgba(0, 136, 170, 0.04) 0%, rgba(0, 136, 170, 0.01) 100%);
    --msw-glass-bg: rgba(255, 255, 255, 0.7);
    --msw-glass-border: rgba(0, 136, 170, 0.15);
    --msw-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --msw-shadow-md: 0 4px 24px rgba(0, 0, 0, 0.08);
    --msw-shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.12);
    --msw-shadow-glow: 0 0 30px rgba(0, 136, 170, 0.1);
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--msw-font-body);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--msw-text-primary);
    background: var(--msw-bg-primary);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--msw-font-display);
    line-height: 1.2;
    color: var(--msw-text-primary);
}

h1 { font-size: clamp(2.5rem, 5vw, 4.5rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(2rem, 4vw, 3.5rem); font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 600; }
h4 { font-size: clamp(1.125rem, 2vw, 1.5rem); font-weight: 500; }

a {
    color: var(--msw-cyan);
    text-decoration: none;
    transition: color var(--msw-transition-fast);
}

a:hover {
    color: var(--msw-cyan-light);
}

::selection {
    background: var(--msw-cyan);
    color: var(--msw-bg-primary);
}

::-moz-selection {
    background: var(--msw-cyan);
    color: var(--msw-bg-primary);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    list-style: none;
}

/* Utility classes */
.msw-container {
    max-width: var(--msw-container-max);
    margin: 0 auto;
    padding: 0 2rem;
}

.msw-section {
    padding: var(--msw-section-padding) 0;
    position: relative;
}

.msw-section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.msw-section-header h2 {
    margin-bottom: 1rem;
}

.msw-section-header p {
    color: var(--msw-text-secondary);
    font-size: 1.125rem;
    max-width: 640px;
    margin: 0 auto;
}

.msw-label {
    display: inline-block;
    font-family: var(--msw-font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--msw-cyan);
    margin-bottom: 0.75rem;
}

.msw-gradient-text {
    background: linear-gradient(135deg, var(--msw-cyan), var(--msw-cyan-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Buttons */
.msw-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    font-family: var(--msw-font-body);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: var(--msw-radius-sm);
    cursor: pointer;
    transition: all var(--msw-transition-base);
    text-decoration: none;
    white-space: nowrap;
}

.msw-btn-primary {
    background: var(--msw-gradient-accent);
    color: white;
}

.msw-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
    color: white;
}

.msw-btn-outline {
    background: transparent;
    color: var(--msw-cyan);
    border: 1px solid var(--msw-cyan);
}

.msw-btn-outline:hover {
    background: var(--msw-cyan-muted);
    transform: translateY(-2px);
}

.msw-btn-ghost {
    background: transparent;
    color: var(--msw-cyan);
    padding: 0.5rem 0;
}

.msw-btn-ghost:hover {
    color: var(--msw-cyan-light);
}

.msw-btn-ghost::after {
    content: ' \2192';
    transition: transform var(--msw-transition-fast);
}

.msw-btn-ghost:hover::after {
    transform: translateX(4px);
}

/* Cards */
.msw-card {
    background: var(--msw-gradient-card);
    border: 1px solid var(--msw-glass-border);
    border-radius: var(--msw-radius-lg);
    padding: 2rem;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
                border-color 0.3s ease,
                box-shadow 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.msw-card:hover {
    transform: translateY(-6px);
    border-color: rgba(0, 212, 255, 0.25);
    box-shadow: var(--msw-shadow-md), var(--msw-shadow-glow), inset 0 1px 0 rgba(0, 212, 255, 0.08);
}

/* Glass card */
.msw-glass {
    background: var(--msw-glass-bg);
    backdrop-filter: var(--msw-glass-blur);
    -webkit-backdrop-filter: var(--msw-glass-blur);
    border: 1px solid var(--msw-glass-border);
    border-radius: var(--msw-radius-lg);
}

/* Scroll animations */
.msw-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.msw-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.msw-reveal-delay-1 { transition-delay: 0.1s; }
.msw-reveal-delay-2 { transition-delay: 0.2s; }
.msw-reveal-delay-3 { transition-delay: 0.3s; }
.msw-reveal-delay-4 { transition-delay: 0.4s; }

/* Page hero fade-in */
.page-hero {
    animation: fadeInDown 0.6s ease-out;
}

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

/* Glow breathing animation */
@keyframes glowFloat {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) translate(15px, -10px) scale(1.1); opacity: 0.7; }
}

/* Pulse animation for placeholders */
@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.5; }
}

/* Code window breathing glow */
@keyframes codePulse {
    0%, 100% { box-shadow: var(--msw-shadow-lg), 0 0 30px rgba(0, 212, 255, 0.1); }
    50% { box-shadow: var(--msw-shadow-lg), 0 0 50px rgba(0, 212, 255, 0.2); }
}

/* Grid system */
.msw-grid {
    display: grid;
    gap: 2rem;
}

.msw-grid-2 { grid-template-columns: repeat(2, 1fr); }
.msw-grid-3 { grid-template-columns: repeat(3, 1fr); }
.msw-grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .msw-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .msw-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .msw-grid-4, .msw-grid-3, .msw-grid-2 {
        grid-template-columns: 1fr;
    }

    .msw-container {
        padding: 0 1rem;
    }
}

/* Form elements */
.msw-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--msw-bg-surface);
    border: 1px solid var(--msw-glass-border);
    border-radius: var(--msw-radius-sm);
    color: var(--msw-text-primary);
    font-family: var(--msw-font-body);
    font-size: 0.9rem;
    transition: border-color var(--msw-transition-fast);
    outline: none;
}

.msw-input:focus {
    border-color: var(--msw-cyan);
    box-shadow: 0 0 0 3px var(--msw-cyan-glow), 0 0 20px rgba(0, 212, 255, 0.06);
    background: var(--msw-bg-tertiary);
}

.msw-input::placeholder {
    color: var(--msw-text-muted);
}

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

/* Blazor specific */
#blazor-error-ui {
    display: none;
}

.valid.modified:not([type=checkbox]) {
    outline: none;
}

.invalid {
    outline: none;
    border-color: var(--msw-coral) !important;
}

.validation-message {
    color: var(--msw-coral);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* ===========================
   Admin Styles
   =========================== */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.admin-header h1 { margin: 0; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--msw-glass-border);
    color: var(--msw-text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--msw-glass-border);
    vertical-align: middle;
    transition: background 0.2s ease;
}

.admin-table tbody tr:hover td {
    background: var(--msw-cyan-muted);
}

.admin-table tr.unread td {
    background: var(--msw-cyan-muted);
    font-weight: 500;
}

.admin-table .actions {
    display: flex;
    gap: 0.5rem;
}

.admin-thumb {
    width: 48px;
    height: 36px;
    object-fit: contain;
    border-radius: 4px;
    background: var(--msw-bg-tertiary);
}

.tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    background: var(--msw-cyan-muted);
    color: var(--msw-cyan);
    border-radius: 4px;
    font-family: var(--msw-font-mono);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-danger {
    background: var(--msw-coral);
    color: white;
    border: none;
}

.btn-danger:hover {
    opacity: 0.9;
}

.admin-form {
    max-width: 800px;
}

.admin-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.admin-form .form-group {
    margin-bottom: 1.25rem;
}

.admin-form .form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--msw-text-secondary);
    margin-bottom: 0.5rem;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 1.5rem;
}

.save-success {
    color: var(--msw-cyan);
    font-size: 0.85rem;
}

.settings-section {
    margin-bottom: 3rem;
    max-width: 600px;
}

.settings-section h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.settings-desc {
    color: var(--msw-text-muted);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.detail-row td {
    background: var(--msw-bg-surface);
}

.message-detail { padding: 1rem 0; }
.message-detail p { margin-bottom: 0.5rem; color: var(--msw-text-secondary); font-size: 0.9rem; }
.message-body {
    background: var(--msw-bg-tertiary);
    padding: 1rem;
    border-radius: var(--msw-radius-sm);
    white-space: pre-wrap;
    font-size: 0.9rem;
    color: var(--msw-text-primary);
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .admin-form .form-row { grid-template-columns: 1fr; }
    .admin-table { font-size: 0.8rem; }
    .admin-table .actions { flex-direction: column; }
}
