/**
 * 車スキンティアリスト CSS
 */

/* 基本スタイル */
.car-skin-tier-list-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f8f9fa;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.car-skin-tier-list-wrapper {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* ティアリストメイン */
.tier-list-main {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
}

/* タイトル */
.tier-list-title {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}

.tier-list-title input {
    font-size: 1.3rem;
    font-weight: bold;
    text-align: center;
    border: 2px dashed #ddd;
    background: white;
    padding: 10px 20px;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
    transition: all 0.3s ease;
    color: #333 !important;
    -webkit-text-fill-color: #333 !important;
}

.tier-list-title input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

/* ティア行 */
.tier-rows {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tier-row {
    display: flex;
    min-height: 80px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: white;
}

.tier-label {
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.5rem;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.tier-items {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    align-content: center;
    padding: 10px;
    gap: 8px;
    min-height: 90px;
    background: #fafafa;
    transition: background-color 0.2s ease;
}

.tier-items.drag-over {
    background: #e3f2fd;
    border: 2px dashed #2196f3;
}

/* 車アイテム */
.car-item {
    width: 80px;
    height: 80px;
    border: 2px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    cursor: grab;
    transition: all 0.2s ease;
    background: white;
    position: relative;
    display: flex;
    flex-direction: column;
}

.car-item:hover {
    transform: scale(1.05);
    border-color: #007cba;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.car-item:active {
    cursor: grabbing;
}

.car-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.car-item.ghost {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.8;
    transform: scale(0.9);
}

.car-item img {
    width: 100%;
    height: 60px;
    object-fit: cover;
    display: block;
}

.car-name {
    font-size: 8px;
    text-align: center;
    padding: 2px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

.car-name-fallback {
    display: none;
    background: #f0f0f0;
    height: 100%;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #666;
    text-align: center;
    padding: 5px;
    line-height: 1.2;
}

/* カテゴリータブ */
.car-category-tabs {
    margin-bottom: 20px;
}

.tabs-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    background: #f5f5f5;
    padding: 10px;
    border-radius: 8px;
}

.tab {
    padding: 8px 16px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    user-select: none;
}

.tab:hover {
    background: #f0f0f0;
    border-color: #007cba;
}

.tab.active {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

/* 車スキンプール */
.car-pool-container {
    margin-bottom: 20px;
}

.car-pool-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
    text-align: center;
}

.car-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 15px;
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 8px;
    min-height: 100px;
    align-content: flex-start;
    transition: all 0.2s ease;
}

.car-pool.drag-over {
    background: #e8f5e8;
    border-color: #4caf50;
}

/* ボタン */
.tier-list-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}

.reset-button {
    background: #dc3545;
    color: white;
}

.reset-button:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.save-image-button {
    background: #28a745;
    color: white;
}

.save-image-button:hover {
    background: #218838;
    transform: translateY(-1px);
}

.save-post-x-button {
    background: #1da1f2;
    color: white;
}

.save-post-x-button:hover {
    background: #0d8bd9;
    transform: translateY(-1px);
}

/* ウォーターマーク */
.tier-list-watermark {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 10px;
    color: #666;
    text-align: right;
    line-height: 1.2;
    opacity: 0.7;
}

/* トースト通知 */
.car-skin-tier-list-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
}

.car-skin-tier-list-toast.show {
    transform: translateX(0);
}

.toast-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.toast-message {
    font-size: 14px;
    opacity: 0.9;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .car-skin-tier-list-container {
        padding: 10px;
        margin: 10px;
    }
    
    .car-skin-tier-list-wrapper {
        padding: 15px;
    }
    
    .tier-list-main {
        padding: 15px;
    }
    
    .tier-label {
        width: 60px;
        font-size: 1.2rem;
    }
    
    .car-item {
        width: 70px;
        height: 70px;
    }
    
    .car-item img {
        height: 52px;
    }
    
    .car-name {
        font-size: 7px;
    }
    
    .tabs-container {
        gap: 3px;
    }
    
    .tab {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .tier-list-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .button {
        width: 100%;
        max-width: 250px;
        justify-content: center;
    }
    
    .car-skin-tier-list-toast {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .car-skin-tier-list-container {
        padding: 5px;
        margin: 5px;
    }
    
    .tier-label {
        width: 50px;
        font-size: 1rem;
    }
    
    .car-item {
        width: 60px;
        height: 60px;
    }
    
    .car-item img {
        height: 45px;
    }
    
    .car-name {
        font-size: 6px;
        padding: 1px;
    }
    
    .tab {
        padding: 5px 10px;
        font-size: 11px;
    }
    
    .tier-list-title input {
        font-size: 1.1rem;
        padding: 8px 15px;
        background: white !important;
        color: #333 !important;
        -webkit-text-fill-color: #333 !important;
        -webkit-appearance: none;
    }
}

/* ドラッグ&ドロップのアニメーション */
.tier-items {
    transition: all 0.2s ease;
}

.tier-items.drag-over {
    background: #e3f2fd;
    transform: scale(1.02);
}

.car-pool.drag-over {
    background: #e8f5e8;
    transform: scale(1.01);
}

/* アクセシビリティ */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* 高コントラストモード */
@media (prefers-contrast: high) {
    .car-item {
        border-width: 3px;
    }
    
    .tier-items.drag-over {
        border-width: 3px;
    }
    
    .car-pool.drag-over {
        border-width: 3px;
    }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
    .car-skin-tier-list-container {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .car-skin-tier-list-wrapper {
        background: #2d2d2d;
    }
    
    .tier-list-main {
        background: #2d2d2d;
    }
    
    .tier-row {
        border-color: #444;
    }
    
    .tier-items {
        background: #333;
    }
    
    .car-item {
        background: #2d2d2d;
        border-color: #555;
    }
    
    .car-pool {
        background: #333;
        border-color: #555;
    }
    
    .tabs-container {
        background: #333;
    }
    
    .tab {
        background: #2d2d2d;
        border-color: #555;
        color: #e0e0e0;
    }
    
    .tab:hover {
        background: #444;
    }
    
    .tier-list-title input {
        border-color: #555;
        background: #2d2d2d !important;
        color: #e0e0e0 !important;
        -webkit-text-fill-color: #e0e0e0 !important;
    }
}