/* Regimen Page Styles - Dropdown TreeView Version */

/* ================================
   Search Section (Always Visible)
   ================================ */

.search-section {
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.search-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Category Toggle Button */
.btn-category-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 10px;
    color: #667eea;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-category-toggle:hover {
    background: #667eea;
    color: white;
}

.btn-category-toggle.active {
    background: #667eea;
    color: white;
}

.btn-category-toggle .toggle-icon {
    font-size: 0.85rem;
    transition: transform 0.2s;
}

/* Keyword Input */
.keyword-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.keyword-input:focus {
    outline: none;
    border-color: #667eea;
}

/* Search Buttons */
.btn-search,
.btn-reset {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-search {
    background: #667eea;
    color: white;
}

.btn-search:hover {
    background: #5568d3;
}

.btn-reset {
    background: #f1f3f5;
    color: #666;
}

.btn-reset:hover {
    background: #e1e5e9;
}

/* ================================
   Tree Dropdown Panel
   ================================ */

.tree-dropdown-panel {
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    padding: 25px 30px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tree Header */
.tree-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f1f3f5;
}

.tree-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.tree-controls {
    display: flex;
    gap: 8px;
}

/* Small Tree Control Buttons */
.btn-tree-control {
    padding: 6px 12px;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    color: #666;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-tree-control:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

.btn-tree-control i {
    font-size: 0.75rem;
}

/* Tree Loading State */
.tree-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.tree-loading i {
    font-size: 2rem;
    animation: spin 1s linear infinite;
    color: #667eea;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.tree-loading p {
    font-size: 0.9rem;
    margin: 0;
}

/* Tree Content */
.tree-content {
    border: 1px solid #e1e5e9;
    border-radius: 10px;
    padding: 15px;
    background: #fafbfc;
    max-height: 500px;
    overflow-y: auto;
}

.tree-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 0.9rem;
}

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

.tree-node {
    margin: 0;
    padding: 0;
}

/* Tree Node Content - Compact Spacing */
.tree-node-content {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 5px;
    transition: background 0.2s;
    position: relative;
}

.tree-node-content:hover {
    background: rgba(102, 126, 234, 0.05);
}

/* Tree Toggle Button */
.tree-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    color: #666;
    font-size: 0.75rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.tree-toggle:hover {
    color: #667eea;
}

.tree-toggle i {
    transition: transform 0.2s;
}

.tree-toggle.expanded i {
    transform: rotate(90deg);
}

.tree-toggle-spacer {
    width: 24px;
    flex-shrink: 0;
}

/* Checkbox Wrapper */
.tree-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex: 1;
    padding: 2px 0;
}

.tree-checkbox {
    cursor: pointer;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: #667eea;
}

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

.tree-count {
    color: #999;
    font-size: 0.8rem;
    font-weight: 500;
    margin-left: 4px;
}

/* Tree Children - No Border, Compact Spacing */
.tree-children {
    margin-left: 24px;
    margin-top: 2px;
    padding-left: 8px;
}

/* ================================
   Empty State
   ================================ */

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: 80px 20px 120px 20px;
    margin-top: 40px;
}

.empty-state-content {
    text-align: center;
    max-width: 500px;
}

.empty-state-icon {
    font-size: 5rem;
    color: #667eea;
    margin-bottom: 30px;
    opacity: 0.8;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.empty-state-message {
    font-size: 1.05rem;
    color: #666;
    line-height: 1.8;
    margin: 0;
}

/* ================================
   Results Section
   ================================ */

.results-container {
    margin-top: 40px;
    margin-bottom: 80px;
    display: none;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f3f5;
}

.results-header > div:first-child {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.results-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.results-count {
    color: #667eea;
    font-weight: 500;
    font-size: 0.9rem;
    display: block;
    width: 100%;
    margin-top: 5px;
}

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

.view-options .btn-base {
    min-width: 60px;
    border-radius: 20px;
}

.view-options .btn-base i {
    font-size: 14px;
}

/* Regimen Grid */
.regimen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.regimen-card {
    border: 1px solid #e1e5e9;
    border-radius: 15px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    margin: 10px 0;
    background: white;
}

.regimen-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.regimen-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.regimen-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    line-height: 1.8;
}

.regimen-category {
    font-size: 0.9rem;
    color: #6c757d;
}

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

.regimen-tag {
    display: inline-block;
    padding: 4px 12px;
    background: #667eea;
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 12px;
    transition: all 0.2s ease;
    white-space: nowrap;
    cursor: pointer;
}

.regimen-tag:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

/* Selected Tag Filter Display in Header */
.selected-tag-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.selected-tag-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #667eea;
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 16px;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.25);
    transition: all 0.2s;
    white-space: nowrap;
}

.selected-tag-item:hover {
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.35);
}

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

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

.regimen-preview {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-top: 10px;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    grid-column: 1 / -1;
}

.no-results p {
    font-size: 1.1rem;
    margin: 0;
}

/* ================================
   Modal
   ================================ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

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

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 800px;
    max-height: 80vh;
    width: 90%;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #333;
}

.modal-content h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.modal-content h4 {
    color: #475781;
    margin: 20px 0 10px 0;
    font-size: 1.2rem;
}

.modal-content p {
    line-height: 1.6;
    color: #666;
}

/* ================================
   Loading and Error States
   ================================ */

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    grid-column: 1 / -1;
}

.loading i {
    font-size: 2rem;
    animation: spin 1s linear infinite;
    color: #667eea;
    margin-bottom: 10px;
}

.error-message {
    background: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    color: #c62828;
    text-align: center;
    grid-column: 1 / -1;
}

.error-message i {
    margin-right: 8px;
}

/* ================================
   Responsive Design
   ================================ */

@media (max-width: 768px) {
    .search-section {
        padding: 15px 20px;
    }

    .search-row {
        flex-wrap: wrap;
        gap: 10px;
    }

    .btn-category-toggle {
        width: 100%;
        justify-content: center;
    }

    .keyword-input {
        width: 100%;
    }

    .btn-search,
    .btn-reset {
        flex: 1;
    }

    .tree-dropdown-panel {
        padding: 20px;
    }

    .tree-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .tree-controls {
        width: 100%;
        flex-wrap: wrap;
    }

    .btn-tree-control {
        flex: 1;
        min-width: 90px;
        justify-content: center;
    }

    .tree-content {
        max-height: 400px;
    }

    .regimen-grid {
        grid-template-columns: 1fr;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
        padding: 20px;
    }
}

/* List View Override */
.regimen-grid.list-view {
    grid-template-columns: 1fr;
}

.regimen-grid.list-view .regimen-card {
    margin: 5px 0;
}

/* Additional utility classes */
.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}
