/* コンテナの基本スタイル */
.tt-template-tabs-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

/* ボタングラデーションバリエーション */
.tt-view-templates-btn.gradient-1 {
    background: linear-gradient(45deg, #4776E6, #8E54E9);
}

.tt-view-templates-btn.gradient-2 {
    background: linear-gradient(45deg, #FF512F, #DD2476);
}

.tt-view-templates-btn.gradient-3 {
    background: linear-gradient(45deg, #11998e, #38ef7d);
}

.tt-view-templates-btn.gradient-4 {
    background: linear-gradient(45deg, #FC466B, #3F5EFB);
}

.tt-view-templates-btn.gradient-5 {
    background: linear-gradient(45deg, #c471f5, #fa71cd);
}

.tt-view-templates-btn.gradient-6 {
    background: linear-gradient(45deg, #45B649, #DCE35B);
}

.tt-view-templates-btn.gradient-7 {
    background: linear-gradient(45deg, #614385, #516395);
}

.tt-view-templates-btn.gradient-8 {
    background: linear-gradient(45deg, #FC354C, #0ABFBC);
}

.tt-view-templates-btn.gradient-9 {
    background: linear-gradient(45deg, #1D976C, #93F9B9);
}

.tt-view-templates-btn.gradient-10 {
    background: linear-gradient(45deg, #2196f3, #f44336);
}

/* メインボタン */
.tt-view-templates-btn {
    padding: 12px 24px;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tt-view-templates-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* モーダル基本スタイル */
.tt-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

.tt-modal.active {
    display: flex;
}

.tt-modal-content {
    position: relative;
    background: white;
    padding: 25px;
    width: 85%;
    max-width: 900px;
    max-height: 85vh;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: tt-modalFadeIn 0.3s ease-out;
    overflow-y: auto;
    margin: 0;
}

/* モーダルアニメーション */
@keyframes tt-modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* タブナビゲーション */
.tt-modal-tabs {
    display: flex;
    gap: 15px;
    margin: -5px -15px 20px;
    padding: 0 15px 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    scrollbar-width: thin;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.tt-modal-tab-button {
    padding: 12px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 15px;
    color: #64748b;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
}

.tt-modal-tab-button.active {
    color: #3b82f6;
    font-weight: 600;
}

.tt-modal-tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #3b82f6;
    border-radius: 2px;
}

/* タブコンテンツ */
.tt-modal-tab-content {
    display: none;
    padding: 10px 0;
}

.tt-modal-tab-content.active {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding: 15px;
}

.tt-modal-tab-contents {
    max-height: calc(85vh - 150px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 5px;
}

/* スクロールバーカスタマイズ */
.tt-modal-tab-contents::-webkit-scrollbar {
    width: 8px;
}

.tt-modal-tab-contents::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.tt-modal-tab-contents::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.tt-modal-tab-contents::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* テンプレートリストアイテム */
.tt-template-list-item {
    padding: 16px 20px;
    margin: 0;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.tt-template-list-item:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
}

.tt-template-list-item:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tt-template-list-title {
    font-size: 15px;
    font-weight: 500;
    color: #1e293b;
    position: relative;
}

/* ホバー時の右矢印アイコン */
.tt-template-list-item::after {
    content: '›';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    color: #94a3b8;
    opacity: 0;
    transition: all 0.2s ease;
}

.tt-template-list-item:hover::after {
    opacity: 1;
    right: 12px;
}

/* メタ情報（説明と参照）のスタイル */
.tt-template-meta {
    text-align: left;
    margin-top: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: 600px;
    border-bottom: 1px solid #e2e8f0;
    display: none;
}

/* メタ情報が存在する場合のみ表示 */
.tt-template-meta:has(.tt-template-description:not(:empty)),
.tt-template-meta:has(.tt-template-reference:not(:empty)) {
    display: block;
}

.tt-template-description {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 10px;
    line-height: 1.6;
}

.tt-template-description:empty {
    display: none;
}

.tt-template-reference {
    font-size: 13px;
    color: #64748b;
}

.tt-template-reference:empty {
    display: none;
}

.tt-template-reference a {
    color: #3b82f6;
    text-decoration: none;
}

.tt-template-reference a:hover {
    text-decoration: underline;
}

/* テンプレート内容表示 */
.tt-template-title {
    font-size: 1.5em;
    font-weight: 600;
    margin: -5px 0 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    color: #1e293b;
    padding-right: 40px;
}

h2.tt-template-title {
    margin: 5px 5px;
}

.tt-template-content-wrapper {
    position: relative;
    text-align: left;
    width: 100%;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    display: none;
}

/* コンテンツが存在する場合のみ表示 */
.tt-template-content-wrapper:has(.tt-template-content:not(:empty)) {
    display: block;
}

.tt-template-content {
    white-space: pre-wrap;
    color: #334155;
    line-height: 1.6;
    font-size: 15px !important;
}

/* 戻るボタン */
.tt-back-to-tabs {
    display: block;
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #64748b;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tt-back-to-tabs:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* コピーボタン */
.tt-copy-content-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 8px 16px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tt-copy-content-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

/* 閉じるボタン */
.tt-close {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #64748b;
    font-size: 20px;
    z-index: 2;
}

.tt-close:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* ショートコード表示エリア */
.tt-shortcode-display {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin: 0 auto 20px;
    max-width: 600px;
}

.tt-shortcode-label {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 8px;
    font-weight: 500;
}

.tt-shortcode-content {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.tt-shortcode-content code {
    font-family: monospace;
    color: #334155;
    font-size: 14px;
    flex-grow: 1;
}

.tt-copy-shortcode {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tt-copy-shortcode:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

/* レスポンシブ対応 */
@media (max-width: 968px) {
    .tt-modal-tab-content.active {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .tt-modal-tab-content.active {
        grid-template-columns: 1fr;
    }

    .tt-modal-content {
        width: 95%;
        padding: 20px;
    }

    .tt-template-content {
        margin-right: 0;
        margin-top: 40px;
    }

    .tt-template-title {
        font-size: 1.2em;
    }
}

/* アクセシビリティ対応 */
.tt-modal-tab-button:focus,
.tt-template-list-item:focus,
.tt-copy-content-btn:focus,
.tt-close:focus,
.tt-copy-shortcode:focus,
.tt-template-reference-link:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* カラー選択ラジオボタン */
.gradient-radio-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.gradient-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.gradient-radio-preview {
    width: 100px;
    height: 30px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.gradient-radio-label:hover .gradient-radio-preview {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}