/* ================================================================
   Forest Admin Design System
   Single source of truth for all CSS styles
   ================================================================ */

/* ================================================================
   1. Design Tokens (CSS Variables)
   ================================================================ */
:root {
    /* Brand Colors */
    --bs-primary: #056301;
    --bs-primary-rgb: 5, 99, 1;
    --bs-link-color: #056301;
    --bs-link-hover-color: #034400;
    --bs-primary-bg-subtle: #e6f3e6;
    --bs-primary-border-subtle: #9bd19b;

    /* Popup Colors (used by popup windows) */
    --popup-bg: #f4f6f9;
    --popup-card: #ffffff;
    --popup-border: #e9ecef;
    --popup-text: #212529;
    --popup-muted: #6c757d;
    --popup-success: #198754;
}

/* ================================================================
   2. Bootstrap Theme Overrides
   ================================================================ */
.text-primary { color: #056301 !important; }
.bg-primary { background-color: #056301 !important; }
.border-primary { border-color: #056301 !important; }

.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: #056301;
    --bs-btn-border-color: #056301;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #045300;
    --bs-btn-hover-border-color: #045300;
    --bs-btn-active-bg: #034400;
    --bs-btn-active-border-color: #034400;
}

.btn-outline-primary {
    --bs-btn-color: #056301;
    --bs-btn-border-color: #056301;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #056301;
    --bs-btn-hover-border-color: #056301;
    --bs-btn-active-bg: #045300;
    --bs-btn-active-border-color: #045300;
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background-color: #056301 !important;
}

a { color: var(--bs-link-color); }
a:hover { color: var(--bs-link-hover-color); }

/* ================================================================
   3. Base / Layout
   ================================================================ */
body {
    background-color: #f5f7fb;
    font-size: 0.85rem;
}

.sidebar {
    width: 180px;
    min-height: 100vh;
    background: #056301;
    color: #fff;
}

.sidebar a {
    color: #d7f2db;
    text-decoration: none;
}

.sidebar a.active,
.sidebar a:hover {
    color: #fff;
}

.content-wrap {
    margin-left: 200px;
}

.brand {
    font-weight: 700;
    letter-spacing: .3px;
}

/* ================================================================
   4. Tables (from common.css)
   ================================================================ */
.table tbody td {
    padding: 0 0.4rem;
    height: 40px;
    line-height: 40px;
}

.table thead th {
    padding: 0.1rem 0.4rem;
    height: 20px;
    line-height: 20px;
    text-align: center;
}

/* ================================================================
   5. Pagination (main pages, from pagination.css)
   ================================================================ */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.pagination ul {
    display: flex;
    flex-wrap: nowrap;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0.5rem;
}

.pagination li {
    display: flex;
}

.pagination a,
.pagination span {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #d1d5db;
    font-size: 0.9rem;
    color: #374151;
    text-decoration: none;
    background-color: #fff;
    transition: all 0.2s;
}

.pagination a:hover {
    background-color: #f3f4f6;
}

.pagination .active span {
    background-color: #25633d;
    color: #fff;
    border-color: #25633d;
    font-weight: bold;
}

/* ================================================================
   6. Icon Buttons (from common.css)
   ================================================================ */
.btn-soop-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    transition: 0.15s ease;
}

.btn-soop-detail {
    color: #0b7a05;
}
.btn-soop-detail:hover {
    color: #056301;
}

.btn-soop-delete {
    color: #cc2b2b;
}
.btn-soop-delete:hover {
    color: #ff0000;
}

/* ================================================================
   7. Soop Card Grid
   ================================================================ */
.soop-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.2rem;
    align-items: stretch;
}

@media (max-width: 992px) {
    .soop-card-grid {
        grid-template-columns: 1fr;
    }
}

.soop-card {
    padding: 1.5rem !important;
    height: 100%;
}

.soop-section-title {
    margin-bottom: 0.8rem !important;
}

/* ================================================================
   8. Soop Form Components
   ================================================================ */
.soop-input {
    height: 36px !important;
    padding: 0.35rem 0.5rem !important;
    font-size: 0.9rem !important;
}

.soop-input-wide {
    height: 36px !important;
    padding: 0.35rem 0.5rem !important;
    font-size: 0.9rem !important;
}

.soop-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.35rem;
    display: block;
}

/* Toggle Group (from artist.css) */
.soop-toggle-group {
    display: flex;
    gap: 6px;
}

.soop-toggle {
    border: 1px solid #cfd4da;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    background: #fff;
    color: #444;
    transition: all 0.15s ease-in-out;
    user-select: none;
}

.soop-toggle:hover {
    background: #f3f7f3;
}

.soop-toggle.active {
    background: #056301;
    border-color: #056301;
    color: #fff;
}

