/**
 * Guide UI Components
 *
 * Renders live UI examples within support guides.
 * Uses actual TinyTax styling so components match the real interface.
 */

/* Container for UI examples */
.guide-ui {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--warm-50);
    border: 1px solid var(--warm-200);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.guide-ui-inline {
    display: inline-flex;
    margin: 0 0.25rem;
    padding: 0;
    background: transparent;
    border: none;
}

/* Field components */
.guide-ui-field {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    max-width: 300px;
}

.guide-ui-field .form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--navy);
}

.guide-ui-field .form-input,
.guide-ui-field .form-select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--warm-200);
    border-radius: 6px;
    background: white;
    font-size: 0.875rem;
    color: var(--navy);
}

.guide-ui-field .form-input.text-right {
    text-align: right;
}

.guide-ui-field .form-checkbox,
.guide-ui-field .form-radio {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--navy);
    cursor: default;
}

.guide-ui-field .form-checkbox input,
.guide-ui-field .form-radio input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--green);
}

/* Button components - use actual button styles */
.guide-ui button.btn {
    cursor: default;
}

/* Alert components */
.guide-ui .alert {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    width: 100%;
}

.guide-ui .alert-icon {
    font-weight: bold;
    font-size: 1rem;
}

.guide-ui .alert-success {
    background: var(--primary-50);
    color: var(--primary-700);
    border: 1px solid var(--green);
}

.guide-ui .alert-error {
    background: var(--error-light);
    color: #991b1b;
    border: 1px solid var(--error);
}

.guide-ui .alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border: 1px solid var(--warning);
}

.guide-ui .alert-info {
    background: var(--info-light);
    color: #1e40af;
    border: 1px solid var(--info);
}

/* Badge components */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-paying {
    background: #d1fae5;
    color: #065f46;
}

.badge-charter {
    background: #fef3c7;
    color: #92400e;
}

.badge-free {
    background: var(--warm-100);
    color: var(--warm-600);
}

