@import url('fonts.css');

:root {
    --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

body {
    font-family: var(--font-family-base);
}

/* ==========================================================================
   Button Styles
   ========================================================================== */

/* Base button style */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    /* Vertical padding for ~44px touch target */
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: 2px solid transparent;
    /* Added for consistent height with outline button */
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
    min-height: 44px;
    /* Explicit height for touch target */
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}


/* Color Variants */

/* Primary action button (green) */
.btn-primary {
    background-color: var(--primary-green);
    color: var(--white);
    border-color: var(--primary-green);
}

.btn-primary:hover {
    background-color: #3da863;
    /* Darken */
}

/* Outline button */
.btn-outline {
    background-color: transparent;
    border-color: var(--primary-green);
    color: var(--primary-green);
}

.btn-outline:hover {
    background-color: var(--primary-green);
    color: var(--white);
}

/* Auth pages button (purple gradient) */
.btn-auth {
    width: 100%;
    padding: 12px 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 16px;
    font-weight: 600;
    border: none;
}

.btn-auth:hover {
    filter: brightness(95%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   Component: Badges
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    white-space: nowrap;
}

/* Status Variants */
.badge-success {
    background: rgba(77, 178, 118, 0.15);
    color: var(--primary-green);
}

.badge-warning {
    background: rgba(255, 165, 0, 0.15);
    color: #d97706;
}

/* Evaluating - Light Orange */
.badge-neutral {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

/* Ignored/Draft */
.badge-purple {
    background: rgba(118, 77, 178, 0.15);
    color: var(--primary-purple);
}

/* Exited */


/* ==========================================================================
   Component: Stat Grid
   ========================================================================== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    padding: 16px 0;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--medium-gray);
    text-transform: uppercase;
    font-weight: 600;
}

.stat-value {
    font-size: 18px;
    color: var(--dark-gray);
    font-weight: 700;
}


/* ==========================================================================
   Component: Form Groups & Layouts
   ========================================================================== */
.form-group-section {
    background: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.form-group-header {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
    color: var(--dark-gray);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.form-grid-2,
.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .form-grid-2 {
        grid-template-columns: 1fr 1fr;
    }

    .form-grid-3 {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-prefix {
    position: absolute;
    left: 12px;
    color: var(--medium-gray);
    font-weight: 500;
}

/* Higher specificity to override .form-field input */
.form-field .input-group input {
    padding-left: 32px;
    /* Space for prefix */
}

/* Remove up/down arrows from number inputs */
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
input[type=number] {
    -moz-appearance: textfield;
}


.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-field label {
    font-weight: 500;
    color: var(--dark-gray);
    font-size: 14px;
}

.form-field input,
.form-field select,
.form-field textarea {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--primary-purple);
    outline: none;
    box-shadow: 0 0 0 3px rgba(118, 77, 178, 0.1);
}

.form-field small {
    color: var(--medium-gray);
    font-size: 12px;
}


/* ==========================================================================
   Component: Disclosure / Accordion
   ========================================================================== */
.disclosure-row {
    border-top: 1px solid var(--border-color);
    padding: 16px 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
    margin-top: 16px;
}

.disclosure-row:hover,
.disclosure-row.disclosure-open {
    background-color: rgba(118, 77, 178, 0.05);
    /* Subtle Purple */
    margin-left: -24px;
    margin-right: -24px;
    padding-left: 24px;
    padding-right: 24px;
    /* Negative margin/padding trick to fill full width on hover if inside padded card */
}

.disclosure-row.disclosure-open {
    padding-bottom: 8px;
}

.disclosure-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark-gray);
    display: flex;
    align-items: center;
    gap: 8px;
}

.disclosure-icon {
    color: var(--medium-gray);
    font-size: 12px;
    transition: transform 0.3s ease;
}

.disclosure-content {
    display: none;
    margin-top: 0;
    font-size: 14px;
    color: var(--dark-gray);
    line-height: 1.6;
    white-space: pre-wrap;
    background: #fff;
    padding-bottom: 16px;
    padding-top: 0;
}

.disclosure-open .disclosure-icon {
    transform: rotate(180deg);
}

.disclosure-open+.disclosure-content {
    display: block;
}


/* ==========================================================================
   Helpers
   ========================================================================== */
.text-muted {
    color: var(--medium-gray);
}

.text-small {
    font-size: 14px;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mt-2 {
    margin-top: 8px !important;
}

.d-flex {
    display: flex;
}

.gap-2 {
    gap: 8px;
}

.align-center {
    align-items: center;
}


/* ==========================================================================
   Component: Property Hero
   ========================================================================== */
.property-hero {
    margin-bottom: 24px;
}

.property-hero-body {
    background: #fff;
    padding: 24px;
}

.property-hero-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
}

.property-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.property-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark-gray);
    margin: 0;
}

