/* Tsugawa YT Insights Styles */

.tyi-app-container {
    border: 2px dashed #ccc;
    padding: 0 16px;
    margin: 0 auto;
    min-height: 100px;
    background-color: #f9f9f9;
    border-radius: 8px;
    font-family: sans-serif;
    display: block;
    max-width: 900px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    clear: both;
}

.tyi-header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 15px 20px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tyi-status-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.tyi-status-badge {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.9em;
    font-weight: bold;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tyi-status-badge.connected {
    background-color: #dcfce7;
    color: #166534;
}

.tyi-status-badge.disconnected {
    background-color: #fee2e2;
    color: #991b1b;
}

.tyi-status-badge.unconfigured {
    background-color: #f1f5f9;
    color: #475569;
}

.tyi-header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 6px;
    padding: 8px 16px;
    white-space: normal;
    text-align: center;
    line-height: 1.4;
    margin-left: auto;
}

.tyi-filters-wrapper {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    align-items: start;
    margin-bottom: 0;
}

.tyi-filters-wrapper .tyi-form-group {
    margin-bottom: 0;
}

.tyi-details-settings {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #e2e8f0;
}

.tyi-details-summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    color: #64748b;
    outline: none;
    user-select: none;
    display: inline-block;
}

.tyi-details-summary:hover {
    color: #334155;
}

.tyi-details-content {
    margin-top: 12px;
    background-color: #f8fafc;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.tyi-message {
    padding: 12px 16px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
}

.tyi-message-info {
    background-color: #e1f5fe;
    color: #0277bd;
    border: 1px solid #b3e5fc;
}

.tyi-message-warning {
    background-color: #fff3e0;
    color: #e65100;
    border: 1px solid #ffe0b2;
}

.tyi-message-success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

/* Settings Form Styles */
.tyi-settings-form {
    background-color: #fff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tyi-form-title {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    color: #444;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.tyi-form-group {
    margin-bottom: 15px;
    min-width: 0;
}

.tyi-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 13px;
    color: #475569;
}

/* Settings Form Inner Classes */
.tyi-settings-guide-box {
    background-color: #e0f2fe;
    padding: 24px;
    border-radius: 6px;
    border: 1px solid #bae6fd;
}

.tyi-settings-guide-title {
    margin-top: 0;
    margin-bottom: 12px;
    color: #0369a1;
    font-weight: bold;
}

.tyi-settings-guide-steps {
    margin-bottom: 12px;
    color: #0c4a6e;
    font-size: 0.9em;
    line-height: 1.6;
}

.tyi-settings-guide-link {
    display: inline-block;
    color: #0284c7;
    font-weight: bold;
    text-decoration: none;
    font-size: 0.95em;
}

