/* Font loaded via link preload in HTML for better performance */

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: #f8f9fa;
    min-height: 100vh;
    line-height: 1.6;
    color: #2d3748;
}

.embed-container {
    padding: 16px;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    padding: 32px;
    text-align: center;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.header p {
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

.content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    padding: 32px;
}

/* Input Section Styling */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.input-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-field label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

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

.input-with-unit input {
    width: 100%;
    padding: 12px 16px;
    padding-right: 60px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    background: #f9fafb;
    color: #1f2937;
}

.input-with-unit input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: white;
}

.input-with-unit .unit {
    position: absolute;
    right: 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
}

/* Button Selectors */
.selector-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.selector-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.button-selectors {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.selector-btn {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.selector-btn:hover {
    border-color: #d1d5db;
    background: #f3f4f6;
}

.selector-btn.active {
    background: #ede9fe;
    border-color: #c4b5fd;
    color: #6b46c1;
    font-weight: 600;
}

/* Rate Indicator */
.rate-indicator {
    margin-top: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
}

.rate-indicator.excellent {
    background: #dcfce7;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.rate-indicator.good {
    background: #dbeafe;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.rate-indicator.acceptable {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #fed7aa;
}

.rate-indicator.needs-work {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* Dropdown Groups */
.dropdown-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dropdown-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

/* Custom Dropdown Component */
.custom-dropdown-group {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.custom-dropdown-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0;
}

.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-trigger {
    width: 100%;
    padding: 12px 16px;
    padding-right: 40px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dropdown-trigger:hover {
    border-color: #d1d5db;
    background: #f9fafb;
}

.dropdown-trigger:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.dropdown-trigger[aria-expanded="true"] {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.dropdown-trigger[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-arrow {
    color: #6b7280;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.dropdown-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    margin-top: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    max-height: 280px;
    overflow-y: auto;
}

.custom-dropdown[data-open="true"] .dropdown-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.dropdown-option:hover {
    background: #f3f4f6;
}

.dropdown-option:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.dropdown-option:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.dropdown-option.selected {
    background: #ede9fe;
    color: #6b46c1;
    font-weight: 600;
}

.dropdown-option.selected:hover {
    background: #ddd6fe;
}

.checkmark {
    color: #8b5cf6;
    opacity: 0;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}

.dropdown-option.selected .checkmark {
    opacity: 1;
}

.option-text {
    flex: 1;
    text-align: left;
}

/* Components Section */
.components-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.components-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #8b5cf6;
}

.components-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.components-list li {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
}

.standards-note {
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
}

.standards-note span {
    font-size: 0.75rem;
    color: #059669;
    font-weight: 500;
}

/* Bidding Strategy Card */
.bidding-strategy-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    background: #fefbf3;
    border: 1px solid #f59e0b;
    border-radius: 12px;
    margin-top: 16px;
}

.bidding-strategy-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #92400e;
    margin: 0 0 8px 0;
}

.bidding-metrics {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #fde68a;
}

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

.metric-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #92400e;
}

.metric-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #78350f;
    text-align: right;
}

.strategy-note {
    padding: 12px 16px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    font-size: 0.75rem;
    color: #92400e;
    text-align: center;
}

/* Results Section */
.results-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Primary Result Card */
.primary-result-card {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    border-radius: 16px;
    padding: 24px;
    color: white;
    text-align: center;
}

.result-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-type {
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.9;
}

.result-title {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.result-subtitle {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.9;
}

.result-description {
    font-size: 0.875rem;
    font-weight: 400;
    opacity: 0.8;
}

/* Result Cards Grid */
.result-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.result-card.secondary {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}

.result-card.secondary:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #d1d5db;
}

.result-card.secondary h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f3f4f6;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}

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

.result-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.result-value {
    font-size: 0.875rem;
    color: #1f2937;
    font-weight: 600;
    text-align: right;
}

.total-row {
    border-top: 2px solid #8b5cf6;
    padding-top: 12px;
    margin-top: 8px;
    font-weight: 700;
}

.total-row .result-label {
    color: #8b5cf6;
    font-weight: 700;
}