.property-meta-row {
    font-size: 14px;
    color: var(--medium-gray);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.property-meta-divider {
    color: var(--border-color);
}

.property-links-row {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.property-link {
    color: var(--primary-green);
    text-decoration: none;
    font-weight: 500;
}

.property-hero-divider {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 0 0 20px 0;
}

.property-context-row {
    display: flex;
    gap: 32px;
    margin-bottom: 24px;
    font-size: 14px;
}

.property-context-item {
    display: flex;
    gap: 8px;
}

.property-context-label {
    font-weight: 600;
    color: var(--dark-gray);
}

.property-context-value-accent {
    color: var(--primary-purple);
}

.property-context-value {
    color: var(--dark-gray);
}

.property-date-footer {
    text-align: right;
    font-size: 12px;
    color: var(--medium-gray);
    margin-bottom: 20px;
}


/* ==========================================================================
   Component: Version Cards
   ========================================================================== */
.version-cards-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px;
}

.version-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid var(--border-color);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
}

.version-card:hover {
    border-color: var(--primary-purple);
    box-shadow: 0 4px 12px rgba(118, 77, 178, 0.2);
    transform: translateY(-2px);
}

.version-card-header {
    padding: 20px 24px;
    background: rgba(118, 77, 178, 0.05);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.version-card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark-gray);
    display: flex;
    align-items: center;
    gap: 12px;
}

.final-badge {
    background: var(--primary-green);
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.version-hint {
    font-size: 12px;
    color: var(--primary-purple);
    font-style: italic;
    margin-left: 12px;
}

.version-metadata {
    font-size: 14px;
    color: var(--medium-gray);
}

.version-card-body {
    padding: 24px;
}

/* Quick Analysis Scores */
.quick-analysis-scores {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.score-item {
    flex: 1;
    min-width: 150px;
    text-align: center;
}

.score-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.score-title {
    font-size: 12px;
    color: var(--medium-gray);
    line-height: 1.4;
}

.score-divider {
    width: 1px;
    height: 60px;
    background: var(--border-color);
}

.no-analysis-message {
    text-align: center;
    color: var(--medium-gray);
    font-style: italic;
    padding: 20px;
}

/* Responsive Styles for Version Cards */
@media (max-width: 767px) {
    .quick-analysis-scores {
        flex-direction: column;
        gap: 16px;
    }

    .score-divider {
        width: 100%;
        height: 1px;
    }

    .version-card-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ==========================================================================
   Component: Metric & Search Highlights
   ========================================================================== */
.text-match {
    background-color: #fff3cd;
    /* Light yellow */
    color: var(--dark-gray);
    border-radius: 2px;
    padding: 0 2px;
}

/* Metric Highlights for Filters */
.metric-highlight-success {
    color: var(--primary-green) !important;
    font-weight: 800 !important;
}

.metric-highlight-warning {
    color: #d97706 !important;
    /* Matches badge-warning text */
    font-weight: 800 !important;
}

.metric-highlight-neutral {
    color: #6b7280 !important;
    /* Matches badge-neutral text */
    font-weight: 800 !important;
}

.metric-highlight-purple {
    color: var(--primary-purple) !important;
    font-weight: 800 !important;
}

/* ==========================================================================
   Component: Complex List Item (Two-Row)
   ========================================================================== */
.list-item-complex {
    display: flex;
    flex-direction: column;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: #fff;
    transition: background-color 0.2s;
    gap: 12px;
    text-decoration: none;
    /* In case it's a link itself */
}

.list-item-complex:last-child {
    border-bottom: none;
}

.list-item-complex:hover {
    background-color: #f9fafb;
}

.list-item-row-primary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.list-item-row-secondary {
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
}

.list-item-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-gray);
    margin-right: 8px;
    text-decoration: none;
}

.list-item-company {
    font-size: 14px;
    color: var(--medium-gray);
}

.list-item-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--medium-gray);
    margin-top: 4px;
}