.tyi-settings-step-box {
    background-color: #f8fafc;
    padding: 24px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.tyi-settings-step-title {
    margin-top: 0;
    margin-bottom: 12px;
    color: #334155;
    font-size: 1em;
}

.tyi-settings-step-desc {
    font-size: 0.85em;
    color: #64748b;
    margin-top: 4px;
    margin-bottom: 12px;
}

.tyi-settings-btn-primary {
    margin-top: 15px;
    width: 100%;
}

.tyi-analytics-btn-connect {
    margin-top: 15px;
    width: 100%;
    background-color: #e2e8f0;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    font-weight: 600;
}

.tyi-analytics-btn-connect:hover {
    background-color: #cbd5e1;
}

.tyi-analytics-btn-connected {
    margin-top: 15px;
    width: 100%;
    background-color: #f8fafc;
    color: #16a34a;
    border: 1px solid #bbf7d0;
    cursor: not-allowed;
}

.tyi-input {
    width: 100%;
    max-width: 400px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

select.tyi-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.tyi-input:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.tyi-button {
    background-color: #0073aa;
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.tyi-button:hover {
    background-color: #005177;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Loading Indicator */
.tyi-loading {
    padding: 15px;
    background-color: #fff;
    border-radius: 6px;
    margin-bottom: 15px;
    font-weight: bold;
    color: #0073aa;
    text-align: center;
    border: 1px solid #b3d4fc;
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.05);
}

/* Summary & Chart Styles */
.tyi-summary {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.tyi-summary-title {
    margin: 0 0 10px 0;
    color: #1e293b;
    font-size: 18px;
}

.tyi-summary-text {
    margin: 0;
    color: #475569;
    font-size: 15px;
    text-align: left;
    padding-left: 12px;
}

.tyi-highlight {
    font-weight: bold;
    color: #0284c7;
    font-size: 18px;
    margin: 0 5px;
}

.tyi-count {
    color: #64748b;
    font-size: 14px;
}

.tyi-chart-container {
    position: relative;
    height: 400px;
    width: 100%;
    margin-top: 20px;
}

/* Ranking Card Styles */
.tyi-ranking-card {
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tyi-ranking-title {
    margin: 0 0 15px 0;
    color: #1e293b;
    font-size: 16px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 10px;
    text-align: center;
}

.tyi-ranking-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tyi-ranking-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background-color: #f8fafc;
    border-radius: 6px;
    border-left: 4px solid #0284c7;
    gap: 24px;
}

.tyi-ranking-rank {
    font-size: 18px;
    font-weight: bold;
    color: #0284c7;
    width: 40px;
    flex-shrink: 0;
}

.tyi-ranking-time {
    flex-grow: 1;
    font-weight: 600;
    color: #1e293b;
    font-size: 16px;
}

.tyi-ranking-stats {
    text-align: right;
    flex-shrink: 0;
}

.tyi-ranking-views {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.tyi-ranking-initial {
    color: #64748b;
    font-size: 13px;
    font-weight: 400;
}

.tyi-ranking-long {
    color: #1e293b;
    font-size: 16px;
    font-weight: 600;
}

.tyi-ranking-posts {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 12px;
    color: #94a3b8;
}

.tyi-confidence-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 6px;
}

.tyi-confidence-low {
    background-color: #fef2f2;
    color: #ef4444;
    border: 1px solid #fecaca;
}

.tyi-confidence-mid-low {
    background-color: #fffbeb;
    color: #f59e0b;
    border: 1px solid #fde68a;
}

.tyi-confidence-mid {
    background-color: #f0fdf4;
    color: #22c55e;
    border: 1px solid #bbf7d0;
}

.tyi-confidence-high {
    background-color: #eff6ff;
    color: #3b82f6;
    border: 1px solid #bfdbfe;
}

.tyi-ranking-empty {
    text-align: center;
    color: #64748b;
    font-size: 14px;
    padding: 10px;
}

/* Summary Board Styles */
.tyi-summary-board-card {
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tyi-summary-board-title {
    margin: 0 0 10px 0;
    color: #1e293b;
    font-size: 16px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 8px;
}

.tyi-summary-board-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 14px;
    color: #0f172a;
}

.tyi-summary-board-list li {
    display: flex;
    align-items: flex-start;
    padding: 2px 0 2px 12px;
    margin-bottom: 14px;
    border-left: 3px solid #e2e8f0;
    line-height: 1.5;
}

.tyi-summary-board-list li:last-child {
    margin-bottom: 0;
}

.tyi-summary-icon {
    display: none;
}

.tyi-summary-label {
    flex: 0 0 170px;
    font-weight: 600;
    color: #64748b;
    margin-right: 8px;
}

/* Comparison Card Styles */
.tyi-comparison-card {
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tyi-comparison-title {
    margin: 0 0 15px 0;
    color: #1e293b;
    font-size: 16px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 10px;
    text-align: center;
}

.tyi-comp-main {
    display: flex;
    justify-content: space-around;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.tyi-comp-overall,
.tyi-comp-best {
    text-align: center;
}

.tyi-comp-label {
    display: block;
    color: #64748b;
    font-size: 13px;
    margin-bottom: 8px;
}

.tyi-comp-val {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #475569;
}

.tyi-comp-num {
    font-weight: 700;
    color: #0f172a;
}

.tyi-comp-subtitle {
    margin: 24px 0 16px 0;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    text-align: center;
}

.tyi-comp-types {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.tyi-comp-type-item {
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 24px;
    border-radius: 8px;
    text-align: center;
    color: #475569;
}

.tyi-comp-type-label {
    color: #64748b;
    font-size: 13px;
    display: block;
    margin-bottom: 8px;
    font-weight: normal;
}

.tyi-comp-type-val {
    font-size: 14px;
    font-weight: 500;
    color: #475569;
}

/* Strategy Summary Card */
.tyi-strategy-card {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tyi-strategy-title {
    margin: 0 0 20px 0;
    color: #0f172a;
    font-size: 18px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 12px;
}

.tyi-strategy-item {
    margin-bottom: 24px;
}

.tyi-strategy-item:last-child {
    margin-bottom: 0;
}

.tyi-strategy-label {
    display: block;
    font-weight: 600;
    color: #1e293b;
    font-size: 15px;
    margin-bottom: 6px;
}

.tyi-strategy-desc {
    margin: 0;
    font-size: 15px;
    color: #334155;
    line-height: 1.6;
}

.tyi-accent {
    font-weight: 600;
    color: #0369a1;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tyi-header-container {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .tyi-status-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .tyi-header-btn {
        width: 100%;
        margin-left: 0;
    }

    .tyi-input,
    .tyi-button,
    select.tyi-input {
        width: 100%;
        max-width: none;
        min-height: 44px;
        box-sizing: border-box;
    }

    .tyi-comp-main,
    .tyi-comp-types {
        flex-direction: column;
        gap: 16px;
    }

    .tyi-comp-overall,
    .tyi-comp-best,
    .tyi-comp-type-item {
        word-break: break-word;
    }
}

/* Mobile Responsive (Small) */
@media (max-width: 480px) {
    .tyi-filters-wrapper {
        grid-template-columns: 1fr;
    }
}