/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

/* Memo Section */
.memo-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.memo-header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.language-select {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: background 0.3s ease;
    backdrop-filter: blur(10px);
}

.language-select:hover {
    background: rgba(255, 255, 255, 0.3);
}

.language-select option {
    background: #4facfe;
    color: white;
}

.memo-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
}

.memo-header i {
    margin-right: 10px;
}

.resize-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.resize-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.memo-textarea {
    width: 100%;
    border: none;
    padding: 20px;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
    outline: none;
    background: #fafafa;
    transition: background 0.3s ease;
}

.memo-textarea:focus {
    background: white;
}

.memo-textarea.expanded {
    min-height: 300px;
}

/* Top Recommendations Spotlight */
.top-recommendations-section {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    margin-bottom: 30px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: none; /* Hidden by default, shown when there are recommendations */
}

.top-recommendations-header {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 15px 20px;
    backdrop-filter: blur(10px);
}

.top-recommendations-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
}

.top-recommendations-header i {
    margin-right: 10px;
}

.top-recommendations-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding: 20px;
    background: white;
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
}

.top-recommendation-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.top-recommendation-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ffd700, #ffed4e);
}

.top-recommendation-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.top-recommendation-rank {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.top-recommendation-item-content {
    flex: 1;
    color: white;
}

.top-recommendation-header {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 8px;
}

.top-recommendation-type {
    font-size: 0.75rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.top-recommendation-label {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.3;
}

.top-recommendation-meta {
    font-size: 0.8rem;
    opacity: 0.85;
    margin-top: 5px;
}

/* Cards Container */
.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

/* Card Styles */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.card.highlighted {
    border-color: #4facfe;
    box-shadow: 0 0 20px rgba(79, 172, 254, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 20px rgba(79, 172, 254, 0.3); }
    50% { box-shadow: 0 0 30px rgba(79, 172, 254, 0.5); }
    100% { box-shadow: 0 0 20px rgba(79, 172, 254, 0.3); }
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}

.card-header:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1.1rem;
}

.card-title i {
    font-size: 1.2rem;
}

.selected-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.card-toggle {
    transition: transform 0.3s ease;
}

.card.expanded .card-toggle {
    transform: rotate(180deg);
}

.card-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #fafafa;
}

.card.expanded .card-content {
    max-height: 600px;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Body Regions Specific Styles */
.selected-section, .recommended-section {
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
}

.selected-section h4, .recommended-section h4 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1rem;
    font-weight: 600;
}

.selected-items, .recommended-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.region-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.region-item:hover {
    border-color: #4facfe;
    transform: translateY(-1px);
}

.region-item.selected {
    background: #4facfe;
    color: white;
    border-color: #4facfe;
}