.badge-new {
    background: #dbeafe;
    color: #1e40af;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

/* Section header component - matches actual form styling */
.guide-ui-section {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
}

.guide-ui-section .section-header {
    border-bottom: 2px solid var(--green);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.guide-ui-section .section-title {
    color: var(--navy);
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

/* Navigation/breadcrumb component */
.guide-ui-nav {
    background: transparent;
    border: none;
    padding: 0;
}

.guide-ui-nav .breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.guide-ui-nav .nav-item {
    color: var(--green);
}

.guide-ui-nav .nav-separator {
    color: var(--warm-400);
}

.guide-ui-nav .nav-current {
    color: var(--warm-600);
    font-weight: 500;
}

/* Status components */
.status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-success {
    background: #d1fae5;
    color: #065f46;
}

.status-success::before {
    background: #10b981;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-pending::before {
    background: #f59e0b;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
}

.status-error::before {
    background: #ef4444;
}

.status-draft {
    background: var(--warm-100);
    color: var(--warm-600);
}

.status-draft::before {
    background: var(--warm-400);
}

/* Link component - styled like actual links */
.guide-link {
    color: var(--green);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Card component */
.guide-ui-card {
    padding: 0;
    background: transparent;
    border: none;
}

.guide-ui-card .card {
    background: white;
    border: 1px solid var(--warm-200);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.guide-ui-card .card-title {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--navy);
}

.guide-ui-card .card-description {
    margin: 0;
    font-size: 0.875rem;
    color: var(--warm-600);
}

/* Responsive */
@media (max-width: 600px) {
    .guide-ui-field {
        max-width: 100%;
    }
}

/* ==========================================================================
   Form Preview Components

   Renders realistic previews of TinyTax form sections within support guides.
   Matches actual form styling so users see exactly what they'll encounter.
   ========================================================================== */

/* Base container for all form previews */
.guide-form {
    margin: 1.5rem 0;
    padding: 1.25rem;
    background: white;
    border: 1px solid var(--warm-200);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Form section header - matches actual TinyTax form headers */
.guide-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--green);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.guide-form-header h4 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--navy);
}

.guide-form-btn-import {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--green);
    background: transparent;
    border: 1px solid var(--green);
    border-radius: 4px;
    cursor: default;
}

.guide-form-toggle {
    font-size: 0.75rem;
    color: var(--green);
    text-decoration: none;
    cursor: default;
}

/* Caption text below form previews */
.guide-form-caption {
    margin: 1rem 0 0 0;
    padding-top: 0.75rem;
    border-top: 1px solid var(--warm-100);
    font-size: 0.8125rem;
    color: var(--warm-500);
    font-style: italic;
}

/* ==========================================================================
   Balance Sheet / P&L Table Styles
   ========================================================================== */

.guide-form-bs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.guide-form-bs-table thead th {
    padding: 0.5rem 0.25rem;
    text-align: left;
    font-weight: 500;
    color: var(--warm-600);
    border-bottom: 1px solid var(--warm-200);
}

.guide-form-bs-table .year-header {
    text-align: center;
    font-size: 0.75rem;
    line-height: 1.3;
}

.guide-form-bs-table .year-date {
    font-weight: 600;
    color: var(--navy);
}

.guide-form-bs-table .paren-col {
    width: 12px;
    text-align: center;
    padding: 0 2px;
}

.guide-form-bs-table tbody td {
    padding: 0.375rem 0.25rem;
    color: var(--navy);
    border-bottom: 1px solid var(--warm-100);
}

.guide-form-bs-table tbody td:first-child {
    padding-right: 1rem;
}

.guide-form-bs-table .paren {
    color: var(--warm-500);
    font-weight: 500;
    text-align: center;
    vertical-align: middle;
}

.guide-form-bs-table .value-cell {
    width: 90px;
    text-align: right;
}

.guide-form-bs-table .value-cell input {
    width: 100%;
    padding: 0.375rem 0.5rem;
    text-align: right;
    font-size: 0.875rem;
    color: var(--navy);
    background: var(--warm-50);
    border: 1px solid var(--warm-200);
    border-radius: 4px;
}

.guide-form-bs-table .value-cell input.readonly-bold {
    font-weight: 600;
    background: var(--warm-100);
}

.guide-form-bs-table .indent {
    padding-left: 1.5rem !important;
}

.guide-form-bs-table tr.subtotal td {
    border-bottom: 1px solid var(--warm-300);
}

.guide-form-bs-table tr.total td {
    border-bottom: 2px solid var(--navy);
}

.guide-form-bs-table tr.total td:first-child,
.guide-form-bs-table tr.subtotal td:first-child {
    font-weight: 600;
}

.guide-form-bs-table tr.section-gap td {
    padding: 0.75rem 0;
    border-bottom: none;
}

/* Box number badges - matches actual form styling */
.guide-form .box-number,
.guide-form-bs-table .box-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    margin-right: 0.5rem;
    font-family: monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--navy);
    background: var(--primary-50);
    border: 1px solid var(--green);
    border-radius: 3px;
    vertical-align: middle;
}

/* ==========================================================================
   Company Type Selector Styles
   ========================================================================== */

.guide-form-selector {
    padding: 1.5rem;
}

.guide-form-description {
    margin: 0 0 1.25rem 0;
    color: var(--warm-600);
    font-size: 0.9375rem;
}

.guide-form-type-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.guide-form-type-option {
    flex: 1;
    min-width: 140px;
    cursor: default;
}

.guide-form-type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.guide-form-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1rem;
    background: var(--warm-50);
    border: 2px solid var(--warm-200);
    border-radius: 8px;
    text-align: center;
    transition: all 0.15s ease;
}

.guide-form-type-option input[type="radio"]:checked + .guide-form-type-card {
    background: var(--primary-50);
    border-color: var(--green);
}

.guide-form-type-icon {
    width: 32px;
    height: 32px;
    color: var(--warm-500);
}

.guide-form-type-option input[type="radio"]:checked + .guide-form-type-card .guide-form-type-icon {
    color: var(--green);
}

.guide-form-type-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--navy);
}

/* ==========================================================================
   Tax Declaration Fields Styles
   ========================================================================== */

.guide-form-fields {
    padding: 1.5rem;
}

.guide-form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.guide-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.guide-form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--navy);
}

.guide-form-label .required {
    color: var(--error);
    margin-left: 0.125rem;
}

.guide-form-input,
.guide-form-select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    color: var(--navy);
    background: white;
    border: 1px solid var(--warm-200);
    border-radius: 6px;
}

.guide-form-input:read-only,
.guide-form-select:disabled {
    background: var(--warm-50);
    cursor: default;
}

