/* Point One & Atlas Command Design System Styles for PhonePos */

@font-face {
    font-family: 'Instrument Sans';
    src: url('/static/fonts/InstrumentSans-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Instrument Sans';
    src: url('/static/fonts/InstrumentSans-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Instrument Sans';
    src: url('/static/fonts/InstrumentSans-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Instrument Sans';
    src: url('/static/fonts/InstrumentSans-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Azeret Mono';
    src: url('/static/fonts/AzeretMono-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Azeret Mono';
    src: url('/static/fonts/AzeretMono-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Azeret Mono';
    src: url('/static/fonts/AzeretMono-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Azeret Mono';
    src: url('/static/fonts/AzeretMono-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Alliance No.2';
    src: url('/static/fonts/AllianceNo.2-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Brand & Core Color Tokens */
    --background: #090d16;
    --background-subtle: #0d1320;
    --surface: #131b2e;
    --surface-elevated: #182238;
    --surface-hover: #1c2740;
    --surface-active: #23304e;
    --surface-glass: rgba(19, 27, 46, 0.85);

    --border: rgba(255, 255, 255, 0.09);
    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-focus: rgba(255, 255, 255, 0.35);
    --border-highlight: #38bdf8;

    --foreground: #fafaf9;
    --foreground-muted: rgba(255, 255, 255, 0.62);
    --foreground-subtle: rgba(255, 255, 255, 0.40);
    --foreground-inverted: #090d16;

    /* Point One Signature Accents */
    --brand-green: #10b981;
    --brand-green-hover: #059669;
    --brand-green-subtle: rgba(16, 185, 129, 0.12);
    --brand-citron: #d3f754;
    --brand-citron-subtle: rgba(211, 247, 84, 0.14);

    --accent-blue: #009de0;
    --accent-blue-light: #38bdf8;
    --accent-blue-subtle: rgba(0, 157, 224, 0.15);

    --accent-amber: #f59e0b;
    --accent-amber-subtle: rgba(245, 158, 11, 0.15);

    --accent-purple: #a855f7;
    --accent-purple-subtle: rgba(168, 85, 247, 0.15);

    --accent-red: #ef4444;
    --accent-red-hover: #dc2626;
    --accent-red-subtle: rgba(239, 68, 68, 0.15);

    /* Typography */
    --font-sans: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'Azeret Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --font-display: 'Alliance No.2', 'Instrument Sans', sans-serif;

    /* Shadows & Radii */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.25);
    --shadow-modal: 0 24px 48px -12px rgba(0, 0, 0, 0.6);
    --shadow-popover: 0 8px 16px rgba(0, 0, 0, 0.35);
}

/* Global resets & typography */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    background-color: var(--background);
    color: var(--foreground);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Monospace Helpers */
.font-mono {
    font-family: var(--font-mono) !important;
}

.font-display {
    font-family: var(--font-display) !important;
}

/* Tracking / Leading */
.tracking-tight { letter-spacing: -0.015em; }
.tracking-wide { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.15em; }

/* Status Light component with live pulse */
.p1-status-light {
    position: relative;
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--brand-green);
    flex-shrink: 0;
}

.p1-status-light.pulse::after {
    content: "";
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    background-color: inherit;
    opacity: 0.5;
    animation: p1-pulse 2s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

.p1-status-light.status-amber { background-color: var(--accent-amber); }
.p1-status-light.status-red { background-color: var(--accent-red); }
.p1-status-light.status-blue { background-color: var(--accent-blue-light); }
.p1-status-light.status-gray { background-color: var(--foreground-subtle); }

@keyframes p1-pulse {
    0% { transform: scale(0.9); opacity: 0.8; }
    70% { transform: scale(2.4); opacity: 0; }
    100% { transform: scale(2.4); opacity: 0; }
}

/* Capsule Buttons (Atlas-Command Style) */
.btn-p1 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 16px;
    border-radius: var(--radius-full);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    outline: none;
    transition: all 0.15s ease;
    user-select: none;
    white-space: nowrap;
}

.btn-p1:active {
    transform: scale(0.98);
}

.btn-p1-sm {
    height: 30px;
    padding: 0 12px;
    font-size: 12px;
    gap: 6px;
}

.btn-p1-lg {
    height: 44px;
    padding: 0 22px;
    font-size: 14px;
    font-weight: 600;
}

.btn-p1-primary {
    background-color: var(--foreground);
    color: var(--foreground-inverted);
    font-weight: 600;
}

.btn-p1-primary:hover {
    background-color: #e7e7e4;
}

.btn-p1-brand {
    background-color: var(--brand-green);
    color: #090d16;
    font-weight: 700;
}

.btn-p1-brand:hover {
    background-color: var(--brand-green-hover);
}

.btn-p1-outline {
    background-color: transparent;
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--foreground);
}

.btn-p1-outline:hover {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.28);
}

.btn-p1-ghost {
    background-color: transparent;
    color: var(--foreground-muted);
}

.btn-p1-ghost:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--foreground);
}

.btn-p1-danger {
    background-color: var(--accent-red-subtle);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.btn-p1-danger:hover {
    background-color: rgba(239, 68, 68, 0.25);
    border-color: var(--accent-red);
    color: #ffffff;
}

/* Badges */
.p1-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: var(--radius-sm);
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    border: 1px solid transparent;
}

.p1-badge-outline {
    border-color: var(--border);
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--foreground);
}

.p1-badge-green {
    background-color: var(--brand-green-subtle);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--brand-green);
}

.p1-badge-citron {
    background-color: var(--brand-citron-subtle);
    border-color: rgba(211, 247, 84, 0.3);
    color: var(--brand-citron);
}

.p1-badge-blue {
    background-color: var(--accent-blue-subtle);
    border-color: rgba(0, 157, 224, 0.3);
    color: var(--accent-blue-light);
}

.p1-badge-amber {
    background-color: var(--accent-amber-subtle);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--accent-amber);
}

