/* ══════════════════════════════════════════════════════════
   MintStudio Portal — "Nordic Vault" Design System
   ══════════════════════════════════════════════════════════ */

:root {
    --brand: rgb(19, 91, 147);
    --brand-light: rgba(19, 91, 147, 0.08);
    --brand-glow: rgba(19, 91, 147, 0.15);
    --dark: #0c1222;
    --dark-card: #141c2e;
    --dark-border: rgba(255, 255, 255, 0.06);
    --dark-text: rgba(255, 255, 255, 0.7);
    --dark-text-dim: rgba(255, 255, 255, 0.4);
    --light-bg: #f6f8fb;
    --light-card: #ffffff;
    --light-border: rgba(0, 0, 0, 0.07);
    --text: #1a1a2e;
    --text-dim: #6b7280;
    --radius: 14px;
    --radius-sm: 10px;
    --font-display: 'Plus Jakarta Sans', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-body);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--dark);
    overflow-x: hidden;
}

/* ── Ambient Background ─────────────────────────────────── */
.background-decorations {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(19, 91, 147, 0.12), transparent),
        radial-gradient(ellipse 60% 50% at 80% 80%, rgba(99, 102, 241, 0.06), transparent),
        radial-gradient(ellipse 40% 40% at 50% 50%, rgba(16, 185, 129, 0.04), transparent);
    animation: ambientShift 20s ease-in-out infinite alternate;
}

@keyframes ambientShift {
    0%   { opacity: 1; }
    50%  { opacity: 0.7; }
    100% { opacity: 1; }
}

/* ── Portal Container ───────────────────────────────────── */
.portal-container {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
}

.portal-container.dashboard-mode {
    max-width: none;
}

/* ── Login Section ──────────────────────────────────────── */
.login-section, .dashboard-section {
    display: none;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

.login-section.active, .dashboard-section.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.login-section.active {
    min-height: 100vh;
}

.login-split {
    display: flex;
    min-height: 100vh;
}

/* ── Brand Panel (Left) ─────────────────────────────────── */
.login-brand-panel {
    flex: 1;
    display: none;
    flex-direction: column;
    justify-content: center;
    padding: 64px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(160deg, #0a1628 0%, #0f1d35 50%, #0c1222 100%);
}

.brand-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.03;
    background-image:
        linear-gradient(rgba(255,255,255,0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 48px 48px;
}

.brand-content {
    position: relative;
    z-index: 1;
    max-width: 440px;
}

.brand-logo-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 48px;
    animation: fadeInUp 0.7s var(--ease) 0.1s both;
}

.brand-logo {
    width: 56px;
    height: 56px;
    border-radius: 0;
}

.brand-logo-full {
    height: 108px;
    width: auto;
    object-fit: contain;
}

.header-logo-full {
    height: 65px;
    width: auto;
    object-fit: contain;
}

.brand-wordmark {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.03em;
}

.brand-accent { color: rgba(255, 255, 255, 0.5); font-weight: 500; }

.brand-tagline {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.25;
    letter-spacing: -0.03em;
    margin-bottom: 20px;
    animation: fadeInUp 0.7s var(--ease) 0.2s both;
}

.brand-sub {
    font-size: 1.05rem;
    color: var(--dark-text);
    line-height: 1.6;
    margin-bottom: 40px;
    animation: fadeInUp 0.7s var(--ease) 0.3s both;
}

.brand-features {
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: fadeInUp 0.7s var(--ease) 0.4s both;
}

.brand-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--dark-text-dim);
    font-size: 0.875rem;
    font-weight: 500;
}

.brand-feature svg { color: var(--brand); flex-shrink: 0; }

/* ── Form Panel (Right) ─────────────────────────────────── */
.login-form-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 48px 24px;
    background: var(--dark);
    position: relative;
}

/* ── Language Switcher ───────────────────────────────────── */
.lang-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 2px;
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: 8px;
    padding: 3px;
    z-index: 5;
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--dark-text-dim);
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s var(--ease);
    letter-spacing: 0.03em;
}

.lang-btn:hover {
    color: var(--dark-text);
}

.lang-btn.active {
    background: var(--brand);
    color: #fff;
}

.login-form-panel .header {
    text-align: center;
    margin-bottom: 40px;
    width: 100%;
    max-width: 380px;
}

