/* ============================================
   SCANDINAVIAN MINIMALIST DESIGN SYSTEM
   Inspired by juristic.io — Light, clean, restrained
   ============================================ */

:root {
    /* ── Surfaces ── */
    --primary-bg: #FAFBFC;
    --secondary-bg: #FFFFFF;
    --tertiary-bg: #F3F4F6;
    --card-bg: #FFFFFF;
    --surface-hover: #F9FAFB;

    /* ── Gradients (removed — solid backgrounds only) ── */
    --gradient-bg: #FAFBFC;
    --gradient-hero: #FAFBFC;
    --gradient-card: #FFFFFF;
    --gradient-accent: linear-gradient(135deg, #D14D6A 0%, #7353BA 100%);
    --gradient-accent-subtle: linear-gradient(135deg, rgba(209, 77, 106, 0.06), rgba(115, 83, 186, 0.06));

    /* ── Glass replacements (clean surfaces) ── */
    --glass-bg: none;
    --glass-bg-solid: #FFFFFF;
    --glass-border: #E5E7EB;
    --glass-border-top: #E5E7EB;
    --glass-blur: none;
    --glass-inner-light: none;

    /* ── Text hierarchy ── */
    --primary-text: #111827;
    --secondary-text: #4B5563;
    --muted-text: #9CA3AF;
    --link-text: #2563EB;

    /* ── Accent colors (desaturated) ── */
    --accent-color: #F3F4F6;
    --highlight-color: #D14D6A;
    --highlight-hover: #B8455E;
    --highlight-glow: rgba(209, 77, 106, 0.06);
    --purple-accent: #7353BA;
    --purple-glow: rgba(115, 83, 186, 0.06);
    --cyan-accent: #2D9FD6;
    --cyan-glow: rgba(45, 159, 214, 0.06);
    --green-accent: #2DA87A;

    /* ── Shadows (prominent, clean) ── */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 14px -2px rgba(0, 0, 0, 0.12), 0 2px 6px -2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 32px -6px rgba(0, 0, 0, 0.15), 0 6px 12px -4px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 48px -10px rgba(0, 0, 0, 0.18), 0 8px 20px -6px rgba(0, 0, 0, 0.08);
    --shadow-glow: none;
    --shadow-glow-cyan: none;

    /* ── Backward-compatible aliases ── */
    --box-shadow: var(--shadow-md);
    --hover-shadow: var(--shadow-lg);
    --glow-shadow: none;

    /* ── Spacing (8px base) ── */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    --space-4xl: 96px;

    /* ── Radius (softer) ── */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* ── Transitions ── */
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);

    /* ── Border color alias ── */
    --border-color: #E5E7EB;
    --page-border: #E5E7EB;
}

/* ============================================
   BASE
   ============================================ */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    background: var(--primary-bg);
    color: var(--primary-text);
    font-family: 'Inter', sans-serif;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--primary-bg);
}

.container {
    flex: 1 0 auto;
}

* {
    box-sizing: border-box;
}

/* ============================================
   HEADER — Clean, light
   ============================================ */
