/* CX1 Platform - Core Styles
   Clean, professional design for UK tech business
   ================================================ */

:root {
    --color-navy-950: #050B1A;
    --color-navy-900: #0A1630;
    --color-primary: #3B82F6;
    --color-primary-dark: #1D4ED8;
    --color-primary-light: #67E8F9;
    --color-accent: #22D3EE;
    --color-secondary: #93C5FD;
    --color-success: #34D399;
    --color-error: #FCA5A5;
    --color-warning: #FCD34D;
    --color-info: #7DD3FC;

    --color-bg: var(--color-navy-950);
    --color-bg-subtle: var(--color-navy-900);
    --color-bg-muted: #10203d;
    --color-bg-elevated: rgba(12, 28, 58, 0.72);
    --color-border: rgba(125, 211, 252, 0.22);
    --color-border-dark: rgba(103, 232, 249, 0.45);

    --color-text: #F8FAFC;
    --color-text-muted: #C5D4EA;
    --color-text-light: #9BB0CC;

    --color-glow: 0 0 22px rgba(56, 189, 248, 0.45);
    --color-glow-soft: 0 0 28px rgba(34, 211, 238, 0.18);

    --font-sans: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Consolas', monospace;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.35);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.4);
    --shadow-md: 0 8px 24px -8px rgb(0 0 0 / 0.55);
    --shadow-lg: 0 18px 40px -16px rgb(0 0 0 / 0.65);

    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.9rem;
    --radius-xl: 1.15rem;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    background-image:
        linear-gradient(rgba(56, 189, 248, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.045) 1px, transparent 1px),
        radial-gradient(ellipse 70% 45% at 85% 0%, rgba(37, 99, 235, 0.28), transparent 55%),
        radial-gradient(ellipse 50% 40% at 0% 100%, rgba(8, 47, 73, 0.65), transparent 60%);
    background-size: 56px 56px, 56px 56px, auto, auto;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 0.5em;
    font-weight: 600;
    line-height: 1.25;
    color: var(--color-text);
}

p {
    margin: 0 0 1em;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

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

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.main {
    flex: 1;
}

/* Header */
.header {
    background: rgba(5, 11, 26, 0.82);
    border-bottom: 1px solid var(--color-border);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 4rem;
    gap: 0.75rem;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.logo-mark {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--color-text);
    letter-spacing: -0.03em;
    text-shadow: 0 0 18px rgba(56, 189, 248, 0.55);
}

.logo-text {
    font-weight: 500;
    font-size: 1rem;
    color: var(--color-text-muted);
}

.nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.25rem 0.85rem;
}

.nav-link {
    font-size: 0.9375rem;
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 0.5rem 0;
    transition: color 0.15s ease;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    line-height: inherit;
}

.nav-link:hover,
.nav-link:focus-visible {
    color: var(--color-text);
}

.nav-link:focus-visible,
.nav-dropdown-toggle:focus-visible,
.nav-toggle:focus-visible {
    outline: 2px solid var(--color-primary-light);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.nav-greeting {
    font-size: 0.9375rem;
    color: var(--color-text-muted);
}

.nav-form {
    margin: 0;
}

.nav-button {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
}

.nav-toggle {
    display: none;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
    color: var(--color-text);
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
}

.nav-toggle-icon {
    display: block;
    width: 1rem;
    height: 2px;
    background: currentColor;
    box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
}

.nav-dropdown {
    position: relative;
    --nav-dropdown-gap: 0.35rem;
}

.nav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-dropdown-caret {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    opacity: 0.7;
}

.nav-dropdown-panel {
    display: none;
    position: absolute;
    /* Flush with the toggle. The visual gap is margin, not empty space:
       a ::before bridge fills it so :hover survives the move into the menu. */
    top: 100%;
    left: 0;
    min-width: 16.5rem;
    max-width: min(22rem, calc(100vw - 2rem));
    margin-top: var(--nav-dropdown-gap);
    padding: 0.4rem;
    background: rgba(8, 18, 40, 0.94);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg), var(--color-glow-soft);
    z-index: 120;
}

#nav-help-menu {
    left: auto;
    right: 0;
}

.nav-dropdown.is-open > .nav-dropdown-panel {
    display: block;
}

.nav-dropdown-item {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--color-text);
}

.nav-dropdown-item:hover,
.nav-dropdown-item:focus-visible {
    background: var(--color-bg-subtle);
    color: var(--color-text);
}

.nav-dropdown-name {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.3;
}

.nav-dropdown-desc {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}