.login-form-panel .header-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
    animation: fadeInUp 0.6s var(--ease) 0.1s both;
}

.header-logo {
    width: 56px;
    height: 56px;
    border-radius: 0;
}

.header-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.03em;
}

.header-subtitle {
    font-size: 0.75rem;
    color: var(--dark-text-dim);
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-top: 2px;
}

.login-welcome {
    font-family: var(--font-display);
    font-size: 1.125rem;
    color: var(--dark-text);
    font-weight: 500;
    animation: fadeInUp 0.6s var(--ease) 0.2s both;
}

/* ── Login Form ─────────────────────────────────────────── */
.login-form {
    width: 100%;
    max-width: 380px;
}

.form-group {
    margin-bottom: 20px;
    animation: fadeInUp 0.5s var(--ease) both;
}
.form-group:nth-of-type(1) { animation-delay: 0.3s; }
.form-group:nth-of-type(2) { animation-delay: 0.4s; }

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--dark-text);
    font-weight: 500;
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 15px;
    font-family: var(--font-body);
    transition: all 0.2s var(--ease);
    outline: none;
}

.form-group input::placeholder {
    color: var(--dark-text-dim);
}

.form-group input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-glow);
    background: rgba(20, 28, 46, 0.8);
}

.form-group input:hover:not(:focus) {
    border-color: rgba(255, 255, 255, 0.12);
}

/* ── Login Button ───────────────────────────────────────── */
.login-btn {
    width: 100%;
    padding: 14px 24px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-display);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s var(--ease);
    box-shadow: 0 4px 16px rgba(19, 91, 147, 0.3);
    animation: fadeInUp 0.5s var(--ease) 0.5s both;
}

.login-btn:hover:not(:disabled) {
    background: rgb(24, 105, 170);
    box-shadow: 0 6px 24px rgba(19, 91, 147, 0.4);
    transform: translateY(-1px);
}

.login-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(19, 91, 147, 0.3);
}

.login-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-arrow {
    transition: transform 0.2s var(--ease);
}

.login-btn:hover .btn-arrow {
    transform: translateX(3px);
}

/* ── Error Message ──────────────────────────────────────── */
.error-message {
    display: none;
    padding: 14px 16px;
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: var(--radius-sm);
    color: #fca5a5;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 20px;
    animation: fadeInUp 0.3s var(--ease) both;
}

/* ── Login Footer ───────────────────────────────────────── */
.login-footer-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
    color: var(--dark-text-dim);
    font-size: 0.75rem;
    font-weight: 500;
    animation: fadeInUp 0.5s var(--ease) 0.6s both;
}

.login-footer-text svg { color: #10b981; }

/* ══════════════════════════════════════════════════════════
   DASHBOARD (Light Mode)
   ══════════════════════════════════════════════════════════ */

.dashboard-section.active {
    background: var(--light-bg);
    min-height: 100vh;
    padding: 0 24px 48px;
}

.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    margin-bottom: 8px;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

.dash-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dash-logo {
    width: 36px;
    height: 36px;
    border-radius: 0;
}

.dash-wordmark {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.dashboard-section .header {
    text-align: center;
    margin-bottom: 40px;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

.dashboard-section .header h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

.dashboard-section .header p {
    color: var(--text-dim);
    font-size: 1rem;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--light-border);
    color: var(--text-dim);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: var(--font-body);
    transition: all 0.2s var(--ease);
}

.logout-btn:hover {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

/* ── System Cards ───────────────────────────────────────── */
.systems-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 1100px;
    margin: 0 auto;
}

.system-card {
    background: var(--light-card);
    border: 1px solid var(--light-border);
    border-radius: var(--radius);
    padding: 28px 24px 24px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s var(--ease);
}

.card-accent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s var(--ease);
}

.system-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
    border-color: transparent;
}

.system-card:hover .card-accent {
    transform: scaleX(1);
}

.system-card:active {
    transform: translateY(-2px) scale(0.99);
    transition-duration: 0.1s;
}

