﻿/* Regimen Search V2 - Professional UI */



:root {

    --primary-color: #2563eb;

    /* Royal Blue */

    --primary-hover: #1d4ed8;

    --secondary-color: #64748b;

    /* Slate */

    --bg-color: #f8fafc;

    /* Light Gray Blue */

    --sidebar-bg: #ffffff;

    --card-bg: #ffffff;

    --text-main: #1e293b;

    /* Slate 800 */

    --text-sub: #64748b;

    /* Slate 500 */

    --border-color: #e2e8f0;

    --success-color: #10b981;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);

    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);

    --radius-md: 0.5rem;

    --radius-lg: 0.75rem;

    --header-height: 64px;

}



* {

    box-sizing: border-box;

}



body {

    margin: 0;

    padding: 0;

    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    background-color: var(--bg-color);

    color: var(--text-main);

    height: 100vh;

    overflow: hidden;

    /* Prevent body scroll, use inner scrolling */

    display: flex;

    flex-direction: column;

}



/* ================================

   Header

   ================================ */



.app-header {

    height: var(--header-height);

    background-color: white;

    border-bottom: 1px solid var(--border-color);

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 0 24px;

    box-shadow: var(--shadow-sm);

    z-index: 10;

}



.app-logo {

    display: flex;

    align-items: center;

    gap: 12px;

    font-weight: 700;

    font-size: 1.25rem;

    color: var(--primary-color);

    text-decoration: none;

}



.app-logo i {

    font-size: 1.5rem;

}



.header-controls {

    display: flex;

    align-items: center;

    gap: 16px;

}



.user-profile {

    display: flex;

    align-items: center;

    gap: 8px;

    font-size: 0.9rem;

    color: var(--text-main);

    padding: 6px 12px;

    border-radius: 20px;

    background-color: #f1f5f9;

    cursor: pointer;

    transition: background-color 0.2s;

}



.user-profile:hover {

    background-color: #e2e8f0;

}



.user-avatar {

    width: 28px;

    height: 28px;

    background-color: var(--primary-color);

    color: white;

    border-radius: 50%;

    display: flex;

    align-items: center;

    justify-content: center;

    font-weight: 600;

    font-size: 0.8rem;

}



/* ================================

   Main Layout

   ================================ */



.app-container {

    display: flex;

    flex: 1;

    overflow: hidden;

}



/* Sidebar (Category Tree) */

.app-sidebar {

    width: 320px;

    background-color: var(--sidebar-bg);

    border-right: 1px solid var(--border-color);

    display: flex;

    flex-direction: column;

    flex-shrink: 0;

}



.sidebar-header {

    padding: 16px;

    border-bottom: 1px solid var(--border-color);

    display: flex;

    align-items: center;

    justify-content: space-between;

}



.sidebar-title {

    font-weight: 600;

    font-size: 0.95rem;

    color: var(--text-main);

}



.sidebar-actions {

    display: flex;

    gap: 4px;

}



.btn-icon {

    background: none;

    border: none;

    color: var(--text-sub);

    cursor: pointer;

    padding: 4px;

    border-radius: 4px;

    transition: all 0.2s;

}



.btn-icon:hover {

    background-color: #f1f5f9;

    color: var(--primary-color);

}



.sidebar-content {

    flex: 1;

    overflow-y: auto;

    padding: 12px;

}



/* Main Content Area */

.app-main {

    flex: 1;

    display: flex;

    flex-direction: column;

    overflow: hidden;

    background-color: var(--bg-color);

}



.main-toolbar {

    padding: 16px 24px;

    background-color: white;

    border-bottom: 1px solid var(--border-color);

    display: flex;

    align-items: center;

    gap: 16px;

    flex-wrap: wrap;

}



.search-container {

    flex: 1;

    position: relative;

    max-width: 600px;

}



.search-input {

    width: 100%;

    padding: 10px 16px 10px 40px;

    border: 1px solid var(--border-color);

    border-radius: var(--radius-md);

    font-size: 0.95rem;

    transition: all 0.2s;

    background-color: #f8fafc;

}



.search-input:focus {

    outline: none;

    border-color: var(--primary-color);

    background-color: white;

    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);

}



.search-icon {

    position: absolute;

    left: 12px;

    top: 50%;

    transform: translateY(-50%);

    color: var(--text-sub);

}