.soop-toggle-input {
    display: none;
}

.soop-alias-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem 0.6rem;
}

/* ================================================================
   9. Badges & Chips
   ================================================================ */

/* Artist Badge */
.artist-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    background: #6c757d;
    color: #fff;
}
.artist-badge button {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.9;
}
.artist-badge button:hover {
    opacity: 1;
}

/* Member & Keyword Chips */
.member-chip,
.keyword-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 999px;
    font-size: 0.85rem;
    background: #fafafa;
    margin-right: 6px;
    margin-bottom: 6px;
}
.member-chip button,
.keyword-chip button {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 0.9rem;
    color: #888;
}

/* Key Badge */
.key-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    background-color: #0d6efd;
    color: white;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}
.key-badge.base-key {
    background-color: #198754;
}
.key-badge .remove-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    padding: 0;
    margin-left: 2px;
    font-size: 0.85rem;
    line-height: 1;
}
.key-badge .remove-btn:hover {
    color: white;
}

/* Song ID Badge */
.song-id-badge {
    background-color: #e9ecef;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    color: #495057;
}
.song-id-badge strong {
    color: #0d6efd;
}

/* Page Count Badge */
.page-count-badge {
    background-color: #198754;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ================================================================
   10. Special Buttons
   ================================================================ */

/* Melon Button */
.btn-melon {
    background: #00C73C;
    color: #fff;
    font-weight: 600;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: 0.15s ease;
}
.btn-melon:hover {
    background: #00b035;
    color: #fff;
}

/* Fixed-width Select Button */
.btn-select-fixed {
    width: 110px;
    text-align: center;
}

/* ================================================================
   11. File Upload / Drop Zone
   ================================================================ */
.drop-zone {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #fafafa;
}
.drop-zone:hover {
    border-color: #0d6efd;
    background-color: #f0f7ff;
}
.drop-zone.drag-over {
    border-color: #0d6efd;
    background-color: #e7f1ff;
}

.drop-zone-icon {
    font-size: 2rem;
    color: #adb5bd;
    margin-bottom: 0.5rem;
}

.drop-zone-text {
    font-size: 0.85rem;
    color: #6c757d;
}
.drop-zone-text strong {
    color: #0d6efd;
}

/* File Info */
.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    margin-top: 0.5rem;
}

.file-info-name {
    font-size: 0.85rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.file-info-name i {
    color: #dc3545;
}

.file-info-size {
    font-size: 0.75rem;
    color: #6c757d;
}

.file-remove {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.file-remove:hover {
    color: #a71d2a;
    background-color: rgba(220, 53, 69, 0.1);
    border-radius: 4px;
}

/* Existing File (part/edit) */
.existing-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background-color: #e8f4fd;
    border: 1px solid #b6d4fe;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}
.existing-file-link {
    font-size: 0.85rem;
    color: #0d6efd;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.existing-file-link:hover {
    text-decoration: underline;
}
.btn-change-file {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
}

.drop-zone-existing {
    cursor: pointer;
    transition: all 0.2s ease;
}
.drop-zone-existing:hover {
    background-color: #d0e8fc;
    border-color: #0d6efd;
}
.drop-zone-existing.drag-over {
    background-color: #b6d4fe;
    border-color: #0d6efd;
    border-style: dashed;
}

/* Upload Box (from artist.css) */
.upload-wrapper {
    width: 100%;
}

.upload-box {
    height: 150px;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 25px;
    background: #f8fafc;
    text-align: center;
    cursor: pointer;
    transition: 0.2s ease;
}
.upload-box:hover {
    background: #f1f5f9;
}
.upload-box.dragover {
    border-color: #056301;
    background: #eef9ee;
}

.upload-text {
    text-align: center;
    color: #444;
    font-family: 'Pretendard', sans-serif;
    margin-top: 20px;
}

.upload-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #222;
}
.upload-desc {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 4px;
}
.upload-hint {
    font-size: 0.8rem;
    color: #888;
}
.upload-preview {
    width: 160px;
    height: 160px;
    object-fit: cover;
    margin-top: 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
}

/* ================================================================
   12. Key / Transposition Selector
   ================================================================ */
.key-inline-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.key-separator {
    color: #adb5bd;
    font-size: 0.85rem;
}

.key-mode-btn {
    min-width: 70px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid #dee2e6;
    background-color: #f8f9fa;
    color: #555;
}
.key-mode-btn.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: white;
}

.key-note-btn {
    min-width: 44px;
    height: 32px;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background-color: #fff;
    color: #333;
    cursor: pointer;
    transition: all 0.15s ease;
}
.key-note-btn:hover {
    background-color: #e7f1ff;
    border-color: #0d6efd;
    color: #0d6efd;
}
.key-note-btn.sharp-flat {
    background-color: #f8f9fa;
    color: #666;
    font-size: 0.73rem;
}