/* Per-card accent colors via data-color */
.system-card[data-color="#6366f1"] .card-accent { background: #6366f1; }
.system-card[data-color="#6366f1"] .system-icon { color: #6366f1; }
.system-card[data-color="#f59e0b"] .card-accent { background: #f59e0b; }
.system-card[data-color="#f59e0b"] .system-icon { color: #f59e0b; }
.system-card[data-color="#10b981"] .card-accent { background: #10b981; }
.system-card[data-color="#10b981"] .system-icon { color: #10b981; }
.system-card[data-color="#8b5cf6"] .card-accent { background: #8b5cf6; }
.system-card[data-color="#8b5cf6"] .system-icon { color: #8b5cf6; }
.system-card[data-color="#135b93"] .card-accent { background: #135b93; }
.system-card[data-color="#135b93"] .system-icon { color: #135b93; }
.system-card[data-color="#ec4899"] .card-accent { background: #ec4899; }
.system-card[data-color="#ec4899"] .system-icon { color: #ec4899; }

.system-icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    position: relative;
    transition: transform 0.3s var(--ease);
}

.system-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: currentColor;
    opacity: 0.1;
}

.system-icon svg {
    position: relative;
    z-index: 1;
    stroke: currentColor;
}

.system-card:hover .system-icon {
    transform: scale(1.08);
}

.system-title {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.system-description {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.55;
    margin-bottom: 18px;
}

.system-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.02em;
}

.status-online {
    background: #dcfce7;
    color: #166534;
}

.status-online::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #16a34a;
    border-radius: 50%;
    animation: pulse-glow 2s infinite;
}

.status-offline {
    background: #fef2f2;
    color: #dc2626;
}

.status-offline::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #dc2626;
    border-radius: 50%;
}

/* ── Card Stagger Animations ────────────────────────────── */
.system-card.anim-card-1 { animation: fadeInUp 0.5s var(--ease) 0.15s both; }
.system-card.anim-card-2 { animation: fadeInUp 0.5s var(--ease) 0.25s both; }
.system-card.anim-card-3 { animation: fadeInUp 0.5s var(--ease) 0.35s both; }
.system-card.anim-card-4 { animation: fadeInUp 0.5s var(--ease) 0.45s both; }
.system-card.anim-card-5 { animation: fadeInUp 0.5s var(--ease) 0.55s both; }
.system-card.anim-card-6 { animation: fadeInUp 0.5s var(--ease) 0.65s both; }

/* ── Footer ─────────────────────────────────────────────── */
footer {
    pointer-events: none;
    position: fixed;
    bottom: 16px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    z-index: 10;
    animation: fadeInUp 0.5s var(--ease) 1.2s both;
}

footer > div {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 6px 16px;
}

footer p {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 500;
    text-align: center;
}

/* ── Loading / Spinner ──────────────────────────────────── */
.loading { text-align: center; color: var(--dark-text); font-weight: 500; }
.spinner {
    border: 2px solid var(--dark-border);
    border-top: 2px solid var(--brand);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 0.8s linear infinite;
    margin: 24px auto;
}

/* ── Keyframes ──────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-glow {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); }
    50%      { opacity: 0.7; box-shadow: 0 0 0 4px rgba(22, 163, 74, 0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */

@media (min-width: 900px) {
    .login-brand-panel { display: flex; }
    .login-form-panel {
        width: 480px;
        flex-shrink: 0;
        border-left: 1px solid var(--dark-border);
    }
    .login-form-panel .header-brand { display: none; }
}

@media (max-width: 899px) {
    .login-brand-panel { display: none; }
    .login-form-panel { width: 100%; }
    .login-split { min-height: 100vh; }
}

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

@media (max-width: 640px) {
    .systems-grid { grid-template-columns: 1fr; gap: 12px; }
    .system-card { padding: 20px; }
    .dashboard-section.active { padding: 0 16px 32px; }
    .dashboard-section .header h1 { font-size: 1.5rem; }
    .dash-header { padding: 16px 0; }
    .login-form-panel { padding: 32px 20px; }
    .login-form-panel .header { margin-bottom: 28px; }
    .header-logo-full { height: 54px; }
    .header-title { font-size: 1.35rem; }
    .header-subtitle { font-size: 0.65rem; }
    .login-welcome { font-size: 1rem; }
    .login-form-panel .header-brand { margin-bottom: 20px; gap: 10px; }
    .lang-switcher { top: 14px; right: 14px; }
    .lang-btn { padding: 4px 8px; font-size: 0.65rem; }
    footer { bottom: 10px; }
    footer > div { padding: 4px 12px; }
    footer p { font-size: 0.65rem; }
}