.p1-badge-purple {
    background-color: var(--accent-purple-subtle);
    border-color: rgba(168, 85, 247, 0.3);
    color: var(--accent-purple);
}

.p1-badge-red {
    background-color: var(--accent-red-subtle);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.p1-badge-gray {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--foreground-muted);
}

/* Cards & Surfaces */
.p1-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    transition: border-color 0.15s ease;
}

.p1-card-glass {
    background-color: var(--surface-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-modal);
}

/* Data Tables */
.p1-table-wrapper {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow-x: auto;
    position: relative;
}

.p1-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

.p1-th {
    background-color: #0e1525;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--foreground-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.p1-th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.p1-th.sortable:hover {
    color: var(--foreground);
    background-color: #151e33;
}

.p1-td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--foreground);
    vertical-align: middle;
}

.p1-tr {
    transition: background-color 0.12s ease;
}

.p1-tr:hover {
    background-color: var(--surface-hover);
}

.p1-tr:last-child .p1-td {
    border-bottom: none;
}

/* Modal Chrome */
.p1-modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.p1-modal {
    background-color: #111827;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-2xl, 16px);
    width: 100%;
    max-width: 540px;
    box-shadow: var(--shadow-modal);
    overflow: hidden;
    animation: p1-modal-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes p1-modal-pop {
    0% { transform: scale(0.96); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.p1-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.p1-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--foreground);
}

.p1-modal-body {
    padding: 24px;
    max-height: 75vh;
    overflow-y: auto;
}

.p1-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background-color: rgba(0, 0, 0, 0.2);
}

/* Inputs & Form Controls */
.p1-input {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    background-color: rgba(9, 13, 22, 0.7);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--foreground);
    font-family: var(--font-sans);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.p1-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.p1-input::placeholder {
    color: var(--foreground-subtle);
}

.p1-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--foreground-muted);
    margin-bottom: 6px;
}

/* Pill Tabs */
.p1-tab-container {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: rgba(19, 27, 46, 0.7);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
}

.p1-tab-pill {
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    color: var(--foreground-muted);
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
    border: 1px solid transparent;
}

.p1-tab-pill:hover {
    color: var(--foreground);
    background: rgba(255, 255, 255, 0.05);
}

.p1-tab-pill.active {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-weight: 600;
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Stat Cards */
.p1-stat-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 20px;
    box-shadow: var(--shadow-card);
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.p1-stat-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.p1-stat-label {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--foreground-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.p1-stat-value {
    font-size: 28px;
    font-family: var(--font-mono);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-top: 6px;
    color: var(--foreground);
    font-variant-numeric: tabular-nums;
}

/* Upload Drop Zone */
.p1-upload-card {
    background: rgba(19, 27, 46, 0.6);
    border: 1.5px dashed rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-xl);
    padding: 30px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.p1-upload-card:hover, .p1-upload-card.dragover {
    border-color: var(--brand-green);
    background: rgba(16, 185, 129, 0.06);
}

/* Map Snapshot Thumbnail */
.p1-snapshot-box {
    width: 116px;
    height: 72px;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
    background: #060910;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.p1-snapshot-box:hover {
    transform: translateY(-2px) scale(1.03);
    border-color: var(--accent-blue-light);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.55);
}

.p1-snapshot-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.p1-snapshot-badge {
    position: absolute;
    bottom: 3px;
    right: 4px;
    background: rgba(9, 13, 22, 0.88);
    backdrop-filter: blur(4px);
    color: var(--foreground-muted);
    font-family: var(--font-mono);
    font-size: 8px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    border: 0.5px solid rgba(255, 255, 255, 0.18);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    pointer-events: none;
}

/* Promotion Capsule Button & Floating Dropdown */
.p1-promo-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-family: var(--font-sans);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.18s ease;
    background: transparent;
}

.p1-promo-btn-unpromoted {
    background: rgba(255, 255, 255, 0.06);
    color: var(--foreground-muted);
    border-color: rgba(255, 255, 255, 0.12);
}

.p1-promo-btn-unpromoted:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.p1-promo-btn-training {
    background: var(--accent-purple-subtle);
    color: #d8b4fe;
    border-color: rgba(168, 85, 247, 0.35);
}

.p1-promo-btn-training:hover {
    background: rgba(168, 85, 247, 0.25);
}

.p1-promo-btn-testing {
    background: var(--accent-blue-subtle);
    color: var(--accent-blue-light);
    border-color: rgba(0, 157, 224, 0.35);
}

.p1-promo-btn-testing:hover {
    background: rgba(0, 157, 224, 0.25);
}

.p1-promo-btn-both {
    background: var(--brand-green-subtle);
    color: var(--brand-green);
    border-color: rgba(16, 185, 129, 0.35);
}

.p1-promo-btn-both:hover {
    background: rgba(16, 185, 129, 0.25);
}

.p1-promo-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
    display: inline-block;
}

.p1-promo-caret {
    font-size: 9px;
    opacity: 0.7;
    margin-left: 2px;
}

.p1-promo-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 100;
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-popover);
    min-width: 180px;
    padding: 4px;
}

.p1-promo-dropdown.show {
    display: block;
    animation: p1-dropdown-pop 0.15s ease-out;
}

@keyframes p1-dropdown-pop {
    from { opacity: 0; transform: translateY(-4px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.p1-promo-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--foreground);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.p1-promo-option:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.p1-promo-flash {
    animation: p1-flashGreen 0.6s ease-out;
}

@keyframes p1-flashGreen {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.8); }
    50% { box-shadow: 0 0 12px 4px rgba(16, 185, 129, 0.6); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