/* ================================================================
   13. Song Info Card
   ================================================================ */
.song-info-card {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
}

.song-info-row {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}
.song-info-row:last-child {
    margin-bottom: 0;
}

.song-info-label {
    font-size: 0.75rem;
    color: #6c757d;
    width: 60px;
    flex-shrink: 0;
}

.song-info-value {
    font-size: 0.85rem;
    color: #212529;
    font-weight: 500;
}

.song-info-ids {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #dee2e6;
}

.song-placeholder {
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

/* ================================================================
   14. PDF Preview
   ================================================================ */
.pdf-preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
@media (max-width: 768px) {
    .pdf-preview-grid {
        grid-template-columns: 1fr;
    }
}

.pdf-preview-box {
    display: flex;
    flex-direction: column;
}

.pdf-preview-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.pdf-preview-label.original {
    color: #0d6efd;
}
.pdf-preview-label.sample {
    color: #dc3545;
}

.pdf-preview-container {
    width: 100%;
    height: 350px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.pdf-preview-container.original {
    border-color: #0d6efd;
}
.pdf-preview-container.sample {
    border-color: #dc3545;
}
.pdf-preview-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.pdf-preview-placeholder {
    text-align: center;
    color: #6c757d;
}
.pdf-preview-placeholder i {
    font-size: 2rem;
    color: #adb5bd;
    margin-bottom: 0.5rem;
}
.pdf-preview-placeholder span {
    font-size: 0.8rem;
}

/* ================================================================
   15. Album Image Layout
   ================================================================ */
.album-image-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.album-image-left {
    flex: 0 0 140px;
}
.album-image-right {
    flex: 1;
    min-width: 0;
}
@media (max-width: 576px) {
    .album-image-row {
        flex-direction: column;
    }
    .album-image-left {
        flex: none;
    }
}

/* ================================================================
   16. Artist Cover Image
   ================================================================ */
.artist-cover {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #e5e5e5;
    background: #fff;
}

/* ================================================================
   17. Keyword Row
   ================================================================ */
.keyword-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.keyword-row input {
    flex: 1;
    min-width: 0;
}
.keyword-row button {
    white-space: nowrap;
    min-width: 72px;
}

/* ================================================================
   18. Member Block / Disabled States
   ================================================================ */
#addMemberBtn:disabled {
    background: #e9ecef !important;
    border-color: #ced4da !important;
    color: #868e96 !important;
    cursor: not-allowed !important;
    opacity: 1 !important;
    box-shadow: none !important;
}

#memberBlock {
    position: relative;
}
#memberBlock.member-disabled {
    filter: grayscale(1);
    opacity: 0.45;
    pointer-events: none;
    user-select: none;
}
#memberBlock.member-disabled::after {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.78);
    border: 1px dashed #ced4da;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 800;
    color: #6c757d;
    letter-spacing: -0.2px;
    pointer-events: none;
    z-index: 2;
}
/* Only show overlay text when data attribute is present (edit pages) */
#memberBlock[data-disabled-text].member-disabled::after {
    content: attr(data-disabled-text);
}

#memberHint.disabled-hint {
    color: #adb5bd;
    font-weight: 700;
}
#memberHint.enabled-hint {
    color: #d9480f;
    font-weight: 800;
}

.preview-text {
    margin-top: 6px;
    font-size: 0.85rem;
    color: #666;
}

/* ================================================================
   19. Modal Overrides (from artist.css)
   ================================================================ */
#nameCheckModal .modal-body {
    max-height: 500px;
    overflow-y: auto;
}

.custom-artist-modal {
    max-width: 750px;
    width: 750px;
}

#artistModal .modal-body {
    max-height: 400px;
    overflow-y: auto;
}

#artistSearchList,
#artistSelectedList {
    height: 260px;
    overflow-y: auto;
}

#member-list {
    background: #f4faf5;
    padding: 10px;
    border: 1px solid #cfe9d5;
    border-radius: 6px;
    min-height: 40px;
}

/* ================================================================
   20. Popup Windows (shared by all popup pages)
   ================================================================ */
body.popup-body {
    background: var(--popup-bg);
    margin: 0;
    font-size: 13.5px;
    color: var(--popup-text);
}

.popup-wrap {
    margin: 0 auto;
    padding: 10px;
}

.popup-card {
    border: 1px solid var(--popup-border);
    border-radius: 12px;
    background: var(--popup-card);
    box-shadow: 0 6px 16px rgba(0,0,0,0.05);
    overflow: hidden;
}

.popup-card-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--popup-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fbfcfe;
}