@media (hover: hover) and (pointer: fine) and (min-width: 961px) {
    .nav-dropdown:hover > .nav-dropdown-panel,
    .nav-dropdown:focus-within > .nav-dropdown-panel {
        display: block;
    }

    .nav-dropdown:hover > .nav-dropdown-toggle,
    .nav-dropdown:focus-within > .nav-dropdown-toggle {
        color: var(--color-text);
    }

    /* Hit-area across the margin gap, plus 1px onto the toggle so a
       subpixel seam cannot drop :hover before the pointer reaches an item. */
    .nav-dropdown-panel::before {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: 100%;
        height: calc(var(--nav-dropdown-gap) + 1px);
        background: transparent;
    }
}

/* Footer */
.footer {
    background: #040814;
    border-top: 1px solid var(--color-border);
    padding: 2.5rem 0;
    margin-top: auto;
}

.footer-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem 2rem;
    text-align: left;
}

.footer a {
    color: var(--color-primary-light);
}

.footer a:hover {
    color: #fff;
}

.footer-text {
    margin: 0;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.footer-tagline {
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--color-text-light);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.5;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn:focus {
    outline: 2px solid var(--color-primary-light);
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(180deg, #38bdf8 0%, var(--color-primary) 55%, var(--color-primary-dark) 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: var(--color-glow);
}

.btn-primary:hover {
    background: linear-gradient(180deg, #7dd3fc 0%, #60a5fa 55%, var(--color-primary) 100%);
    border-color: transparent;
    color: #fff;
}

.btn-secondary {
    background: transparent;
    color: var(--color-text);
    border-color: var(--color-border-dark);
}

.btn-secondary:hover {
    background: rgba(56, 189, 248, 0.1);
    color: #fff;
    border-color: var(--color-primary-light);
}

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

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

.btn-block {
    width: 100%;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
}

.alert-error {
    background: rgba(127, 29, 29, 0.45);
    color: #fecaca;
    border: 1px solid rgba(252, 165, 165, 0.45);
}

.alert-success {
    background: rgba(6, 78, 59, 0.5);
    color: #bbf7d0;
    border: 1px solid rgba(52, 211, 153, 0.4);
}

.alert-info {
    background: rgba(12, 74, 110, 0.5);
    color: #e0f2fe;
    border: 1px solid rgba(125, 211, 252, 0.4);
}

.alert-warning {
    background: rgba(120, 53, 15, 0.5);
    color: #fef3c7;
    border: 1px solid rgba(252, 211, 77, 0.45);
}

.hub-status-banner {
    background: rgba(120, 53, 15, 0.55);
    border-bottom: 1px solid rgba(253, 186, 116, 0.45);
    padding: 0.65rem 0;
    font-size: 0.9rem;
}

.hub-status-banner a {
    color: #ffedd5;
    font-weight: 600;
}

.onboarding-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}

.onboarding-item {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin: 0.35rem 0;
}

.onboarding-item.is-done {
    color: var(--color-text-muted);
    text-decoration: line-through;
}

.status-incident {
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 0;
}

.status-incident:last-child {
    border-bottom: none;
}

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

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--color-border);
}

.card,
.dashboard-card,
.feature-card,
.auth-card {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(14px);
}

.card {
    padding: 1.5rem;
}

/* Hero Section */
.hero {
    padding: 4.5rem 0 3.5rem;
    text-align: left;
    background: transparent;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(240px, 0.85fr);
    gap: 2.5rem;
    align-items: center;
}

.hero-title {
    font-size: clamp(2.2rem, 4.4vw, 3.6rem);
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: -0.035em;
    max-width: 14ch;
    color: #fff;
    line-height: 1.08;
}

