/* ============================================================
   Shared styles for Audit Guide Flow Mockups
   Mirrors Phoenix v1.14.0 theme patterns
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,opsz,wght@0,6..12,300;0,6..12,400;0,6..12,600;0,6..12,700;1,6..12,400&display=swap');

:root {
    /* Gray scale */
    --gray-50: #f6f7f9;
    --gray-100: #f1f3f5;
    --gray-200: #e6e8ed;
    --gray-300: #d1d4db;
    --gray-400: #adb3c2;
    --gray-500: #9198a6;
    --gray-600: #767c88;
    --gray-700: #605c67;
    --gray-800: #4a454d;
    --gray-900: #37333b;
    --gray-1000: #262428;

    /* Theme colors */
    --primary: #002650;
    --primary-dark: #001F41;
    --secondary: #0066FF;
    --secondary-dark: #0047B3;

    --success: #25C023;
    --success-dark: #1C6C09;
    --success-bg: #F0FDEC;
    --success-border: #90D67F;

    --warning: #E5780B;
    --warning-dark: #BC3803;
    --warning-bg: #FFF6E0;
    --warning-border: #FFCC85;

    --danger: #FA3B1D;
    --danger-dark: #B81800;
    --danger-bg: #FFEDEB;
    --danger-border: #F48270;

    --info: #0dcaf0;
    --info-bg: #e8f7fa;
    --info-border: #c3e6ec;

    /* AI styling */
    --ai-gradient: linear-gradient(170deg, #f0eeeb 0%, #e8e6e3 50%, #f0eeeb 100%);
    --ai-card-bg: rgba(255, 255, 255, 0.85);

    /* Spacing */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 1rem;
    --sp-4: 1.5rem;
    --sp-5: 2rem;
    --sp-6: 2.5rem;
}

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

body {
    font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: var(--gray-800);
    background: var(--gray-50);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ---- Layout ---- */

.page-container {
    max-width: 800px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-header {
    padding: var(--sp-4) var(--sp-4) var(--sp-3);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

.page-header__back {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--gray-600);
    transition: all 0.15s;
    flex-shrink: 0;
    text-decoration: none;
}

.page-header__back:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.page-header__title {
    font-size: 13px;
    color: var(--gray-500);
    font-weight: 400;
}

.page-header__property {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
}

.page-content {
    flex: 1;
    padding: 0 var(--sp-4) var(--sp-5);
}

/* ---- Grade badges ---- */

.grade-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border-radius: 6px;
    line-height: 1;
}

.grade-badge--sm {
    font-size: 13px;
    padding: 4px 8px;
    min-width: 32px;
}

.grade-badge--md {
    font-size: 18px;
    padding: 6px 12px;
    min-width: 42px;
}

.grade-badge--lg {
    font-size: 28px;
    padding: 10px 18px;
    min-width: 58px;
}

.grade-badge--xl {
    font-size: 42px;
    padding: 14px 24px;
    min-width: 80px;
}

.grade-badge--success {
    background: var(--success-bg);
    color: var(--success-dark);
    border: 2px solid var(--success-border);
}

.grade-badge--warning {
    background: var(--warning-bg);
    color: var(--warning-dark);
    border: 2px solid var(--warning-border);
}

.grade-badge--danger {
    background: var(--danger-bg);
    color: var(--danger-dark);
    border: 2px solid var(--danger-border);
}

/* ---- Agent message ---- */

.agent-message {
    display: flex;
    gap: var(--sp-3);
    align-items: flex-start;
}

.agent-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.agent-avatar--sm {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

.agent-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--gray-800);
}

.agent-text strong {
    font-weight: 700;
    color: var(--gray-900);
}

/* ---- Typing indicator ---- */

.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gray-400);
    animation: typing 1.2s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* ---- Cards ---- */

.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0;
    overflow: hidden;
}

.card--rounded {
    border-radius: 8px;
}

/* ---- Category rows ---- */

.category-row {
    display: flex;
    align-items: center;
    padding: var(--sp-3) var(--sp-4);
    gap: var(--sp-3);
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}

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

.category-row:hover {
    background: var(--gray-50);
}

.category-row__grade {
    flex-shrink: 0;
}

.category-row__content {
    flex: 1;
    min-width: 0;
}

.category-row__name {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 2px;
}