header {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    margin: 0;
    flex-shrink: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--page-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    height: 64px;
    transition: top 0.9s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.9s cubic-bezier(0.4, 0, 0.2, 1),
                border-radius 0.9s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.9s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.9s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

header.scrolled {
    top: 12px;
    width: min(calc(100% - 32px), 1400px);
    border-radius: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08),
                0 0 0 1px rgba(0, 0, 0, 0.04);
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Remove the rainbow gradient line */
header::after {
    display: none;
}

.logo {
    margin-left: 30px;
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo img {
    height: 36px;
    width: auto;
    margin-right: 10px;
}

.logo:hover {
    opacity: 0.8;
}

.nav-links {
    display: flex;
    align-items: center;
    flex-grow: 1;
    justify-content: center;
}

.center-links {
    display: flex;
    justify-content: center;
    margin: 0 auto;
}

/* Hidden by default — auth-check.js shows it for admin users */
.center-links a[href="/crm"] {
    display: none;
}

.right-aligned-links {
    display: flex;
    margin-right: 30px;
}

.nav-links a {
    margin: 0 4px;
    text-decoration: none;
    color: var(--secondary-text);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    font-weight: 500;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
}

.nav-links a:hover {
    color: var(--primary-text);
    background: var(--tertiary-bg);
}

.nav-links a.active {
    color: var(--primary-text);
    background: rgba(230, 57, 98, 0.06);
    border-bottom: 2px solid var(--highlight-color);
}

/* ============================================
   BUTTONS — clean, minimal
   ============================================ */

/* Primary: rose→charcoal gradient — colored but sophisticated */
.button, .btn-primary, .primary-button {
    background: linear-gradient(135deg, #D14D6A 0%, #1F2937 100%);
    color: #fff;
    padding: 11px 26px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    letter-spacing: 0.02em;
    box-shadow: var(--shadow-md);
}

.button:hover, .btn-primary:hover, .primary-button:hover {
    background: linear-gradient(135deg, #B8455E 0%, #111827 100%);
    box-shadow: var(--shadow-lg);
    animation: ctaBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes ctaBounce {
    0%   { transform: translateY(0); }
    40%  { transform: translateY(-5px); }
    60%  { transform: translateY(-2px); }
    100% { transform: translateY(-3px); }
}

/* Secondary: outlined */
.btn-secondary, .secondary-button {
    background: transparent;
    border: 1px solid var(--page-border);
    color: var(--secondary-text);
    padding: 10px 24px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-secondary:hover, .secondary-button:hover {
    border-color: var(--secondary-text);
    color: var(--primary-text);
    background: var(--tertiary-bg);
}

/* Tertiary: text only */
.btn-tertiary {
    background: none;
    border: none;
    color: var(--highlight-color);
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition-fast);
}

.btn-tertiary:hover {
    color: var(--highlight-hover);
}

/* Ghost: subtle background */
.btn-ghost, .clear-btn, .clear-button {
    background: var(--tertiary-bg);
    border: 1px solid var(--page-border);
    color: var(--secondary-text);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    font-weight: 500;
    font-size: 0.8rem;
}

.btn-ghost:hover, .clear-btn:hover, .clear-button:hover {
    color: var(--primary-text);
    background: #E5E7EB;
    border-color: #D1D5DB;
}

/* Destructive */
.btn-danger, .delete-btn {
    background: rgba(220, 38, 38, 0.06);
    border: 1px solid rgba(220, 38, 38, 0.15);
    color: #DC2626;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.85rem;
}

.btn-danger:hover, .delete-btn:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.25);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
input, select, textarea {
    background: var(--secondary-bg);
    border: 1px solid var(--page-border);
    color: var(--primary-text);
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    font-family: inherit;
    font-size: 0.9rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--highlight-color);
    box-shadow: 0 0 0 3px rgba(230, 57, 98, 0.08);
    background: var(--secondary-bg);
}

input::placeholder, textarea::placeholder {
    color: var(--muted-text);
}

/* Custom select arrow */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239CA3AF' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* ============================================
   TABLES
   ============================================ */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 20px;
}

th {
    background: var(--tertiary-bg);
    color: var(--secondary-text);
    padding: 14px 12px;
    text-align: left;
    border-bottom: 2px solid var(--page-border);
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--page-border);
    color: var(--secondary-text);
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
}

tr {
    transition: var(--transition-fast);
}

tr:hover td {
    background: var(--tertiary-bg);
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    width: 100%;
    background: var(--tertiary-bg);
    padding: 16px 0;
    text-align: center;
    color: var(--muted-text);
    border-top: 1px solid var(--page-border);
    flex-shrink: 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-logo {
    display: none;
}

.footer-logo::before {
    display: none;
}

.footer-links {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--secondary-text);
    text-decoration: none;
    transition: var(--transition-fast);
    font-size: 0.85rem;
}

.footer-links a:hover {
    color: var(--primary-text);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.hidden {
    display: none;
}

/* Clean card (replaces glass-card) */
.glass-card {
    background: var(--secondary-bg);
    border: 1px solid var(--page-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.glass-card:hover {
    box-shadow: var(--shadow-md);
}

.scrollable-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--page-border);
    border-radius: var(--radius-sm);
    background: var(--secondary-bg);
    scrollbar-width: thin;
    scrollbar-color: #D1D5DB transparent;
}

.scrollable-container:hover {
    scrollbar-color: #9CA3AF transparent;
}

.scrollable-container::-webkit-scrollbar {
    width: 4px;
}

.scrollable-container::-webkit-scrollbar-track {
    background: transparent;
}

.scrollable-container::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 4px;
}

.scrollable-container:hover::-webkit-scrollbar-thumb {
    background: #9CA3AF;
}

.scrollable-container::-webkit-scrollbar-thumb:hover {
    background: #6B7280;
}

/* Global scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* ── Section styling ── */
.section {
    padding: 60px 0;
}

.section-title {
    margin-bottom: 30px;
    text-align: center;
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary-text);
    letter-spacing: -0.02em;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--secondary-text);
    margin-bottom: 20px;
}