.text-accent {
    color: var(--color-primary-light);
    text-shadow: 0 0 22px rgba(103, 232, 249, 0.55);
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    max-width: 38rem;
    margin: 0 0 2rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.hero-actions .btn-primary .btn-arrow {
    width: 1.05rem;
    height: 1.05rem;
}

.hero-visual {
    position: relative;
    min-height: 280px;
    display: grid;
    place-items: center;
}

.hero-globe {
    width: min(100%, 420px);
    height: auto;
    filter: drop-shadow(0 0 28px rgba(56, 189, 248, 0.45));
}

/* Features Section */
.features {
    padding: 5rem 0;
}

.section-title {
    font-size: 1.75rem;
    text-align: center;
    margin-bottom: 3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.feature-card {
    padding: 2rem;
    text-align: left;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.feature-card:hover {
    box-shadow: var(--shadow-md), var(--color-glow-soft);
    border-color: var(--color-border-dark);
}

.feature-icon {
    width: 2.5rem;
    height: 2.5rem;
    margin: 0 0 1.25rem;
    color: var(--color-accent);
    filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.55));
}

.feature-icon svg {
    width: 100%;
    height: 100%;
}

.feature-title {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
}

.feature-text {
    font-size: 0.9375rem;
    color: var(--color-text-muted);
    margin: 0;
}

/* CTA Section */
.cta {
    padding: 5rem 0;
    background: linear-gradient(180deg, transparent, rgba(10, 22, 48, 0.85));
    text-align: center;
    border-top: 1px solid var(--color-border);
}

.cta-title {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.cta-text {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

/* Auth Pages */
.auth-section {
    padding: 4rem 0;
    min-height: calc(100vh - 8rem);
    display: flex;
    align-items: center;
    background: transparent;
}

.auth-card {
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    font-size: 0.9375rem;
    color: var(--color-text-muted);
    margin: 0;
}

.auth-form {
    margin-bottom: 1.5rem;
}

.auth-footer {
    text-align: center;
    font-size: 0.9375rem;
    color: var(--color-text-muted);
}

.auth-footer p {
    margin: 0;
}

.auth-link {
    font-weight: 500;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.9375rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.form-input {
    width: 100%;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border-dark);
    border-radius: var(--radius);
    background: var(--color-bg);
    color: var(--color-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input::placeholder {
    color: var(--color-text-light);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.22);
}

select.form-input {
    color-scheme: dark;
}

.form-errors {
    background: rgba(127, 29, 29, 0.45);
    border: 1px solid rgba(252, 165, 165, 0.45);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.form-error {
    color: #fecaca;
    font-size: 0.875rem;
    margin: 0;
}

.form-error + .form-error {
    margin-top: 0.25rem;
}

/* Dashboard */
.dashboard-section {
    padding: 3rem 0;
}

.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-title {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.dashboard-subtitle {
    font-size: 1rem;
    color: var(--color-text-muted);
    margin: 0;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    padding: 1.5rem;
}

.dashboard-card-main {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.dashboard-card-icon {
    flex-shrink: 0;
}

.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    background: var(--color-primary);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 600;
    border-radius: 50%;
}

.dashboard-card-content {
    flex: 1;
    min-width: 0;
}

.dashboard-card-title {
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.dashboard-card-heading {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.dashboard-card-text {
    font-size: 0.9375rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

.account-details {
    margin: 0;
}

.account-row {
    display: flex;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9375rem;
}

.account-row:last-child {
    border-bottom: none;
}

.account-row dt {
    width: 7rem;
    flex-shrink: 0;
    color: var(--color-text-muted);
}

.account-row dd {
    margin: 0;
    color: var(--color-text);
}

.product-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.product-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--color-bg-muted);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    gap: 1rem;
}

.product-item-active {
    border: 1px solid var(--color-border);
    background: var(--color-bg);
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.product-name {
    font-weight: 500;
}

.product-description {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.product-badge {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    background: var(--color-bg);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.security-checklist {
    list-style: none;
    margin: 0;
    padding: 0;
}

.security-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    font-size: 0.9375rem;
}

.security-item svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.security-item-ok svg {
    color: var(--color-success);
}

/* Error Page */
.error-section {
    padding: 5rem 0;
    min-height: calc(100vh - 10rem);
    display: flex;
    align-items: center;
}

.error-content {
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
}

.error-code {
    font-size: 6rem;
    font-weight: 700;
    color: var(--color-border-dark);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.error-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.error-text {
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .hero {
        padding: 3rem 0;
    }

    .hero-grid {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 1.85rem;
        max-width: none;
    }

    .hero-visual {
        min-height: 200px;
        order: -1;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero-actions {
        flex-direction: column;
        padding: 0 1rem;
    }
    
    .hero-actions .btn {
        width: 100%;
    }
    
    .features, .cta {
        padding: 3rem 0;
    }
    
    .auth-card {
        padding: 1.5rem;
        margin: 0 1rem;
    }
    
    .dashboard-card-main {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .account-row {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .account-row dt {
        width: auto;
    }
}

@media (max-width: 960px) {
    .nav-greeting {
        display: none;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .header:has(.nav-toggle) .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        flex-wrap: nowrap;
        gap: 0;
        padding: 0.5rem 0 0.85rem;
        background: var(--color-bg);
        border-top: 1px solid var(--color-border);
        box-shadow: var(--shadow-md);
        z-index: 110;
    }

    .header.nav-open:has(.nav-toggle) .nav,
    .header:has(.nav-toggle) .nav.is-open {
        display: flex;
    }

    .header:has(.nav-toggle) .nav-link,
    .header:has(.nav-toggle) .nav-dropdown-toggle {
        padding: 0.7rem 0;
        width: 100%;
        text-align: left;
        justify-content: space-between;
    }

    .header:has(.nav-toggle) .nav-dropdown-panel {
        position: static;
        left: 0;
        right: auto;
        min-width: 0;
        max-width: none;
        margin: 0 0 0.35rem;
        box-shadow: none;
    }

    .header:has(.nav-toggle) .nav-form {
        padding-top: 0.25rem;
    }
}
