/* ============================================
   画像・PDF → PPT変換器 スタイルシート v2.0
   ============================================ */

/* --- ベース・リセット --- */
.ppt-converter-wrapper {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
    color: #1e293b;
    line-height: 1.6;
}

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

/* --- ヘッダー --- */
.ppt-header {
    text-align: center;
    padding: 40px 20px 30px;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    border-radius: 16px 16px 0 0;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.ppt-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 60%),
                radial-gradient(circle at 70% 50%, rgba(14, 165, 233, 0.12) 0%, transparent 60%);
    pointer-events: none;
}

.ppt-header-icon {
    font-size: 2.2rem;
    margin-bottom: 10px;
    position: relative;
}

.ppt-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: #fff;
    background: none;
    position: relative;
}

.ppt-header p {
    font-size: 0.95rem;
    opacity: 0.8;
    margin: 0;
    position: relative;
}

/* --- ボディ --- */
.ppt-body {
    display: flex;
    gap: 0;
    background: #f1f5f9;
    border-radius: 0 0 16px 16px;
    overflow: hidden;
    min-height: 600px;
    border: 1px solid #e2e8f0;
    border-top: none;
}

/* --- サイドバー --- */
.ppt-sidebar {
    width: 340px;
    min-width: 340px;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    overflow-y: auto;
    position: sticky;
    top: 20px;
}

.ppt-upload-section {
    padding: 24px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.ppt-upload-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 16px;
    color: #334155;
}

/* --- 入力モード切替タブ --- */
.ppt-input-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 4px;
}

.ppt-tab {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
}

.ppt-tab:hover {
    color: #334155;
    background: rgba(255, 255, 255, 0.5);
}

.ppt-tab.active {
    background: #fff;
    color: #6366f1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* --- タブコンテンツ --- */
.ppt-tab-content {
    display: none;
}

.ppt-tab-content.active {
    display: block;
}

/* --- ドロップゾーン --- */
.ppt-drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 28px 16px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.25s ease;
    margin-bottom: 14px;
}

.ppt-drop-zone:hover,
.ppt-drop-zone.drag-over {
    border-color: #6366f1;
    background: #eef2ff;
}

.ppt-drop-zone.drag-over {
    transform: scale(1.02);
}

.ppt-drop-icon {
    color: #94a3b8;
    margin-bottom: 8px;
    transition: color 0.25s ease;
}

.ppt-drop-zone:hover .ppt-drop-icon,
.ppt-drop-zone.drag-over .ppt-drop-icon {
    color: #6366f1;
}

.ppt-drop-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 4px;
}

.ppt-drop-sub {
    font-size: 0.8rem;
    color: #94a3b8;
}

/* --- ボタン共通 --- */
.ppt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ppt-btn-select {
    width: 100%;
    background: #6366f1;
    color: #fff;
}

.ppt-btn-select:hover {
    background: #4f46e5;
}

.ppt-btn-pdf {
    background: #e11d48;
}

.ppt-btn-pdf:hover {
    background: #be123c;
}

/* --- PDF読み込みプログレス --- */
.ppt-pdf-loading {
    margin-top: 14px;
    padding: 12px;
    background: #fef3c7;
    border-radius: 8px;
    border: 1px solid #fde68a;
}

.ppt-pdf-loading-bar {
    width: 100%;
    height: 5px;
    background: #fde68a;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.ppt-pdf-loading-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #f59e0b, #d97706);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.ppt-pdf-loading-text {
    font-size: 0.78rem;
    font-weight: 500;
    color: #92400e;
    text-align: center;
}

/* --- 画像リストセクション --- */
.ppt-list-section {
    padding: 16px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ppt-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.ppt-image-count {
    font-size: 0.85rem;
    font-weight: 700;
    color: #6366f1;
    background: #eef2ff;
    padding: 4px 12px;
    border-radius: 20px;
}

.ppt-list-actions {
    display: flex;
    gap: 6px;
}

.ppt-btn-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.ppt-btn-add {
    background: #d1fae5;
    color: #065f46;
}

.ppt-btn-add:hover {
    background: #a7f3d0;
}

.ppt-btn-clear {
    background: #fee2e2;
    color: #991b1b;
}

.ppt-btn-clear:hover {
    background: #fecaca;
}

.ppt-list-info {
    font-size: 0.78rem;
    color: #94a3b8;
    background: #f8fafc;
    padding: 6px 10px;
    border-radius: 6px;
    text-align: center;
    margin-bottom: 12px;
}

/* --- 画像リスト --- */
.ppt-image-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.ppt-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: grab;
    transition: all 0.2s ease;
    position: relative;
}