/* ── Gradient text effects (simplified for light theme) ── */
.gradient-text {
    color: var(--highlight-color);
    -webkit-text-fill-color: unset;
    background: none;
}

.gradient-text-pink {
    color: var(--highlight-color);
    -webkit-text-fill-color: unset;
    background: none;
}

.gradient-text-purple {
    color: var(--purple-accent);
    -webkit-text-fill-color: unset;
    background: none;
}

.gradient-text-hero {
    background: linear-gradient(135deg, var(--highlight-color) 0%, var(--purple-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent !important;
}

/* ── Page entry animation (subtle) ── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container, .login-container, .register-container,
.pricing-container, .account-container, .crm-container,
.contact-container {
    animation: fadeInUp 0.3s ease-out;
}

/* ============================================
   HAMBURGER MENU TOGGLE (mobile)
   ============================================ */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-right: 16px;
    z-index: 1001;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.mobile-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--primary-text);
    border-radius: 2px;
    transition: var(--transition);
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ============================================
   RESPONSIVE — LARGE DESKTOP (max-width: 1200px)
   ============================================ */
@media (max-width: 1200px) {
    .footer-content {
        max-width: 100%;
        padding: 10px 24px;
    }
}

/* ============================================
   RESPONSIVE — TABLET (max-width: 1024px)
   ============================================ */
@media (max-width: 1024px) {
    .nav-links a {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .logo {
        margin-left: 20px;
    }

    .right-aligned-links {
        margin-right: 20px;
    }
}

/* ============================================
   RESPONSIVE — MOBILE (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    header {
        padding: 0;
        height: 56px;
    }

    header.scrolled {
        top: 8px;
        width: calc(100% - 16px);
        border-radius: 12px;
    }

    body {
        padding-top: 56px !important;
    }

    .logo {
        margin-left: 16px;
        font-size: 18px;
    }

    .logo img {
        height: 28px;
    }

    .nav-links {
        display: none !important;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        height: calc(100vh - 56px);
        background: #ffffff;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        padding: 16px 0;
        overflow-y: auto;
        z-index: 10000;
        box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    }

    .nav-links.open {
        display: flex !important;
    }

    .center-links {
        display: flex;
        flex-direction: column;
        margin: 0;
    }

    .center-links a {
        display: block;
        padding: 14px 24px;
        font-size: 1rem;
        border-radius: 0;
        border-bottom: 1px solid var(--page-border);
    }

    .center-links a:last-child {
        border-bottom: none;
    }

    .right-aligned-links {
        display: flex !important;
        flex-direction: column;
        margin: 0;
        padding-top: 16px;
        border-top: 1px solid var(--page-border);
        opacity: 1 !important;
    }

    .right-aligned-links a {
        display: block;
        padding: 14px 24px;
        font-size: 1rem;
        border-radius: 0;
    }

    .nav-links a.active {
        border-bottom-color: var(--page-border);
        background: rgba(230, 57, 98, 0.04);
    }

    /* Section titles */
    .section-title {
        font-size: 1.6rem;
    }

    /* Footer */
    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px 20px;
    }

    .footer-content {
        padding: 10px 16px;
    }

    /* Tables — horizontal scroll */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    th, td {
        padding: 10px 8px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    /* Buttons — full width on mobile */
    .button, .btn-primary, .primary-button,
    .btn-secondary, .secondary-button {
        width: 100%;
        text-align: center;
        padding: 14px 20px;
    }
}

/* ============================================
   RESPONSIVE — SMALL MOBILE (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {
    .section-title {
        font-size: 1.35rem;
    }

    .section-subtitle {
        font-size: 0.95rem;
    }

    .section {
        padding: 40px 0;
    }

    /* Reduce footer link clutter on small screens */
    .footer-links {
        gap: 8px 16px;
    }

    .footer-links a {
        font-size: 0.8rem;
    }

    /* Ensure inputs aren't too small for touch */
    input, select, textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
}

/* ============================================
   RESPONSIVE — VERY SMALL MOBILE (max-width: 360px)
   ============================================ */
@media (max-width: 360px) {
    header {
        height: 50px;
    }

    body {
        padding-top: 50px !important;
    }

    .nav-links {
        top: 50px;
    }

    .logo {
        font-size: 16px;
        margin-left: 12px;
    }

    .logo img {
        height: 24px;
    }

    .section-title {
        font-size: 1.2rem;
    }

    .center-links a {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    .right-aligned-links a {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}