.popup-title {
    font-size: 1rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.2px;
}

.popup-desc {
    font-size: 0.8rem;
    color: var(--popup-muted);
    margin: 3px 0 0;
}

.popup-body {
    padding: 10px 12px;
}

/* Popup Search */
.search-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
}
.search-input {
    height: 34px;
    font-size: 0.9rem;
    border-radius: 8px;
}
.search-btn {
    height: 34px;
    padding: 0 10px;
    font-size: 0.88rem;
    border-radius: 8px;
    white-space: nowrap;
}

/* Popup Table Overrides */
body.popup-body .table {
    margin-bottom: 0;
    font-size: 0.9rem;
}
body.popup-body .table thead th {
    font-size: 0.82rem;
    font-weight: 700;
    color: #495057;
    background: #f8f9fb !important;
    border-bottom: 1px solid var(--popup-border);
    padding: 8px 6px;
    height: auto;
    line-height: normal;
}
body.popup-body .table tbody td {
    padding: 6px 6px;
    border-bottom: 1px solid #f1f3f5;
    height: auto;
    line-height: normal;
}
body.popup-body .table-hover tbody tr:hover {
    background: #f8fbff;
}

/* Popup-dense table (part song popup) */
body.popup-body .table.popup-table-dense {
    font-size: 0.85rem;
}
body.popup-body .table.popup-table-dense thead th {
    font-size: 0.8rem;
    white-space: nowrap;
}
body.popup-body .table.popup-table-dense tbody td {
    vertical-align: middle;
}

/* Popup text styles */
span.artist-name {
    font-weight: 700;
    color: #111;
}

.song-title {
    font-weight: 700;
    color: #111;
}

td.artist-name,
td.album-name {
    color: #333;
}

.id-cell {
    color: #6c757d;
    font-size: 0.75rem;
}

.album-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e5e5e5;
    background: #fff;
}

/* Popup Select Button */
.select-btn {
    padding: 3px 9px;
    font-size: 0.82rem;
    border-radius: 7px;
    white-space: nowrap;
}

/* Dense select button variant (part popup) */
.select-btn-dense {
    padding: 4px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
    font-weight: 600;
}

/* Popup Pagination */
.pagination-wrap {
    display: flex;
    justify-content: center;
    padding: 8px 0 2px;
    border-top: 1px dashed var(--popup-border);
    margin-top: 6px;
}

body.popup-body .pagination {
    margin: 0;
    gap: 3px;
    flex-wrap: nowrap;
}

body.popup-body .pagination .page-link {
    min-width: 28px;
    height: 28px;
    width: auto;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    border-radius: 7px !important;
    border: 1px solid var(--popup-border);
    color: #495057;
    background-color: transparent;
}

body.popup-body .pagination .page-item.active .page-link {
    background: var(--popup-success);
    border-color: var(--popup-success);
    color: #fff;
    font-weight: 800;
}

body.popup-body .pagination .page-link:hover {
    color: var(--popup-success);
    border-color: var(--popup-success);
}

body.popup-body .pagination .page-item.disabled .page-link {
    opacity: .45;
}

/* ================================================================
   21. List Page Utilities
   ================================================================ */
.row-closed td {
    background-color: #f2f2f2 !important;
}

.text-truncate-custom {
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.disabled-block {
    opacity: 0.35;
    pointer-events: none;
}

/* ================================================================
   22. Analytics Page
   ================================================================ */
.filter-section {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

/* ================================================================
   23. Auth Pages (Signup)
   ================================================================ */
.signup-page .invalid-feedback {
    display: none;
    margin-top: 6px;
    font-size: 0.85rem;
    color: #dc3545;
    line-height: 1.35;
}

.signup-page .valid-feedback {
    display: none;
    margin-top: 6px;
    font-size: 0.85rem;
    color: #198754;
    line-height: 1.35;
}

.signup-page .is-invalid {
    border-color: #dc3545 !important;
    background-image: none !important;
    box-shadow: 0 0 0 0.15rem rgba(220, 53, 69, 0.12);
}

.signup-page .is-valid {
    border-color: #198754 !important;
    background-image: none !important;
    box-shadow: 0 0 0 0.15rem rgba(25, 135, 84, 0.12);
}

.signup-page .is-invalid + .invalid-feedback,
.signup-page .is-invalid ~ .invalid-feedback {
    display: block;
}

.signup-page .is-valid + .valid-feedback,
.signup-page .is-valid ~ .valid-feedback {
    display: block;
}

.signup-page button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.signup-page .btn-primary {
    background-color: #3a7d44 !important;
    border-color: #3a7d44 !important;
}
.signup-page .btn-primary:hover {
    background-color: #2c5530 !important;
    border-color: #2c5530 !important;
}
