/* Thailandinfo Visumguide v1.2.0 - shared styles */

.tvg-wrapper {
    --tvg-red: #A51931;
    --tvg-red-dark: #841325;
    --tvg-navy: #2D2A4A;
    --tvg-navy-light: #3d3a5f;
    --tvg-light: #f7f7fb;
    --tvg-light-red: #fdf2f4;
    --tvg-light-blue: #eaf0f6;
    --tvg-border: #dcdcdc;
    --tvg-text: #1f1f2e;
    --tvg-muted: #5a5a6e;
    --tvg-success: #2d7a47;
    --tvg-success-bg: #e8f5ec;
    --tvg-focus: #2563eb;

    font-family: inherit;
    color: var(--tvg-text);
    line-height: 1.6;
    margin: 24px 0;
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
}

.tvg-wrapper *,
.tvg-wrapper *::before,
.tvg-wrapper *::after {
    box-sizing: border-box;
}

/* Universal focus style for keyboard accessibility */
.tvg-wrapper :focus-visible {
    outline: 3px solid var(--tvg-focus);
    outline-offset: 2px;
    border-radius: 3px;
}

/* Header */
.tvg-header {
    background: linear-gradient(135deg, var(--tvg-navy) 0%, var(--tvg-navy-light) 100%);
    color: #ffffff;
    padding: 22px 24px;
    border-radius: 8px;
    border-left: 6px solid var(--tvg-red);
    margin-bottom: 18px;
    box-shadow: 0 4px 12px rgba(45, 42, 74, 0.18);
}

.tvg-header h3 {
    margin: 0 0 6px 0;
    color: #ffffff;
    font-size: 22px;
    line-height: 1.3;
    font-family: inherit;
}

.tvg-header p {
    margin: 0;
    color: #f4c7cf;
    font-size: 14px;
}

/* Tabs */
.tvg-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 18px;
    border-bottom: 2px solid var(--tvg-border);
    flex-wrap: wrap;
}

.tvg-tab {
    flex: 1 1 auto;
    min-width: 0;
    background: none;
    border: none;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--tvg-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s, background-color 0.15s;
    text-align: center;
}

.tvg-tab:hover,
.tvg-tab:focus-visible {
    color: var(--tvg-navy);
    background-color: var(--tvg-light);
}

.tvg-tab[aria-selected="true"] {
    color: var(--tvg-red);
    border-bottom-color: var(--tvg-red);
}

.tvg-tab[aria-selected="true"]:hover,
.tvg-tab[aria-selected="true"]:focus-visible {
    color: var(--tvg-red-dark);
}

/* Tab label switching: full on desktop, short on mobile */
.tvg-tab-full {
    display: inline;
}

.tvg-tab-short {
    display: none;
}

.tvg-panel {
    display: none;
}

.tvg-panel[aria-hidden="false"] {
    display: block;
}

/* Progress bar */
.tvg-progress-bar {
    background: var(--tvg-light);
    border: 1px solid var(--tvg-border);
    border-radius: 24px;
    padding: 14px 18px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.tvg-progress-track {
    flex: 1 1 200px;
    min-width: 0;
    height: 10px;
    background: #e5e5ec;
    border-radius: 5px;
    overflow: hidden;
}

.tvg-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--tvg-red), #c92e4a);
    width: 0%;
    transition: width 0.35s ease;
}

.tvg-progress-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--tvg-navy);
    min-width: 0;
}

.tvg-progress-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tvg-btn {
    background: var(--tvg-navy);
    color: #ffffff;
    border: none;
    padding: 9px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.15s, transform 0.05s;
    line-height: 1.3;
}

.tvg-btn:hover,
.tvg-btn:focus-visible {
    background: var(--tvg-red);
}

.tvg-btn:active {
    transform: translateY(1px);
}

.tvg-btn-ghost {
    background: transparent;
    color: var(--tvg-muted);
    border: 1px solid var(--tvg-border);
}

.tvg-btn-ghost:hover,
.tvg-btn-ghost:focus-visible {
    background: var(--tvg-light);
    color: var(--tvg-navy);
    border-color: var(--tvg-navy);
}