.btn-primary {

    background-color: var(--primary-color);

    color: white;

    border: none;

    padding: 10px 20px;

    border-radius: var(--radius-md);

    font-weight: 500;

    cursor: pointer;

    transition: background-color 0.2s;

    display: flex;

    align-items: center;

    gap: 8px;

}



.btn-primary:hover {

    background-color: var(--primary-hover);

}



.btn-secondary {

    background-color: white;

    color: var(--text-main);

    border: 1px solid var(--border-color);

    padding: 10px 16px;

    border-radius: var(--radius-md);

    font-weight: 500;

    cursor: pointer;

    transition: all 0.2s;

    display: flex;

    align-items: center;

    gap: 8px;

}



.btn-secondary:hover {

    background-color: #f8fafc;

    border-color: #cbd5e1;

}



/* Results Area */

.results-wrapper {

    flex: 1;

    overflow-y: auto;

    padding: 24px;

}



.results-header-info {

    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 20px;

}



.results-count {

    font-size: 0.9rem;

    color: var(--text-sub);

    font-weight: 500;

}



/* Grid Layout */

.regimen-grid {

    display: grid;

    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));

    gap: 20px;

}

.regimen-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.regimen-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.regimen-header {
    margin-bottom: 12px;
}

.regimen-category {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.regimen-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
    line-height: 1.5;
}

.regimen-preview {
    font-size: 0.9rem;
    color: var(--text-sub);
    line-height: 1.6;
    flex: 1;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
}

.regimen-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.regimen-tag {
    font-size: 0.75rem;
    padding: 4px 10px;
    background-color: #f1f5f9;
    color: var(--text-sub);
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.regimen-tag:hover {
    background-color: #e2e8f0;
    color: var(--text-main);
}

/* Tree Styling Override */
.tree-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tree-node {
    margin-bottom: 2px;
}

.tree-node-content {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s;
    color: var(--text-main);
}

.tree-node-content:hover {
    background-color: #f1f5f9;
}

.tree-toggle {
    background: none;
    border: none;
    color: var(--text-sub);
    cursor: pointer;
    padding: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
    border-radius: 4px;
}

.tree-toggle:hover {
    background-color: #e2e8f0;
    color: var(--text-main);
}

.tree-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    cursor: pointer;
    user-select: none;
}

.tree-checkbox {
    width: 16px;
    height: 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    accent-color: var(--primary-color);
}

.tree-label {
    font-size: 0.9rem;
    font-weight: 500;
}

.tree-children {
    padding-left: 24px;
    border-left: 1px solid #f1f5f9;
    margin-left: 11px;
}

.tree-toggle-spacer {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    margin-right: 4px;
}

.tree-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-sub);
    font-size: 0.9rem;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-sub);
    text-align: center;
    padding: 40px;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    color: #cbd5e1;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0 0 8px 0;
}

.empty-state p {
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-sub);
}

.loading-spinner i {
    font-size: 2rem;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.regimen-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.regimen-header {
    margin-bottom: 12px;
}

.regimen-category {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.regimen-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
    line-height: 1.5;
}

.regimen-preview {
    font-size: 0.9rem;
    color: var(--text-sub);
    line-height: 1.6;
    flex: 1;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
}

.regimen-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.regimen-tag {
    font-size: 0.75rem;
    padding: 4px 10px;
    background-color: #f1f5f9;
    color: var(--text-sub);
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.regimen-tag:hover {
    background-color: #e2e8f0;
    color: var(--text-main);
}

/* Tree Styling Override */
.tree-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tree-node {
    margin-bottom: 2px;
}

.tree-node-content {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s;
    color: var(--text-main);
}

.tree-node-content:hover {
    background-color: #f1f5f9;
}

.tree-toggle {
    background: none;
    border: none;
    color: var(--text-sub);
    cursor: pointer;
    padding: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
    border-radius: 4px;
}

.tree-toggle:hover {
    background-color: #e2e8f0;
    color: var(--text-main);
}

.tree-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    cursor: pointer;
    user-select: none;
}

.tree-checkbox {
    width: 16px;
    height: 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    accent-color: var(--primary-color);
}

.tree-label {
    font-size: 0.9rem;
    font-weight: 500;
}

.tree-children {
    padding-left: 24px;
    border-left: 1px solid #f1f5f9;
    margin-left: 11px;
}

.tree-toggle-spacer {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    margin-right: 4px;
}

.tree-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-sub);
    font-size: 0.9rem;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-sub);
    text-align: center;
    padding: 40px;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    color: #cbd5e1;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0 0 8px 0;
}

