/* src/public/css/text-to-image.css */

.tti-app {
    margin-top: 20px;
}

.tti-main-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.tti-controls {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tti-box {
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.tti-box-title {
    margin: 0 0 14px;
    font-size: 1rem;
    color: #1e3c72;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tti-textarea {
    width: 100%;
    height: 100px;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.95rem;
    resize: vertical;
    outline: none;
    font-family: inherit;
    line-height: 1.6;
    box-sizing: border-box;
}
.tti-textarea:focus { border-color: #3498db; }

.tti-field { margin-bottom: 16px; }
.tti-field:last-child { margin-bottom: 0; }
.tti-field-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.tti-field-row:last-child { margin-bottom: 0; }
/* 💡 [hidden] とこのクラスの display:flex が同じ詳細度で衝突するため、明示的に上書きします */
.tti-field-row[hidden] { display: none; }
.tti-field-row .tti-field { flex: 1; min-width: 140px; margin-bottom: 0; }

.tti-label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    font-size: 0.85rem;
    color: #475569;
}
.tti-range-val {
    display: inline-block;
    min-width: 2em;
    color: #2a5298;
    font-weight: bold;
}

.tti-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
    background: #ffffff;
    color: #1e293b;
}

.tti-checks-inline { display: flex; gap: 20px; }
.tti-check-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    color: #334155;
    cursor: pointer;
}
.tti-check-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.tti-range {
    width: 100%;
    cursor: pointer;
}

.tti-color-input {
    width: 100%;
    height: 40px;
    padding: 2px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    background: #ffffff;
}

/* セグメント切り替えボタン */
.tti-btn-toggle {
    display: inline-flex;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
}
.tti-toggle-btn {
    padding: 9px 16px;
    border: none;
    background: #f8fafc;
    color: #475569;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
    border-right: 1px solid #cbd5e1;
}
.tti-toggle-btn:last-child { border-right: none; }
.tti-toggle-btn:hover { background: #e2e8f0; }
.tti-toggle-btn.is-active {
    background: #2a5298;
    color: #ffffff;
}

.tti-stroke-detail { margin-top: 14px; }
.tti-bg-color-detail { margin-top: 14px; }
.tti-width-detail,
.tti-height-detail { margin-top: 10px; }
.tti-width-note {
    margin: 16px 0 0;
    font-size: 0.78rem;
    color: #94a3b8;
    line-height: 1.5;
}

/* プレビュー側 */
.tti-preview-box {
    flex: 1;
    min-width: 300px;
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    position: sticky;
    top: 90px;
}

.tti-canvas-frame {
    min-height: 200px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    /* 💡 透明背景の画像でも分かるよう、市松模様を敷いておきます
             （単色背景のときは .is-solid-bg が付き、下の無地スタイルに切り替わります。
             そうしないと、単色の画像なのに枠の外側だけ透けて見えてしまいます） */
    background-image:
        linear-gradient(45deg, #f1f3f5 25%, transparent 25%),
        linear-gradient(-45deg, #f1f3f5 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f1f3f5 75%),
        linear-gradient(-45deg, transparent 75%, #f1f3f5 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}
.tti-canvas-frame.is-solid-bg {
    background-image: none;
    background-color: #eef1f4;
}
.tti-canvas-frame canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

.tti-size-info {
    margin: 12px 0 0;
    font-size: 0.85rem;
    color: #64748b;
    text-align: center;
}

.tti-export-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.tti-btn-primary,
.tti-btn-secondary {
    flex: 1;
    min-width: 140px;
    padding: 13px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.tti-btn-primary {
    background-color: #2a5298;
    color: #ffffff;
}
.tti-btn-primary:hover { background-color: #1e3c72; }
.tti-btn-secondary {
    background-color: #e9ecef;
    color: #495057;
}
.tti-btn-secondary:hover { background-color: #dee2e6; }

/* トースト通知 */
.tti-toast-msg {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    background: rgba(30, 41, 59, 0.9);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.tti-toast-msg.show {
    opacity: 1;
    transform: translateY(0);
}

/* 📱 スマホ・タブレット対応 */
@media (max-width: 900px) {
    .tti-main-row { flex-direction: column; }
    .tti-controls, .tti-preview-box { min-width: 100%; }
    .tti-preview-box { position: static; }
}
@media (max-width: 600px) {
    .tti-box { padding: 16px; }
    .tti-field-row { flex-direction: column; gap: 16px; }
    .tti-btn-toggle { width: 100%; }
    .tti-toggle-btn { flex: 1; text-align: center; padding: 10px 8px; }
    .tti-export-actions { flex-direction: column; }
}