/* JS-hook classes (no styles, used by JavaScript only):
   .tvg-print  - print button
   .tvg-reset  - reset checklist button
   .tvg-copy-btn - copy template button
*/

/* Steps / checklist */
.tvg-step-group {
    margin-bottom: 22px;
}

.tvg-step-group-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--tvg-red);
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--tvg-light-red);
    font-family: inherit;
}

.tvg-step {
    background: #ffffff;
    border: 1px solid var(--tvg-border);
    border-left: 4px solid var(--tvg-red);
    border-radius: 4px;
    padding: 14px 16px 14px 50px;
    margin-bottom: 8px;
    position: relative;
    transition: background-color 0.15s, border-color 0.15s;
}

.tvg-step.tvg-step-done {
    background: var(--tvg-success-bg);
    border-left-color: var(--tvg-success);
}

.tvg-step.tvg-step-done .tvg-step-text {
    text-decoration: line-through;
    color: var(--tvg-muted);
}

.tvg-checkbox {
    position: absolute;
    left: 14px;
    top: 14px;
    width: 26px;
    height: 26px;
    border: 2px solid var(--tvg-red);
    border-radius: 4px;
    cursor: pointer;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
    padding: 0;
    font-family: inherit;
}

.tvg-checkbox:hover {
    background: var(--tvg-light-red);
}

.tvg-checkbox:active {
    transform: scale(0.95);
}

.tvg-step-done .tvg-checkbox {
    background: var(--tvg-success);
    border-color: var(--tvg-success);
}

.tvg-step-done .tvg-checkbox:hover {
    background: #1f5a33;
}

.tvg-checkbox-icon {
    color: #ffffff;
    font-size: 17px;
    line-height: 1;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.15s, transform 0.15s;
    font-weight: bold;
}

.tvg-step-done .tvg-checkbox-icon {
    opacity: 1;
    transform: scale(1);
}

.tvg-step-text {
    display: block;
    font-weight: 600;
    color: var(--tvg-text);
    margin-bottom: 4px;
}

.tvg-step-help {
    display: block;
    font-size: 14px;
    color: var(--tvg-muted);
    line-height: 1.5;
}

.tvg-step-help a {
    display: inline-block;
    margin-top: 6px;
    color: var(--tvg-red);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid var(--tvg-red);
    padding-bottom: 1px;
    transition: color 0.15s, border-color 0.15s;
}

.tvg-step-help a:hover,
.tvg-step-help a:focus-visible {
    color: var(--tvg-red-dark);
    border-bottom-color: var(--tvg-red-dark);
}

.tvg-step-help a::after {
    content: " →";
    font-weight: normal;
}

/* Info boxes */
.tvg-info {
    background: var(--tvg-light-red);
    border-left: 4px solid var(--tvg-red);
    padding: 14px 18px;
    margin: 16px 0;
    border-radius: 4px;
    font-size: 15px;
    line-height: 1.55;
}

.tvg-info-navy {
    background: var(--tvg-light-blue);
    border-left-color: var(--tvg-navy);
}

.tvg-info strong {
    color: var(--tvg-navy);
}

/* Templates */
.tvg-template {
    background: #ffffff;
    border: 1px solid var(--tvg-border);
    border-radius: 6px;
    margin-bottom: 16px;
    overflow: hidden;
}

.tvg-template-header {
    background: var(--tvg-navy);
    color: #ffffff;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.tvg-template-header h4 {
    margin: 0;
    color: #ffffff;
    font-size: 16px;
    flex: 1 1 auto;
    min-width: 0;
    font-family: inherit;
}

.tvg-template-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.tvg-template-body {
    padding: 18px;
}

.tvg-template-text {
    background: var(--tvg-light);
    border: 1px solid var(--tvg-border);
    border-radius: 4px;
    padding: 14px 16px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.65;
    color: var(--tvg-text);
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    max-height: 480px;
    overflow-y: auto;
    margin: 0 0 12px 0;
}

.tvg-template-note {
    font-size: 13px;
    color: var(--tvg-muted);
    margin: 0;
    line-height: 1.55;
}

.tvg-copy-feedback {
    display: inline-block;
    font-size: 13px;
    color: #ffffff;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s;
    background: var(--tvg-success);
    padding: 4px 10px;
    border-radius: 3px;
    pointer-events: none;
}