.empty-state p {
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-sub);
}

.loading-spinner i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 12px;
    animation: spin 1s linear infinite;
}

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Selected Tags Bar */
.selected-tags-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    background: #f1f5f9;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    margin: 0;
}

.selected-tags-label {
    color: var(--text-sub);
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}

.selected-tags-list {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.selected-tag-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--primary-color);
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 20px;
    transition: all 0.2s;
    white-space: nowrap;
}

.selected-tag-item:hover {
    background: var(--primary-hover);
}

.tag-remove-btn {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    font-size: 0.85rem;
    line-height: 1;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-left: 4px;
}

.tag-remove-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.btn-clear-tags {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-sub);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.btn-clear-tags:hover {
    background: #f8fafc;
    color: var(--text-main);
}

/* Legacy selected-tag styles */
.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background-color: #eff6ff;
    color: var(--primary-color);
    border: 1px solid #dbeafe;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
}

.btn-remove-tag {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
}

.btn-remove-tag:hover {
    color: var(--primary-hover);

    .comments-list {
        flex: 1;
        overflow-y: auto;
        padding: 16px;
        background: #f8fafc;
    }

    .comment-item {
        background: white;
        padding: 12px;
        border-radius: 8px;
        border: 1px solid var(--border-color);
        margin-bottom: 12px;
    }

    .comment-meta {
        display: flex;
        justify-content: space-between;
        margin-bottom: 6px;
        font-size: 0.85rem;
    }

    .comment-author {
        font-weight: 600;
        color: var(--text-main);
    }

    .comment-date {
        color: var(--text-sub);
    }

    .comment-body {
        font-size: 0.95rem;
        color: var(--text-main);
        line-height: 1.5;
    }

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

    .btn-comment-action {
        font-size: 0.8rem;
        color: var(--text-sub);
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
    }

    .btn-comment-action:hover {
        text-decoration: underline;
        color: var(--primary-color);
    }

    /* Comment Form */
    .comment-form {
        padding: 16px;
        border-top: 1px solid var(--border-color);
        background: white;
    }

    .comment-editor-container {
        border: 1px solid var(--border-color);
        border-radius: 8px;
        overflow: hidden;
        margin-bottom: 8px;
    }

    .comment-submit-btn {
        width: 100%;
        padding: 8px;
        background: var(--primary-color);
        color: white;
        border: none;
        border-radius: 6px;
        font-weight: 500;
        cursor: pointer;
    }

    .comment-submit-btn:hover {
        background: var(--primary-hover);
    }

    /* Regimen Content Styles */
    .regimen-detail-header {
        margin-bottom: 24px;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 16px;
    }

    .regimen-detail-title {
        font-size: 1.8rem;
        font-weight: 700;
        color: var(--text-main);
        margin: 0 0 12px 0;
    }

    .regimen-detail-meta {
        display: flex;
        gap: 16px;
        color: var(--text-sub);
        font-size: 0.9rem;
    }

    .regimen-detail-body {
        line-height: 1.8;
        color: var(--text-main);
        font-size: 1rem;
    }

    /* TinyMCE Override for small editor */
    .tox-tinymce {
        border: none !important;
    }

/* History Item Styles - 개선된 히스토리 UI */
.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.history-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.history-item.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.history-item.active .history-date,
.history-item.active .history-time,
.history-item.active .history-author,
.history-item.active .history-author i,
.history-item.active .history-item-meta i {
    color: rgba(255, 255, 255, 0.85);
}

.history-item.active .history-version {
    color: white;
}

.history-item.active .history-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.history-item.empty {
    text-align: center;
    color: var(--text-sub);
    cursor: default;
    background: transparent;
    border: none;
}

.history-item.empty:hover {
    box-shadow: none;
}

.history-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.history-version {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
}

.history-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    background: #dcfce7;
    color: #166534;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.history-item-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 4px;
    font-size: 0.75rem;
}

.history-date,
.history-time {
    display: flex;
    align-items: center;
    gap: 3px;
    color: var(--text-sub);
    font-weight: 400;
}

.history-date i,
.history-time i {
    font-size: 0.65rem;
    color: #94a3b8;
}

.history-author {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-main);
    font-weight: 500;
}

.history-author i {
    font-size: 0.7rem;
    color: var(--primary-color);
}

/* History item latest (first) 강조 */
.history-item.latest {
    border-left: 3px solid var(--primary-color);
}