/**
 * Collections管理画面専用スタイル
 * 
 * プロジェクトルール準拠:
 * - main-rules.md: Refactor段階で!importantを除去
 * - 適切なCSS実装への改善
 */

/* ===== レイアウト基本構造 ===== */
.collections-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.collections-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e1e5e9;
}

.collections-title {
    font-size: 24px;
    font-weight: 600;
    color: #24292f;
    margin: 0;
}

/* ===== ボタンスタイル ===== */
.btn-primary {
    background-color: #0969da;
    color: white;
    border: 1px solid #0969da;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
}

.btn-primary:hover {
    background-color: #0860ca;
    border-color: #0860ca;
}

.btn-secondary {
    background-color: #f6f8fa;
    color: #24292f;
    border: 1px solid #d0d7de;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
}

.btn-secondary:hover {
    background-color: #f3f4f6;
    border-color: #d0d7de;
}

.btn-danger {
    background-color: #da3633;
    color: white;
    border: 1px solid #da3633;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
}

.btn-danger:hover {
    background-color: #c93c37;
    border-color: #c93c37;
}

/* ===== コレクションリスト ===== */
.collections-list {
    background: white;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    overflow: hidden;
}

.collection-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #d0d7de;
    transition: background-color 0.2s ease;
}

.collection-item:last-child {
    border-bottom: none;
}

.collection-item:hover {
    background-color: #f6f8fa;
}

.collection-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.collection-name {
    font-size: 16px;
    font-weight: 600;
    color: #24292f;
    margin: 0;
}

.collection-meta {
    font-size: 14px;
    color: #656d76;
    display: flex;
    gap: 16px;
    align-items: center;
}

.collection-type {
    background-color: #ddf4ff;
    color: #0969da;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.collection-path {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace;
    font-size: 12px;
    color: #656d76;
}

.collection-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ===== 階層表示 ===== */
.collections-tree {
    background: white;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    overflow: hidden;
}

.tree-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #d0d7de;
    transition: background-color 0.2s ease;
}

.tree-item:last-child {
    border-bottom: none;
}

.tree-item:hover {
    background-color: #f6f8fa;
}

.tree-indent {
    width: 24px;
    display: inline-block;
}

.tree-icon {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    color: #656d76;
}

/* ===== フォーム ===== */
.form-container {
    background: white;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #24292f;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 14px;
    color: #24292f;
    background-color: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: #0969da;
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
}

.form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 14px;
    color: #24292f;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 16px 16px;
    padding-right: 32px;
    appearance: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-select:focus {
    outline: none;
    border-color: #0969da;
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
}

/* ===== メッセージ ===== */
.message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.message-success {
    background-color: #dafbe1;
    color: #1a7f37;
    border: 1px solid #a2eebc;
}

.message-error {
    background-color: #ffebe9;
    color: #cf222e;
    border: 1px solid #ffbdba;
}

.message-warning {
    background-color: #fff8c5;
    color: #7d4e00;
    border: 1px solid #ffd33d;
}

.message-info {
    background-color: #ddf4ff;
    color: #0969da;
    border: 1px solid #54aeff;
}

/* ===== モーダル ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #d0d7de;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #24292f;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #656d76;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.modal-close:hover {
    background-color: #f3f4f6;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #d0d7de;
}

/* ===== レスポンシブ対応 ===== */
@media (max-width: 768px) {
    .collections-container {
        padding: 16px;
    }
    
    .collections-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .collection-item {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .collection-actions {
        justify-content: flex-end;
    }
    
    .modal-content {
        padding: 16px;
        width: 95%;
    }
    
    .modal-footer {
        flex-direction: column-reverse;
    }
}

/* ===== ユーティリティクラス ===== */
.hidden {
    display: none;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 16px;
}

.mb-4 {
    margin-bottom: 16px;
}

.p-4 {
    padding: 16px;
}
