/* ClipTuck - シンプル・軽量スタイル */

:root {
    --primary-color: #007bff;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-gray: #f8f9fa;
    --medium-gray: #e9ecef;
    --dark-gray: #6c757d;
    --text-color: #212529;
    --border-color: #dee2e6;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --radius: 4px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--light-gray);
    color: var(--text-color);
    line-height: 1.5;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* ヘッダー */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    margin: 0 0 5px 0;
    color: var(--primary-color);
    font-size: 2.5em;
    font-weight: 700;
}

.subtitle {
    margin: 0;
    color: var(--dark-gray);
    font-size: 1.1em;
}

/* ブックマークレットセクション */
.bookmarklet-section {
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 30px;
    position: relative;
    box-shadow: var(--shadow);
}

.bookmarklet-section h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.bookmarklet-container {
    background: var(--light-gray);
    padding: 15px;
    border-radius: var(--radius);
    text-align: center;
    margin: 15px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.bookmarklet-button {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: bold;
    cursor: grab;
    box-shadow: var(--shadow);
    transition: background-color 0.2s;
}

.bookmarklet-button:hover {
    background: #0056b3;
}

.bookmarklet-button:not(:first-child) {
    background: #28a745;
}

.bookmarklet-button:not(:first-child):hover {
    background: #1e7e34;
}

/* レスポンシブ: 大きい画面では横並び */
@media (min-width: 600px) {
    .bookmarklet-container {
        flex-direction: row;
        justify-content: center;
    }
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--dark-gray);
}

/* コントロールエリア */
.controls {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

/* フォーム */
.add-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.add-form input {
    flex: 1;
    min-width: 200px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
}

.add-form button {
    padding: 12px 24px;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: bold;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.add-form button:hover {
    background: #218838;
}

/* フィルター */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.filters input, .filters select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
}

.filters input {
    flex: 1;
    min-width: 200px;
}

.view-toggle {
    display: flex;
    gap: 10px;
}

.view-toggle label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    cursor: pointer;
}

/* データコントロール */
.data-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* ギャラリー選択コントロール */
.gallery-selection-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    background: var(--light-gray);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.gallery-selection-controls button {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 3px;
    font-weight: 500;
    transition: all 0.2s;
}

#selectAllBtn {
    background: var(--primary-color);
    color: white;
    border: none;
}

#selectAllBtn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

#deselectAllBtn {
    background: var(--dark-gray);
    color: white;
    border: none;
}

#deselectAllBtn:hover {
    background: #545b62;
    transform: translateY(-1px);
}

#deleteSelectedBtn {
    background: var(--danger-color);
    color: white;
    border: none;
    font-weight: 600;
    min-width: 120px;
}

#deleteSelectedBtn:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.data-controls button:disabled {
    background: var(--dark-gray);
    cursor: not-allowed;
}

.bookmark-selector {
    display: flex;
    align-items: center;
    padding: 20px 0 20px 20px;
    flex-shrink: 0;
}

.bookmark-selector input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.bookmark-item.selected {
    background-color: #e3f2fd;
    border-left: 3px solid #2196f3;
}

.bookmark-item.selected:hover {
    background-color: #bbdefb;
}

.data-controls button,
.file-label {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s;
}

.data-controls button:hover,
.file-label:hover {
    background: #0056b3;
}

/* ブックマーク一覧 */
.bookmarks-list {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.bookmark-item {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.bookmark-item:hover {
    background-color: var(--light-gray);
}

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

.bookmark-content {
    flex: 1;
    padding: 20px;
    cursor: pointer;
}

.bookmark-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
    line-height: 1.3;
}

.bookmark-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--dark-gray);
}

.bookmark-domain {
    font-weight: 500;
}

.bookmark-tags {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.tag {
    background: var(--medium-gray);
    color: var(--text-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.bookmark-actions {
    display: flex;
    flex-direction: column;
    padding: 10px;
    gap: 5px;
}

.bookmark-actions button {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 18px;
    background: var(--light-gray);
    transition: background-color 0.2s;
}

.btn-archive:hover {
    background: var(--warning-color);
}

.btn-delete:hover {
    background: var(--danger-color);
    color: white;
}

/* 空の状態 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--dark-gray);
}

.empty-state p {
    font-size: 18px;
    margin: 0;
}

/* ステータス */
.status {
    text-align: center;
    padding: 15px;
    background: var(--medium-gray);
    border-radius: var(--radius);
    margin-top: 20px;
    font-size: 14px;
    color: var(--dark-gray);
}

/* トースト通知 */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--radius);
    color: white;
    font-weight: bold;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    box-shadow: var(--shadow);
    max-width: 300px;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

.toast.info {
    background: var(--primary-color);
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .add-form {
        flex-direction: column;
    }
    
    .add-form input {
        min-width: auto;
    }
    
    .filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filters input {
        min-width: auto;
    }
    
    .data-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .gallery-selection-controls {
        flex-direction: column;
        gap: 6px;
    }
    
    .gallery-selection-controls button {
        width: 100%;
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .bookmark-item {
        flex-direction: column;
    }
    
    .bookmark-actions {
        flex-direction: row;
        padding: 15px 20px 20px 20px;
        gap: 10px;
    }
    
    .bookmark-meta {
        flex-direction: column;
        gap: 5px;
    }
    
    .toast {
        right: 15px;
        left: 15px;
        max-width: none;
    }
}

/* 印刷スタイル */
@media print {
    .controls,
    .bookmark-actions,
    .toast {
        display: none;
    }
    
    .bookmarks-list {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .bookmark-item:hover {
        background-color: transparent;
    }
}

/* フォーカススタイル（アクセシビリティ） */
button:focus,
input:focus,
select:focus,
.bookmarklet-button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 無効化スタイル */
button:disabled,
input:disabled,
select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 説明欄スタイル */
.add-form textarea,
.edit-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
}

.add-form textarea:focus,
.edit-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ブックマーク説明欄表示 */
.bookmark-description {
    margin-top: 8px;
    font-size: 14px;
    color: var(--dark-gray);
    line-height: 1.4;
    white-space: pre-wrap;
}

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

.modal-content {
    background: white;
    border-radius: var(--radius);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.edit-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.edit-form label {
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
}

.edit-form input,
.edit-form textarea {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
}

.edit-form input:focus,
.edit-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-cancel {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
}

.btn-cancel:hover {
    background: var(--light-gray);
}

.btn-save {
    padding: 10px 20px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
}

.btn-save:hover {
    background: #0056b3;
}

/* 編集ボタン */
.btn-edit {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 18px;
    background: var(--light-gray);
    transition: background-color 0.2s;
}

.btn-edit:hover {
    background: var(--primary-color);
    color: white;
}

/* モーダルのレスポンシブ対応 */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 15px;
    }
}