.category-row__summary {
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.4;
}

.category-row__meta {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-shrink: 0;
}

.category-row__failing {
    font-size: 12px;
    font-weight: 600;
    color: var(--danger);
    background: var(--danger-bg);
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.category-row__chevron {
    color: var(--gray-400);
    font-size: 12px;
}

/* ---- Test result rows ---- */

.test-row {
    display: flex;
    align-items: flex-start;
    padding: var(--sp-3) var(--sp-4);
    gap: var(--sp-3);
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.15s;
}

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

.test-row__grade {
    flex-shrink: 0;
    padding-top: 2px;
}

.test-row__content {
    flex: 1;
    min-width: 0;
}

.test-row__name {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.test-row__detail {
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.4;
}

.test-row__data {
    margin-top: var(--sp-2);
}

.test-row__cta {
    flex-shrink: 0;
    padding-top: 2px;
}

/* ---- Buttons ---- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}

.btn--primary {
    background: var(--secondary);
    color: white;
}

.btn--primary:hover {
    background: var(--secondary-dark);
}

.btn--outline {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn--outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn--ghost {
    background: transparent;
    color: var(--secondary);
    padding: 8px 12px;
}

.btn--ghost:hover {
    background: var(--gray-50);
}

.btn--warning {
    background: var(--warning);
    color: white;
}

.btn--warning:hover {
    background: var(--warning-dark);
}

.btn--sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* ---- Mini data table ---- */

.mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.mini-table th {
    background: var(--gray-100);
    font-weight: 600;
    color: var(--gray-700);
    text-align: left;
    padding: 6px 10px;
    border-bottom: 1px solid var(--gray-200);
}

.mini-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

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

.mini-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ---- Tool preview ---- */

.tool-preview {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
    margin-top: var(--sp-2);
}

.tool-preview__header {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    font-size: 12px;
    color: var(--gray-600);
    border-bottom: 1px solid var(--gray-100);
}

.tool-preview__header i {
    color: var(--gray-400);
}

.tool-preview__content {
    padding: var(--sp-3);
}

/* ---- Inline tool step (timeline style) ---- */

.tool-timeline {
    position: relative;
    margin-left: var(--sp-3);
    padding-left: 32px;
}

.tool-timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: repeating-linear-gradient(
        to bottom,
        var(--gray-300) 0,
        var(--gray-300) 3px,
        transparent 3px,
        transparent 6px
    );
}

.tool-step {
    position: relative;
    padding: var(--sp-2) 0;
}

.tool-step__icon {
    position: absolute;
    left: -32px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ai-gradient);
    border-radius: 4px;
    z-index: 1;
    font-size: 11px;
    color: var(--gray-700);
}

.tool-step__icon.is-running {
    color: var(--info);
    animation: icon-pulse 1.5s ease-in-out infinite;
}

@keyframes icon-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.tool-step__text {
    font-size: 13px;
    color: var(--gray-700);
}

.tool-step__progress {
    font-size: 12px;
    color: var(--info);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ---- Chat interface ---- */

.chat-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--sp-3);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.chat-bubble--user {
    background: var(--gray-100);
    padding: var(--sp-3);
    border-radius: 8px;
    max-width: 85%;
    align-self: flex-start;
    font-size: 14px;
}

.chat-bubble--bot {
    padding: var(--sp-2) 0;
    font-size: 14px;
    line-height: 1.6;
}

.chat-input-area {
    padding: var(--sp-3);
    border-top: 1px solid var(--gray-200);
}

.chat-input-box {
    display: flex;
    align-items: flex-end;
    border: 1px solid var(--gray-300);
    border-radius: 12px;
    padding: var(--sp-2);
    background: white;
    gap: var(--sp-2);
}

.chat-input-box textarea {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    min-height: 1.5em;
    max-height: 6em;
    padding: 2px var(--sp-2);
    color: var(--gray-800);
}

.chat-input-box textarea::placeholder {
    color: var(--gray-400);
}

.chat-send-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-send-btn:disabled {
    background: var(--gray-400);
    cursor: not-allowed;
}

/* ---- Suggested actions ---- */

.suggested-actions {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    margin-top: var(--sp-3);
}

.action-btn {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 10px var(--sp-3);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    font-family: inherit;
    color: var(--gray-800);
    font-size: 13px;
    line-height: 1.4;
}