.tvg-copy-feedback.tvg-show {
    opacity: 1;
}

/* Status banner when complete */
.tvg-complete-banner {
    display: none;
    background: linear-gradient(135deg, var(--tvg-success), #4a9d6a);
    color: #ffffff;
    padding: 14px 18px;
    border-radius: 6px;
    margin-bottom: 18px;
    font-weight: 600;
    text-align: center;
}

.tvg-complete-banner.tvg-show {
    display: block;
}

/* Screen reader only utility class */
.tvg-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Responsive cards on mobile (~600px) */
@media (max-width: 600px) {
    .tvg-header {
        padding: 18px;
    }

    .tvg-header h3 {
        font-size: 19px;
    }

    .tvg-tabs {
        gap: 0;
    }

    .tvg-tab {
        padding: 10px 12px;
        font-size: 14px;
        white-space: normal;
        line-height: 1.3;
    }

    .tvg-tab-full {
        display: none;
    }

    .tvg-tab-short {
        display: inline;
    }

    .tvg-progress-bar {
        padding: 12px 14px;
    }

    .tvg-progress-actions {
        width: 100%;
        justify-content: stretch;
    }

    .tvg-progress-actions .tvg-btn {
        flex: 1;
    }

    .tvg-step {
        padding: 12px 14px 12px 48px;
    }

    .tvg-checkbox {
        left: 12px;
        top: 12px;
        width: 26px;
        height: 26px;
    }

    .tvg-template-header {
        padding: 10px 14px;
    }

    .tvg-template-header h4 {
        font-size: 15px;
        flex: 1 1 100%;
    }

    .tvg-template-actions {
        flex: 1 1 100%;
        justify-content: flex-end;
    }

    .tvg-template-body {
        padding: 14px;
    }

    .tvg-template-text {
        font-size: 12px;
        padding: 12px;
        max-height: 360px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .tvg-wrapper *,
    .tvg-wrapper *::before,
    .tvg-wrapper *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* Print styles. The print button opens a new isolated window with cloned wrapper.
   These rules style the cloned content for print output. */
@media print {
    /* Hide UI controls that don't make sense in print */
    .tvg-tabs,
    .tvg-progress-actions,
    .tvg-template-actions,
    .tvg-complete-banner {
        display: none !important;
    }

    /* Only print the active panel */
    .tvg-panel {
        display: none !important;
    }

    .tvg-panel[aria-hidden="false"] {
        display: block !important;
    }

    /* Header: black-and-white friendly */
    .tvg-header {
        background: #ffffff !important;
        color: #000000 !important;
        border: 2px solid #000000;
        border-left-width: 6px;
        box-shadow: none;
        page-break-after: avoid;
    }

    .tvg-header h3,
    .tvg-header p {
        color: #000000 !important;
    }

    /* Steps: keep individual step cards together */
    .tvg-step {
        page-break-inside: avoid;
        border: 1px solid #000000 !important;
        border-left: 4px solid #000000 !important;
        background: #ffffff !important;
    }

    .tvg-checkbox {
        border-color: #000000 !important;
        background: #ffffff !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .tvg-step-done .tvg-checkbox {
        background: #000000 !important;
    }

    /* Templates: keep header attached to body */
    .tvg-template-header {
        page-break-after: avoid;
    }

    .tvg-template-header h4 {
        color: #ffffff !important;
    }

    /* Allow template text to flow naturally */
    .tvg-template-text {
        max-height: none;
        overflow: visible;
        white-space: pre-wrap;
        font-size: 11px;
    }

    .tvg-template-note {
        page-break-before: avoid;
    }

    /* Progress bar */
    .tvg-progress-bar {
        background: #ffffff !important;
        border: 1px solid #000000 !important;
        page-break-after: avoid;
    }

    /* Step group titles: don't orphan from first step */
    .tvg-step-group-title {
        page-break-after: avoid;
    }

    /* Info boxes */
    .tvg-info {
        page-break-inside: avoid;
        background: #ffffff !important;
        border: 1px solid #000000 !important;
        border-left: 4px solid #000000 !important;
    }
}