.list-item-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Mini stat grid for list items */
.mini-stat-group {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.mini-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.mini-stat-label {
    text-transform: uppercase;
    font-size: 11px;
    color: var(--medium-gray);
    font-weight: 600;
}

.mini-stat-value {
    font-weight: 600;
    color: var(--dark-gray);
}

/* ==========================================================================
   Component: Resource Card (Compact Style)
   ========================================================================== */
.resource-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 16px 20px;
    /* Reduced vertical padding */
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    display: block;
    color: inherit;
    width: 100%;
    position: relative;
}

.resource-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    background-color: #fbf9fd;
    /* Brand Purple Tint */
    border-color: #e8daef;
    /* Subtle purple border */
}

/* Row 1: Identity & Contact */
.resource-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    position: relative;
    padding-right: 24px;
    /* Space for chevron */
}

.resource-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark-gray);
    line-height: 1.2;
}

.resource-contact-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--medium-gray);
}

.resource-contact-item svg {
    color: var(--border-color);
    /* Subtle icons */
}

.resource-company {
    font-size: 13px;
    color: var(--medium-gray);
    font-style: italic;
    opacity: 0.8;
}

.resource-chevron {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-green);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.resource-card:hover .resource-chevron {
    opacity: 1;
    transform: translateY(-50%) translateX(4px);
}

/* Row 2: Wide Metrics - Full Width Grid */
.resource-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f0f0f0;
    padding-top: 8px;
    margin-top: 8px;
    width: 100%;
}

.resource-metrics-wide {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    /* Allow wrapping on mobile */
}

.resource-metric-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    min-width: 0;
}

/* Mobile Responsiveness for Metrics */
@media (max-width: 768px) {
    .resource-metrics-wide {
        justify-content: flex-start;
        /* Align left for wrapped items */
        gap: 8px 12px;
        /* Row Gap 8px, Col Gap 12px */
    }

    .resource-metric-block {
        flex: 0 0 calc(25% - 9px);
        /* 4 items per row (approx) */
        min-width: auto;
    }
}

.resource-metric-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--medium-gray);
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
}

.resource-metric-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark-gray);
    /* Default matches label darkness */
    line-height: 1.2;
    padding: 2px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

/* Conditional Filters Backgrounds */
.metric-bg-success {
    background-color: #d4edda;
    color: #155724;
}

.metric-bg-warning {
    background-color: #fff3cd;
    color: #856404;
}

.metric-bg-purple {
    background-color: #e8daef;
    color: #6c3483;
}

/* Financials always Green if positive */
.metric-val-money {
    color: var(--primary-green) !important;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.5px;
}

/* Ignored Metric - De-emphasized */
.metric-val-ignored {
    color: #adb5bd !important;
    /* Light Gray */
    font-weight: 500;
}

/* Utility: Action Link (Green) */
.action-link {
    color: var(--primary-green);
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.action-link:hover {
    opacity: 0.8;
}

/* Form Controls Polish */
select {
    cursor: pointer;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--dark-gray);
    width: 100%;
    transition: all 0.2s ease;

    /* Custom Arrow */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px !important;
    appearance: none;
    -webkit-appearance: none;
}

select:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(77, 178, 118, 0.1);
}

/* Sticky Header for Mobile */
@media (max-width: 768px) {
    [data-component="search-filter-section"] {
        position: sticky;
        top: 0;
        z-index: 99;
        background: #f8f9fa;
        /* Matches page background */
        padding: 12px 0;
        margin-top: -12px;
        /* Pull up to cover gap */
    }
}

/* ==========================================================================
   Phase 2: Visual Polish (Dashboard Enhancements)
   ========================================================================== */

/* Card Icons */
.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    background: #f0fdf4;
    color: var(--primary-green);
}

.card-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 2px;
}

.card-icon.icon-purple {
    background: #f3e8ff;
    color: var(--primary-purple);
}