.ppt-list-item:hover {
    background: #f1f5f9;
    border-color: #c7d2fe;
    transform: translateX(3px);
}

.ppt-list-item.dragging {
    opacity: 0.4;
    transform: scale(0.96);
}

.ppt-list-item.drag-over {
    border-color: #6366f1;
    background: #eef2ff;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.ppt-item-num {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #6366f1;
    color: #fff;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.ppt-list-item img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.ppt-item-name {
    flex: 1;
    font-size: 0.78rem;
    color: #475569;
    word-break: break-all;
    line-height: 1.3;
    padding-right: 24px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.ppt-item-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    margin-right: 4px;
    vertical-align: middle;
}

.ppt-badge-pdf {
    background: #fecdd3;
    color: #9f1239;
}

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

.ppt-item-grip {
    font-size: 1rem;
    color: #cbd5e1;
    flex-shrink: 0;
    cursor: grab;
}

.ppt-item-grip:active {
    cursor: grabbing;
}

.ppt-item-del {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 0;
    line-height: 1;
}

.ppt-list-item:hover .ppt-item-del {
    opacity: 1;
}

.ppt-item-del:hover {
    background: #dc2626;
}

/* --- メインコンテンツ --- */
.ppt-main {
    flex: 1;
    padding: 28px;
    min-width: 0;
}

/* --- 設定パネル --- */
.ppt-settings-panel {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.ppt-setting-group {
    flex: 1;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
}

.ppt-setting-group h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 14px;
    color: #334155;
}

/* --- ラジオカード --- */
.ppt-radio-group {
    display: flex;
    gap: 10px;
}

.ppt-layout-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.ppt-radio-card {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    padding: 12px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ppt-radio-card:hover {
    background: #f1f5f9;
    border-color: #c7d2fe;
}

.ppt-radio-card.selected {
    background: #eef2ff;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.ppt-radio-card input[type="radio"] {
    display: none;
}

.ppt-radio-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.ppt-radio-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
}

.ppt-radio-desc {
    font-size: 0.72rem;
    color: #94a3b8;
}

/* --- アスペクト比プレビュー --- */
.ppt-ratio-preview {
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    background: #e2e8f0;
    flex-shrink: 0;
    transition: border-color 0.2s ease;
}

.ppt-radio-card.selected .ppt-ratio-preview {
    border-color: #6366f1;
    background: #c7d2fe;
}

.ratio-16-9 {
    width: 40px;
    height: 22px;
}

.ratio-4-3 {
    width: 36px;
    height: 27px;
}

/* --- 変換ボタン --- */
.ppt-convert-area {
    text-align: center;
    margin-bottom: 24px;
}

.ppt-btn-convert {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 48px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    min-width: 200px;
    position: relative;
}

.ppt-btn-convert:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.ppt-btn-convert:active:not(:disabled) {
    transform: translateY(0);
}

.ppt-btn-convert:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.7;
}

/* --- ローディングスピナー --- */
.ppt-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: ppt-spin 0.7s linear infinite;
}

@keyframes ppt-spin {
    to { transform: rotate(360deg); }
}

/* --- プログレスバー --- */
.ppt-progress {
    margin-bottom: 24px;
    background: #fff;
    border-radius: 10px;
    padding: 16px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
}

.ppt-progress-track {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.ppt-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #a78bfa);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.ppt-progress-text {
    text-align: center;
    font-size: 0.82rem;
    font-weight: 500;
    color: #64748b;
}

/* --- プレビューグリッド --- */
.ppt-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.ppt-preview-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.ppt-preview-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.ppt-preview-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.ppt-preview-label {
    padding: 10px 14px;
    font-size: 0.78rem;
    color: #475569;
    font-weight: 500;
    border-top: 1px solid #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- レスポンシブ --- */
@media (max-width: 1100px) {
    .ppt-settings-panel {
        flex-direction: column;
    }
}

@media (max-width: 900px) {
    .ppt-body {
        flex-direction: column;
    }

    .ppt-sidebar {
        width: 100%;
        min-width: 100%;
        max-height: 400px;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        position: static;
    }

    .ppt-main {
        padding: 20px;
    }
}

@media (max-width: 600px) {
    .ppt-converter-wrapper {
        padding: 0 10px;
        margin: 20px auto;
    }

    .ppt-header h2 {
        font-size: 1.3rem;
    }

    .ppt-radio-group {
        flex-direction: column;
    }

    .ppt-layout-group {
        grid-template-columns: 1fr;
    }

    .ppt-preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

    .ppt-btn-convert {
        width: 100%;
    }
}
