/*
Theme Name: Design Stock
Description: デザインリファレンス管理ツール - Eagle風ダークUI
Version: 3.0.0
Author: SHINMI CREATE
Text Domain: design-stock
*/

/* ===================================
   Reset & Base (Eagle Dark Theme)
   =================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', sans-serif;
    background: #292929;
    color: #e0e0e0;
    line-height: 1.6;
}

a { color: #4a9eff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===================================
   Layout
   =================================== */
.ds-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===================================
   Header
   =================================== */
.ds-header {
    background: #1e1e1e;
    color: #e0e0e0;
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid #3a3a3a;
}

.ds-header .ds-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ds-logo {
    font-size: 16px;
    font-weight: 600;
    color: #e0e0e0;
    letter-spacing: 0.5px;
    cursor: pointer;
}

.ds-logo:hover { text-decoration: none; opacity: 0.8; }

.ds-header-right { display: flex; align-items: center; gap: 12px; }

.ds-search {
    padding: 6px 14px;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    background: #363636;
    color: #e0e0e0;
    font-size: 13px;
    width: 200px;
}

.ds-search::placeholder { color: #8e8e8e; }
.ds-search:focus { outline: none; border-color: #4a9eff; }

/* ===================================
   Breadcrumb Navigation
   =================================== */
.ds-breadcrumb-bar {
    background: #1e1e1e;
    border-bottom: 1px solid #3a3a3a;
    padding: 8px 0;
}

.ds-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.ds-breadcrumb-item {
    color: #8e8e8e;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 13px;
    padding: 2px 6px;
    border-radius: 4px;
}

.ds-breadcrumb-item:hover { color: #e0e0e0; background: #363636; }
.ds-breadcrumb-item.current { color: #e0e0e0; cursor: default; }
.ds-breadcrumb-item.current:hover { background: none; }

.ds-breadcrumb-sep { color: #555; font-size: 11px; }

/* ===================================
   Toolbar
   =================================== */
.ds-toolbar {
    background: #1e1e1e;
    border-bottom: 1px solid #3a3a3a;
    padding: 8px 0;
    position: sticky;
    top: 40px;
    z-index: 99;
}

.ds-toolbar .ds-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ds-toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ds-toolbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ds-folder-count {
    font-size: 12px;
    color: #8e8e8e;
}

.ds-btn-icon {
    background: none;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    padding: 5px 10px;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 13px;
}

.ds-btn-icon:hover { background: #363636; }

/* ===================================
   Filter Buttons
   =================================== */
.ds-filter-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.ds-filter-btn {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    font-size: 12px;
    color: #8e8e8e;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.ds-filter-btn:hover { border-color: #555; color: #e0e0e0; }
.ds-filter-btn.active { background: #4a9eff; color: #fff; border-color: #4a9eff; }

/* Rating filter */
.ds-rating-select {
    padding: 4px 8px;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    font-size: 12px;
    color: #e0e0e0;
    background: #363636;
}

/* ===================================
   Folder Grid (sub-folders)
   =================================== */
.ds-folder-section {
    padding: 12px 0;
}

.ds-folder-section-header {
    font-size: 12px;
    color: #8e8e8e;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ds-folder-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding-bottom: 8px;
}

.ds-folder-card {
    width: 160px;
    cursor: pointer;
    transition: transform 0.15s;
}

.ds-folder-card:hover { transform: translateY(-2px); }

.ds-folder-card-img {
    width: 160px;
    height: 110px;
    border-radius: 6px;
    overflow: hidden;
    background: #363636;
}

.ds-folder-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ds-folder-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 28px;
}

.ds-folder-card-name {
    font-size: 12px;
    font-weight: 500;
    margin-top: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #e0e0e0;
}

.ds-folder-card-count {
    font-size: 11px;
    color: #8e8e8e;
}

/* New folder card */
.ds-folder-card-new {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
}

.ds-folder-card-new .ds-folder-card-img {
    border: 2px dashed #3a3a3a;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ds-folder-card-new .ds-folder-card-img:hover {
    border-color: #4a9eff;
}

.ds-folder-card-new .ds-plus {
    font-size: 28px;
    color: #555;
}

.ds-folder-card-new:hover .ds-plus { color: #4a9eff; }

/* ===================================
   Image Grid (Masonry / Eagle-style)
   =================================== */
.ds-content-header {
    font-size: 12px;
    color: #8e8e8e;
    padding: 8px 0;
}

.ds-grid {
    columns: 5 220px;
    column-gap: 6px;
    padding: 4px 0 20px;
}

.ds-card {
    break-inside: avoid;
    margin-bottom: 6px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: opacity 0.15s;
    background: #363636;
}

.ds-card:hover { opacity: 0.85; }

.ds-card.selected {
    outline: 2px solid #4a9eff;
    outline-offset: -2px;
}

.ds-card.selected::after {
    content: '\2713';
    position: absolute;
    top: 6px;
    left: 6px;
    width: 20px;
    height: 20px;
    background: #4a9eff;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ds-card-img {
    width: 100%;
    display: block;
}

.ds-card-label {
    padding: 5px 7px;
    font-size: 11px;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ds-card-label-sub {
    font-size: 10px;
    color: #8e8e8e;
}

.ds-card-stars {
    display: inline;
    color: #ff9500;
    font-size: 10px;
    margin-left: 4px;
}

/* ===================================
   Detail / Edit Sidebar
   =================================== */
.ds-sidebar {
    position: fixed;
    top: 40px;
    right: 0;
    width: 320px;
    height: calc(100vh - 40px);
    background: #1e1e1e;
    border-left: 1px solid #3a3a3a;
    z-index: 150;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}

.ds-sidebar.open {
    transform: translateX(0);
}

body.sidebar-open .ds-main-content {
    margin-right: 320px;
    transition: margin-right 0.25s ease;
}

.ds-sidebar-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #8e8e8e;
    line-height: 1;
    z-index: 1;
}

.ds-sidebar-close:hover { color: #e0e0e0; }

.ds-sidebar-img {
    width: 100%;
    background: #000;
    flex-shrink: 0;
}

.ds-sidebar-img img {
    width: 100%;
    display: block;
    max-height: 240px;
    object-fit: contain;
}

.ds-sidebar-form {
    padding: 12px;
    flex: 1;
}

.ds-sidebar-form .ds-form-group { margin-bottom: 8px; }
.ds-sidebar-form .ds-form-group label { font-size: 11px; color: #8e8e8e; margin-bottom: 2px; display: block; }

.ds-sidebar-form .ds-form-group input,
.ds-sidebar-form .ds-form-group textarea {
    width: 100%;
    padding: 5px 8px;
    font-size: 12px;
    background: #363636;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    font-family: inherit;
}

.ds-sidebar-form .ds-form-group input:focus,
.ds-sidebar-form .ds-form-group textarea:focus {
    outline: none;
    border-color: #4a9eff;
}

/* Star rating in sidebar */
.ds-detail-rating {
    display: flex;
    gap: 2px;
    margin-bottom: 8px;
}

.ds-detail-star {
    cursor: pointer;
    font-size: 18px;
    color: #555;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}

.ds-detail-star:hover,
.ds-detail-star.active {
    color: #ff9500;
}

/* Tag picker in sidebar & modals */
.ds-tag-picker {
    margin-bottom: 8px;
}

.ds-tag-picker-label {
    font-size: 11px;
    color: #8e8e8e;
    margin-bottom: 4px;
    display: block;
}

.ds-tag-picker-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}

.ds-tag-chip {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
    border: 1px solid #3a3a3a;
    background: #363636;
    color: #8e8e8e;
    transition: all 0.15s;
}

.ds-tag-chip:hover { border-color: #555; color: #e0e0e0; }

.ds-tag-chip.active {
    background: #4a9eff;
    color: #fff;
    border-color: #4a9eff;
}

.ds-tag-chip.active:hover {
    background: #3a8aee;
}

.ds-tag-add {
    display: flex;
    gap: 4px;
}

.ds-tag-add input {
    flex: 1;
    padding: 3px 6px;
    font-size: 11px;
    background: #363636;
    border: 1px solid #3a3a3a;
    border-radius: 3px;
    color: #e0e0e0;
}

.ds-tag-add input:focus { outline: none; border-color: #4a9eff; }

.ds-tag-add button {
    padding: 3px 8px;
    font-size: 11px;
    background: #363636;
    border: 1px solid #3a3a3a;
    border-radius: 3px;
    color: #8e8e8e;
    cursor: pointer;
}

.ds-tag-add button:hover { color: #e0e0e0; border-color: #555; }

/* Sidebar footer */
.ds-sidebar-actions {
    padding: 10px 12px;
    border-top: 1px solid #3a3a3a;
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.ds-detail-delete {
    background: none;
    border: none;
    color: #ff453a;
    font-size: 11px;
    cursor: pointer;
    margin-left: auto;
}

.ds-detail-delete:hover { text-decoration: underline; }

/* ===================================
   Bulk Action Bar
   =================================== */
.ds-bulk-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1e1e1e;
    border-top: 1px solid #3a3a3a;
    padding: 10px 20px;
    z-index: 200;
    display: none;
    align-items: center;
    gap: 12px;
}

.ds-bulk-bar.show { display: flex; }

.ds-bulk-count {
    font-size: 13px;
    color: #4a9eff;
    font-weight: 500;
    white-space: nowrap;
}

.ds-bulk-actions {
    display: flex;
    gap: 8px;
    flex: 1;
}

.ds-bulk-btn {
    padding: 5px 12px;
    font-size: 12px;
    background: #363636;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    cursor: pointer;
}

.ds-bulk-btn:hover { background: #404040; }

.ds-bulk-btn.danger { color: #ff453a; }
.ds-bulk-btn.danger:hover { background: #3a2020; }

.ds-bulk-close {
    background: none;
    border: none;
    color: #8e8e8e;
    cursor: pointer;
    font-size: 18px;
}

.ds-bulk-close:hover { color: #e0e0e0; }

/* ===================================
   Modal (dark)
   =================================== */
.ds-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 300;
    align-items: center;
    justify-content: center;
}

.ds-modal-overlay.show { display: flex; }

.ds-modal {
    background: #363636;
    border: 1px solid #3a3a3a;
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    color: #e0e0e0;
}

.ds-modal h2 {
    font-size: 18px;
    margin-bottom: 16px;
}

/* Dropzone */
.ds-dropzone {
    border: 2px dashed #3a3a3a;
    border-radius: 8px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
    margin-bottom: 12px;
}

.ds-dropzone:hover, .ds-dropzone.dragover {
    border-color: #4a9eff;
}

.ds-dropzone p {
    font-size: 13px;
    color: #8e8e8e;
}

/* Form */
.ds-form-group {
    margin-bottom: 12px;
}

.ds-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #8e8e8e;
}

.ds-form-group input,
.ds-form-group select,
.ds-form-group textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: #292929;
    color: #e0e0e0;
}

.ds-form-group input:focus,
.ds-form-group select:focus,
.ds-form-group textarea:focus {
    outline: none;
    border-color: #4a9eff;
}

.ds-form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

.ds-btn-primary {
    padding: 7px 16px;
    background: #4a9eff;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.ds-btn-primary:hover { background: #3a8aee; }

.ds-btn-secondary {
    padding: 7px 16px;
    background: #363636;
    color: #e0e0e0;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.ds-btn-secondary:hover { background: #404040; }

/* Preview */
.ds-preview-grid {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.ds-preview-grid img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 3px;
}

/* ===================================
   Empty State
   =================================== */
.ds-empty {
    text-align: center;
    padding: 60px 20px;
    color: #8e8e8e;
}

.ds-empty p { font-size: 14px; }

/* ===================================
   Loading
   =================================== */
.ds-loading {
    text-align: center;
    padding: 40px;
    color: #8e8e8e;
}

.ds-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #3a3a3a;
    border-top-color: #4a9eff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===================================
   Responsive
   =================================== */
@media (max-width: 768px) {
    .ds-grid {
        columns: 2 140px;
        column-gap: 4px;
    }

    .ds-folder-card { width: 120px; }
    .ds-folder-card-img { width: 120px; height: 80px; }

    .ds-sidebar { width: 280px; }
    body.sidebar-open .ds-main-content { margin-right: 280px; }

    .ds-toolbar .ds-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .ds-search { width: 140px; }

    .ds-bulk-bar {
        flex-wrap: wrap;
        padding: 8px 12px;
    }
}