/* ==========================================================================
   Tax Computation Table Styles
   ========================================================================== */

.guide-form-computation {
    padding: 1.25rem;
}

.guide-form-subheader {
    margin: 1.25rem 0 0.75rem 0;
    padding-top: 1rem;
    border-top: 1px solid var(--warm-200);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--navy);
}

.guide-form-computation-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.guide-form-computation-table td {
    padding: 0.5rem 0.25rem;
    color: var(--navy);
    border-bottom: 1px solid var(--warm-100);
}

.guide-form-computation-table td:first-child {
    width: 70%;
}

.guide-form-computation-table .value-cell {
    width: 30%;
    text-align: right;
    white-space: nowrap;
}

.guide-form-computation-table .value-cell input {
    width: 100px;
    padding: 0.375rem 0.5rem;
    text-align: right;
    font-size: 0.875rem;
    color: var(--navy);
    background: var(--warm-50);
    border: 1px solid var(--warm-200);
    border-radius: 4px;
}

.guide-form-computation-table .value-cell input.readonly-bold {
    font-weight: 600;
    background: var(--warm-100);
}

.guide-form-computation-table .value-cell input.tax-total {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--green);
    background: var(--primary-50);
    border-color: var(--green);
}

.guide-form-computation-table .value-cell .paren {
    color: var(--warm-500);
    font-weight: 500;
}

.guide-form-computation-table .indent {
    padding-left: 1.5rem;
}

.guide-form-computation-table tr.divider td {
    border-bottom: 1px solid var(--warm-300);
}

.guide-form-computation-table tr.total td {
    border-bottom: 2px solid var(--navy);
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 768px) {
    .guide-form-row {
        grid-template-columns: 1fr;
    }

    .guide-form-type-options {
        flex-direction: column;
    }

    .guide-form-type-option {
        min-width: 100%;
    }

    .guide-form-bs-table {
        font-size: 0.8125rem;
    }

    .guide-form-bs-table .value-cell {
        width: 70px;
    }

    .guide-form-bs-table .value-cell input {
        padding: 0.25rem 0.375rem;
        font-size: 0.8125rem;
    }
}

@media (max-width: 480px) {
    .guide-form {
        padding: 1rem;
        margin-left: -0.5rem;
        margin-right: -0.5rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .guide-form-header h4 {
        font-size: 1rem;
    }

    .guide-form-bs-table .year-header {
        font-size: 0.6875rem;
    }

    .guide-form-computation-table .value-cell input {
        width: 80px;
    }
}

/* ==========================================================================
   Interactive Company Type Selector

   Allows users to toggle between trading/property views in guides.
   Mirrors the submission form's company type card-style UI.
   ========================================================================== */

.guide-company-type-selector {
    margin: 1.5rem 0;
    padding: 1.25rem;
    background: var(--primary-50);
    border: 2px solid var(--green);
    border-radius: 8px;
}

.guide-selector-header {
    margin-bottom: 1rem;
}

.guide-selector-label {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--navy);
}

/* Card-style radio options - matches submission form exactly */
.guide-type-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.guide-type-option {
    cursor: pointer;
    display: block;
}

.guide-type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.guide-type-card {
    background: white;
    border: 2px solid var(--warm-200);
    border-radius: 8px;
    padding: 1rem 0.75rem;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-height: 90px;
    justify-content: center;
}

.guide-type-option:hover .guide-type-card {
    border-color: var(--green);
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.guide-type-option input[type="radio"]:checked + .guide-type-card,
.guide-type-card.selected {
    border-color: var(--green);
    background: white;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.guide-type-icon {
    width: 32px;
    height: 32px;
    color: var(--green);
    stroke-width: 2;
}

.guide-type-label {
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--navy);
}

/* Conditional content blocks */
.guide-conditional {
    /* Default visible - JS will hide non-matching */
}

/* Conditional content - JS controls visibility via is-hidden class */
.guide-conditional.is-hidden {
    display: none;
}

/* Responsive */
@media (max-width: 480px) {
    .guide-type-options {
        grid-template-columns: 1fr;
    }

    .guide-type-card {
        flex-direction: row;
        justify-content: flex-start;
        padding: 1rem 1.5rem;
        min-height: auto;
    }

    .guide-type-icon {
        width: 24px;
        height: 24px;
    }

    .guide-type-label {
        text-align: left;
    }
}