.total-row .result-value {
    color: #8b5cf6;
    font-weight: 700;
    font-size: 1rem;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.copy-btn {
    background: #8b5cf6;
    color: white;
}

.copy-btn:hover {
    background: #7c3aed;
}

.share-btn {
    background: #3b82f6;
    color: white;
}

.share-btn:hover {
    background: #2563eb;
}

.print-btn {
    background: #6b7280;
    color: white;
}

.print-btn:hover {
    background: #4b5563;
}

/* Disclaimer */
.disclaimer {
    font-size: 0.75rem;
    color: #9ca3af;
    text-align: center;
    line-height: 1.4;
    margin-top: 16px;
}

/* Warning */
.warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
    padding: 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
}

.footer {
    background: #8b5cf6;
    color: white;
    text-align: center;
    padding: 24px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .embed-container {
        padding: 8px;
    }
    
    .container {
        border-radius: 12px;
    }
    
    .header {
        padding: 24px 16px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .content {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 16px;
    }
    
    .input-section {
        order: 1;
    }
    
    .results-section {
        order: 2;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .result-title {
        font-size: 2rem !important;
    }
    
    .result-cards-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .embed-container {
        padding: 4px;
    }
    
    .header h1 {
        font-size: 1.25rem;
    }
    
    .header p {
        font-size: 0.875rem;
    }
    
    .content {
        padding: 12px;
    }
    
    .button-selectors {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    .selector-btn {
        padding: 10px 12px;
        font-size: 0.75rem;
    }
    
    .result-title {
        font-size: 1.75rem !important;
    }
}

/* Print Styles - Optimized for single page PDF */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    @page {
        margin: 1in;
        size: letter;
    }
    
    body {
        font-size: 9pt;
        line-height: 1.2;
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .embed-container {
        padding: 0 !important;
        min-height: auto !important;
    }
    
    .container {
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        background: white !important;
        overflow: visible !important;
    }
    
    .header {
        padding: 6pt 0 4pt 0 !important;
        background: white !important;
        text-align: center;
        page-break-after: avoid;
    }
    
    .header h1 {
        font-size: 16pt !important;
        font-weight: 700 !important;
        color: #1f2937 !important;
        margin: 0 0 2pt 0 !important;
    }
    
    .header p {
        font-size: 9pt !important;
        color: #6b7280 !important;
        margin: 0 0 4pt 0 !important;
    }
    
    .content {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 6pt !important;
        padding: 2pt !important;
        margin: 0 !important;
    }
    
    /* Hide interactive and non-essential elements */
    .action-buttons,
    .warning,
    .dropdown-panel,
    .dropdown-arrow,
    .bidding-strategy-card,
    .components-section,
    .footer {
        display: none !important;
    }
    
    /* Style input sections for print */
    .input-section {
        display: flex !important;
        flex-direction: column !important;
        gap: 4pt !important;
    }
    
    .input-field {
        display: flex !important;
        flex-direction: column !important;
        gap: 3pt !important;
    }
    
    .input-field label {
        font-size: 9pt !important;
        font-weight: 600 !important;
        color: #374151 !important;
        margin: 0 !important;
    }
    
    .input-with-unit {
        display: flex !important;
        align-items: center !important;
    }
    
    .input-with-unit input {
        width: 100% !important;
        padding: 4pt 6pt !important;
        border: 0.5pt solid #e5e7eb !important;
        border-radius: 2pt !important;
        font-size: 9pt !important;
        font-weight: 600 !important;
        background: #f9fafb !important;
        color: #1f2937 !important;
    }
    
    .input-with-unit .unit {
        font-size: 8pt !important;
        color: #6b7280 !important;
        margin-left: 2pt !important;
    }
    
    .selector-group {
        display: flex !important;
        flex-direction: column !important;
        gap: 3pt !important;
    }
    
    .selector-group label {
        font-size: 9pt !important;
        font-weight: 600 !important;
        color: #374151 !important;
        margin: 0 !important;
    }
    
    .button-selectors {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 2pt !important;
    }
    
    .selector-btn {
        display: block !important;
        padding: 4pt 6pt !important;
        border: 0.5pt solid #e5e7eb !important;
        border-radius: 2pt !important;
        background: #f9fafb !important;
        color: #374151 !important;
        font-size: 8pt !important;
        font-weight: 500 !important;
        text-align: center !important;
    }
    
    .selector-btn.active {
        background: #ede9fe !important;
        border-color: #c4b5fd !important;
        color: #6b46c1 !important;
        font-weight: 600 !important;
    }
    
    .rate-indicator {
        padding: 2pt 4pt !important;
        border-radius: 2pt !important;
        text-align: center !important;
        font-size: 7pt !important;
        font-weight: 600 !important;
        margin-top: 3pt !important;
    }
    
    .custom-dropdown-group {
        display: flex !important;
        flex-direction: column !important;
        gap: 1pt !important;
    }
    
    .custom-dropdown-group label {
        font-size: 6pt !important;
        font-weight: 600 !important;
        color: #374151 !important;
        margin: 0 !important;
    }
    
    .dropdown-trigger {
        display: block !important;
        width: 100% !important;
        padding: 4pt 6pt !important;
        border: 0.5pt solid #e5e7eb !important;
        border-radius: 2pt !important;
        background: white !important;
        color: #374151 !important;
        font-size: 8pt !important;
        font-weight: 500 !important;
        text-align: left !important;
    }
    
    
    .results-section {
        display: flex !important;
        flex-direction: column !important;
        gap: 4pt !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .primary-result-card {
        background: #8b5cf6 !important;
        color: white !important;
        border-radius: 4pt !important;
        padding: 8pt !important;
        text-align: center;
        margin-bottom: 6pt !important;
        page-break-inside: avoid;
    }
    
    .result-type {
        font-size: 8pt !important;
        font-weight: 500 !important;
        opacity: 0.9;
        margin: 0 0 2pt 0 !important;
    }
    
    .result-title {
        font-size: 18pt !important;
        font-weight: 700 !important;
        line-height: 1.1 !important;
        margin: 2pt 0 !important;
    }
    
    .result-subtitle {
        font-size: 10pt !important;
        font-weight: 500 !important;
        opacity: 0.9;
        margin: 2pt 0 0 0 !important;
    }
    
    .result-description {
        display: none !important;
    }
    
    .result-cards-grid {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 4pt !important;
        margin: 0 !important;
        grid-column: 1 / -1 !important;
    }
    
    .result-card.secondary {
        background: white !important;
        border: 0.5pt solid #e5e7eb !important;
        border-radius: 3pt !important;
        padding: 6pt !important;
        box-shadow: none !important;
        page-break-inside: avoid;
        margin: 0 !important;
        width: calc(50% - 2pt) !important;
    }
    
    .result-card.secondary h4 {
        font-size: 9pt !important;
        font-weight: 600 !important;
        color: #6b7280 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.01em !important;
        margin: 0 0 6pt 0 !important;
        padding: 0 0 3pt 0 !important;
        border-bottom: 0.5pt solid #f3f4f6 !important;
    }
    
    .result-row {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 3pt 0 !important;
        border-bottom: 0.5pt solid #f9fafb !important;
        page-break-inside: avoid;
    }
    
    .result-row:last-child {
        border-bottom: none !important;
    }
    
    .result-label {
        font-size: 9pt !important;
        color: #6b7280 !important;
        font-weight: 500 !important;
        line-height: 1.2 !important;
    }
    
    .result-value {
        font-size: 9pt !important;
        color: #1f2937 !important;
        font-weight: 600 !important;
        text-align: right !important;
        line-height: 1.2 !important;
    }
    
    .total-row {
        border-top: 1pt solid #8b5cf6 !important;
        padding-top: 4pt !important;
        margin-top: 4pt !important;
        font-weight: 700 !important;
    }
    
    .total-row .result-label {
        color: #8b5cf6 !important;
        font-weight: 700 !important;
        font-size: 9pt !important;
    }
    
    .total-row .result-value {
        color: #8b5cf6 !important;
        font-weight: 700 !important;
        font-size: 10pt !important;
    }
    
    .disclaimer {
        font-size: 7pt !important;
        color: #9ca3af !important;
        text-align: center !important;
        line-height: 1.2 !important;
        margin: 2pt 0 0 0 !important;
        page-break-inside: avoid;
    }
    

    .footer {
        background: #8b5cf6 !important;
        color: white !important;
        text-align: center !important;
        padding: 4pt !important;
        font-size: 8pt !important;
        font-weight: 500 !important;
        margin-top: 4pt !important;
        border-radius: 2pt !important;
    }
    
    /* Targeted page break controls - only on critical components */
    .primary-result-card,
    .header {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    
    /* Allow secondary cards to break for better compression */
    .result-card.secondary {
        page-break-inside: auto;
        break-inside: auto;
    }
    
    /* Failsafe autoscaling to guarantee single-page fit */
    body {
        transform: scale(0.95);
        transform-origin: top left;
        width: calc(100% / 0.95);
    }
}