/**
 * Whats Spy - Global Styles
 * Shared CSS variables and common styles across all pages
 */

/* ========== CSS Variables ========== */
:root {
    /* Primary Colors */
    --green-primary: var(--brand-primary);
    --green-dark: var(--brand-primary-strong);
    --green-light: #34eb7a;

    /* Background Colors */
    --bg-dark: #000000;
    --bg-primary: #0a0a0a;
    --bg-secondary: #111B21;
    --bg-tertiary: #1F2C33;
    --bg-card: rgba(17, 27, 33, 0.9);

    /* Text Colors */
    --text-primary: #E9EDEF;
    --text-secondary: #8696A0;
    --text-muted: #667781;

    /* Alert Colors */
    --red-alert: #FF3B30;
    --orange-alert: #FF9500;
    --blue-check: #34B7F1;

    /* Dividers */
    --divider: rgba(255, 255, 255, 0.1);

    /* Safe Areas (iOS) */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* ========== Reset & Base ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== Typography ========== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

p {
    line-height: 1.5;
    color: var(--text-secondary);
}

a {
    color: var(--green-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--green-light);
}

/* ========== Lazy Loading Images ========== */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded,
img[loading="lazy"][src]:not([src=""]) {
    opacity: 1;
}

/* ========== Common Components ========== */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--green-primary), var(--green-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(0, 168, 132, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 168, 132, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--divider);
}

.btn-secondary:hover {
    background: rgba(31, 44, 51, 0.8);
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid rgba(0, 168, 132, 0.2);
    border-radius: 16px;
    padding: 20px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-danger {
    background: rgba(255, 59, 48, 0.15);
    color: var(--red-alert);
    border: 1px solid rgba(255, 59, 48, 0.3);
}

.badge-success {
    background: rgba(0, 168, 132, 0.15);
    color: var(--green-primary);
    border: 1px solid rgba(0, 168, 132, 0.3);
}

.badge-warning {
    background: rgba(255, 149, 0, 0.15);
    color: var(--orange-alert);
    border: 1px solid rgba(255, 149, 0, 0.3);
}

/* ========== Animations ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ========== Utility Classes ========== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-muted);
}

.text-green {
    color: var(--green-primary);
}

.text-red {
    color: var(--red-alert);
}

.text-orange {
    color: var(--orange-alert);
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.font-medium {
    font-weight: 500;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 4px;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

/* ========== Matrix Canvas ========== */
#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.12;
    pointer-events: none;
}

/* ========== Trust Badges ========== */
.trust-badges {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.trust-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.trust-badge svg {
    width: 16px;
    height: 16px;
    color: var(--green-primary);
}

/* ========== Form Elements ========== */
input, select, textarea {
    font-family: inherit;
    font-size: 16px;
}

input:focus, select:focus, textarea:focus {
    outline: none;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ========== Accessibility Focus States ========== */
:focus-visible {
    outline: 2px solid var(--green-primary);
    outline-offset: 2px;
}

/* Skip to main content link (for screen readers) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--green-primary);
    color: white;
    padding: 8px 16px;
    z-index: 1000;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
}

/* ========== Responsive ========== */
@media (max-width: 480px) {
    .trust-badges {
        gap: 12px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}