.action-btn:hover {
    border-color: var(--secondary);
    background: #f0f7ff;
}

.action-btn__icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
}

.action-btn__icon--bolt {
    background: var(--warning-bg);
    color: var(--warning-dark);
}

.action-btn__icon--search {
    background: var(--info-bg);
    color: #0b7285;
}

/* ---- Bar chart (horizontal) ---- */

.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bar-chart__item {
    display: grid;
    grid-template-columns: minmax(80px, 1fr) 2fr minmax(50px, auto);
    gap: 8px;
    align-items: center;
    font-size: 12px;
}

.bar-chart__label {
    color: var(--gray-700);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-chart__track {
    height: 8px;
    background: var(--gray-100);
    border-radius: 4px;
    overflow: hidden;
}

.bar-chart__fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s ease;
}

.bar-chart__fill--primary {
    background: linear-gradient(90deg, var(--primary) 0%, rgba(0,38,80,0.6) 100%);
}

.bar-chart__fill--danger {
    background: linear-gradient(90deg, var(--danger) 0%, rgba(250,59,29,0.6) 100%);
}

.bar-chart__value {
    text-align: right;
    color: var(--gray-600);
    font-variant-numeric: tabular-nums;
}

/* ---- Sparkline placeholder ---- */

.sparkline-placeholder {
    height: 120px;
    background: var(--gray-50);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.sparkline-placeholder svg {
    width: 100%;
    height: 100%;
}

/* ---- Modal ---- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 440px;
    padding: var(--sp-5);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    transform: translateY(10px);
    transition: transform 0.2s;
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-card h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--sp-1);
}

.modal-card p {
    color: var(--gray-600);
    font-size: 14px;
    margin-bottom: var(--sp-4);
}

.modal-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    margin-bottom: var(--sp-3);
    color: var(--gray-800);
}

.modal-input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.modal-input::placeholder {
    color: var(--gray-400);
}

.modal-btn-full {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    background: var(--secondary);
    color: white;
    transition: background 0.15s;
}

.modal-btn-full:hover {
    background: var(--secondary-dark);
}

.modal-subtext {
    text-align: center;
    font-size: 12px;
    color: var(--gray-500);
    margin-top: var(--sp-3);
}

/* ---- Animations ---- */

.fade-in {
    animation: fadeIn 0.4s ease forwards;
    opacity: 0;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.4s ease forwards;
    opacity: 0;
    transform: translateY(12px);
}

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Breadcrumb ---- */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--gray-500);
    padding: 0 var(--sp-4);
    margin-bottom: var(--sp-3);
}

.breadcrumb a {
    color: var(--gray-500);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--secondary);
}

.breadcrumb .sep {
    color: var(--gray-400);
}

/* ---- Screen nav strip ---- */

.screen-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--gray-200);
    padding: var(--sp-2) var(--sp-3);
    display: flex;
    justify-content: center;
    gap: var(--sp-2);
    z-index: 100;
    font-size: 12px;
}

.screen-nav a {
    padding: 4px 10px;
    border-radius: 4px;
    text-decoration: none;
    color: var(--gray-600);
    background: var(--gray-100);
    transition: all 0.15s;
}

.screen-nav a:hover {
    background: var(--gray-200);
}

.screen-nav a.active {
    background: var(--primary);
    color: white;
}

/* ---- Webpage preview ---- */

.webpage-preview {
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
    margin-top: var(--sp-2);
}

.webpage-preview__bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--gray-100);
    font-size: 11px;
    color: var(--gray-500);
}

.webpage-preview__dots {
    display: flex;
    gap: 4px;
}

.webpage-preview__dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-300);
}

.webpage-preview__body {
    padding: var(--sp-3);
    background: white;
    min-height: 80px;
    font-size: 12px;
    color: var(--gray-600);
}

/* ---- Split layout (Screen 3+) ---- */

.split-layout {
    display: flex;
    height: calc(100vh - 110px);
    gap: 0;
}

.split-left {
    flex: 0 0 55%;
    overflow-y: auto;
    border-right: 1px solid var(--gray-200);
    background: white;
    padding: var(--sp-4);
}

.split-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--gray-50);
}

/* Padding for bottom nav */
body {
    padding-bottom: 44px;
}