.region-item.recommended {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.region-item.recommended:hover {
    background: #ffc107;
    color: white;
}

.region-item i {
    font-size: 0.8rem;
}

/* Test Items */
.test-item {
    margin-bottom: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.test-item.deterministic {
    border: 2px solid #000;
}

.test-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.test-header {
    padding: 12px 16px;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.test-header:hover {
    background: #e9ecef;
}

.test-header.selected {
    background: #4facfe;
    color: white;
}

.test-header.recommended {
    background: #fff3cd;
    color: #856404;
}

.test-header.recommended:hover {
    background: #ffc107;
    color: white;
}

.test-header i {
    font-size: 0.9rem;
}

.measure-options {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.measure-option {
    padding: 6px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.measure-option input[type="radio"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.measure-option label {
    cursor: pointer;
    font-size: 0.9rem;
    color: #555;
    flex: 1;
}

.measure-option label:hover {
    color: #333;
}

/* Pattern Items */
.pattern-item {
    margin-bottom: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.pattern-item.deterministic {
    border: 2px solid #000;
}

.pattern-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pattern-header {
    padding: 12px 16px;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.pattern-header:hover {
    background: #e9ecef;
}

.pattern-header.selected {
    background: #4facfe;
    color: white;
}

.pattern-header.recommended {
    background: #fff3cd;
    color: #856404;
}

.pattern-header.recommended:hover {
    background: #ffc107;
    color: white;
}

.pattern-actions {
    display: flex;
    gap: 10px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.pattern-actions button {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-rule-in {
    background: #28a745;
    color: white;
}

.btn-rule-in:hover {
    background: #218838;
}

.btn-rule-out {
    background: #dc3545;
    color: white;
}

.btn-rule-out:hover {
    background: #c82333;
}

/* Intervention Items */
.intervention-group-section {
    margin-bottom: 20px;
}

.intervention-group-title {
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0e0e0;
}

.intervention-group-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.intervention-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.intervention-item:hover {
    border-color: #4facfe;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.intervention-item.selected {
    background: #4facfe;
    color: white;
    border-color: #4facfe;
}

.intervention-item.recommended {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.intervention-item.recommended:hover {
    background: #ffc107;
    color: white;
}

.intervention-info {
    font-size: 0.85rem;
    opacity: 0.7;
}

.intervention-item:hover .intervention-info {
    opacity: 1;
}

.intervention-time-input {
    transition: all 0.3s ease;
}

.intervention-time-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.8) !important;
    background-color: rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.intervention-time-input::-webkit-outer-spin-button,
.intervention-time-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.intervention-time-input[type=number] {
    -moz-appearance: textfield;
}

/* Exercise Items */
.exercise-item {
    margin-bottom: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.exercise-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.exercise-header {
    padding: 12px 16px;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.exercise-header:hover {
    background: #e9ecef;
}

.exercise-header.selected {
    background: #4facfe;
    color: white;
}

.exercise-header.recommended {
    background: #fff3cd;
    color: #856404;
}

.exercise-header.recommended:hover {
    background: #ffc107;
    color: white;
}

.exercise-header i {
    font-size: 0.9rem;
}

.exercise-sets-input,
.exercise-reps-input {
    transition: all 0.3s ease;
}

.exercise-sets-input:focus,
.exercise-reps-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.8) !important;
    background-color: rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.exercise-sets-input::-webkit-outer-spin-button,
.exercise-sets-input::-webkit-inner-spin-button,
.exercise-reps-input::-webkit-outer-spin-button,
.exercise-reps-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.exercise-sets-input[type=number],
.exercise-reps-input[type=number] {
    -moz-appearance: textfield;
}

/* Tooltip enhancement for intervention purpose */
.intervention-item[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: nowrap;
    max-width: 300px;
    font-size: 0.85rem;
    z-index: 1000;
    pointer-events: none;
    margin-bottom: 5px;
}

.intervention-item[title]:hover::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #333;
    margin-bottom: -7px;
    z-index: 1001;
}

/* Recommendations */
.recommendations-selected-section {
    margin-bottom: 20px;
}

.recommendations-selected-section h4 {
    color: #333;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.recommendations-selected-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.recommendations-filters-title {
    color: #333;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 15px;
    margin-top: 10px;
}

.recommendations-filters-container {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.recommendation-filter-section {
    border-bottom: 1px solid #e0e0e0;
}

.recommendation-filter-section:last-child {
    border-bottom: none;
}

.recommendation-filter-header {
    padding: 12px 16px;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    font-weight: 500;
}

.recommendation-filter-header:hover {
    background: #e9ecef;
}

.filter-toggle {
    transition: transform 0.3s ease;
    font-size: 0.9rem;
}

.recommendation-filter-content {
    padding: 12px;
    background: white;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
}

.recommendation-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recommendation-item:hover {
    border-color: #4facfe;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.recommendation-item.selected {
    background: #4facfe;
    color: white;
    border-color: #4facfe;
}

.recommendation-item.recommended {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.recommendation-item.recommended:hover {
    background: #ffc107;
    color: white;
}

.recommendation-item i {
    font-size: 0.85rem;
}

/* Goal Items */
.goal-item {
    margin-bottom: 12px;
    padding: 12px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.goal-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.goal-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.95rem;
}

.goal-content.selected {
    color: #2c3e50;
}

.goal-content.recommended {
    color: #856404;
}

.goal-content.recommended:hover {
    color: #333;
}

.goal-content i {
    font-size: 0.9rem;
    margin-right: 4px;
}

.goal-content .fa-check {
    color: #4facfe;
}

.goal-content .fa-lightbulb {
    color: #ffc107;
}

.goal-input-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 4px;
}

.goal-select {
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.goal-select:hover:not(:disabled) {
    border-color: #4facfe;
}

.goal-select:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 2px rgba(79, 172, 254, 0.2);
}

.goal-select:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

.goal-text-input {
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    min-width: 120px;
}

.goal-text-input:hover:not(:disabled) {
    border-color: #4facfe;
}

.goal-text-input:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 2px rgba(79, 172, 254, 0.2);
}

.goal-text-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

.goal-text-input::placeholder {
    color: #999;
    font-style: italic;
}

/* Recommendation Input Elements */
.recommendation-content {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.recommendation-input-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 2px;
}

.recommendation-select {
    padding: 2px 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.85rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

.recommendation-select:hover:not(:disabled) {
    border-color: #4facfe;
}

.recommendation-select:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 1px rgba(79, 172, 254, 0.3);
}

.recommendation-select:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

.recommendation-text-input {
    padding: 2px 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    min-width: 100px;
}

.recommendation-text-input:hover:not(:disabled) {
    border-color: #4facfe;
}

.recommendation-text-input:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 1px rgba(79, 172, 254, 0.3);
}

.recommendation-text-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

.recommendation-text-input::placeholder {
    color: #999;
    font-style: italic;
}

.recommendation-number-input {
    padding: 2px 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    background: white;
    width: 60px;
}

.recommendation-number-input:hover:not(:disabled) {
    border-color: #4facfe;
}

.recommendation-number-input:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 1px rgba(79, 172, 254, 0.3);
}

.recommendation-period-select {
    padding: 2px 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.85rem;
    background: white;
    margin-left: 4px;
}

.recommendation-period-select:hover:not(:disabled) {
    border-color: #4facfe;
}

.recommendation-period-select:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 1px rgba(79, 172, 254, 0.3);
}

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

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

.loading-spinner {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.loading-spinner i {
    font-size: 2rem;
    color: #4facfe;
    margin-bottom: 15px;
}

.loading-spinner p {
    color: #666;
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .cards-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .memo-header {
        padding: 12px 15px;
    }
    
    .memo-header h2 {
        font-size: 1.2rem;
    }
    
    .card-header {
        padding: 12px 15px;
    }
    
    .card-title {
        font-size: 1rem;
    }
    
    .card.expanded .card-content {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .memo-textarea {
        padding: 15px;
        font-size: 0.95rem;
    }
    
    .region-item {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

