/* Modal Styles - All modal components, overlays, popups, behavior logging, journal */

/* AI-Powered Tag Selection Styles */
.ai-suggest-tags-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-suggest-tags-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.tag-selection-container {
    margin-top: 16px;
}

.ai-suggested-tags, .popular-tags {
    margin: 16px 0;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.suggested-tags-header, .popular-tags-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.ai-icon {
    font-size: 1.2rem;
}

.popular-icon {
    font-size: 1rem;
}

.suggested-tags-grid, .popular-tags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.clickable-tag {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 16px !important;
    padding: 8px 12px !important;
    font-size: 0.85rem !important;
    color: #333 !important;
    cursor: pointer !important;
    transition: all 0.2s ease;
    text-align: center;
    user-select: none;
    white-space: nowrap;
    min-height: 36px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    margin: 3px !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15) !important;
    font-weight: 500;
}

.clickable-tag:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.clickable-tag.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    border-color: #667eea !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Tag type colors - stronger styling */
.clickable-tag.tag-emotion {
    border: 2px solid #ff6b6b;
    background: rgba(255, 107, 107, 0.15);
    color: #c0392b;
}

.clickable-tag.tag-behavior {
    border: 2px solid #4ecdc4;
    background: rgba(78, 205, 196, 0.15);
    color: #16a085;
}

.clickable-tag.tag-context {
    border: 2px solid #45b7d1;
    background: rgba(69, 183, 209, 0.15);
    color: #2980b9;
}

.clickable-tag.tag-trigger {
    border: 2px solid #f9ca24;
    background: rgba(249, 202, 36, 0.15);
    color: #d68910;
}

.clickable-tag.tag-skill {
    border: 2px solid #6c5ce7;
    background: rgba(108, 92, 231, 0.15);
    color: #5b2c87;
}

.clickable-tag.tag-social {
    border: 2px solid #00b894;
    background: rgba(0, 184, 148, 0.15);
    color: #00a085;
}

.clickable-tag.tag-academic {
    border: 2px solid #e84393;
    background: rgba(232, 67, 147, 0.15);
    color: #d63384;
}

.clickable-tag.tag-physical {
    border: 2px solid #fd79a8;
    background: rgba(253, 121, 168, 0.15);
    color: #e84393;
}

.clickable-tag.tag-regulation {
    border: 2px solid #74b9ff;
    background: rgba(116, 185, 255, 0.15);
    color: #0984e3;
}

.clickable-tag.tag-development {
    border: 2px solid #a29bfe;
    background: rgba(162, 155, 254, 0.15);
    color: #6c5ce7;
}

/* Fallback for tags without type class */
.clickable-tag:not([class*="tag-"]) {
    border: 2px solid #95a5a6;
    background: rgba(149, 165, 166, 0.15);
    color: #2c3e50;
}

.clickable-tag.selected.tag-emotion {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.clickable-tag.selected.tag-behavior {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(78, 205, 196, 0.4);
}

.clickable-tag.selected.tag-context {
    background: linear-gradient(135deg, #45b7d1 0%, #3742fa 100%);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(69, 183, 209, 0.4);
}

.clickable-tag.selected.tag-trigger {
    background: linear-gradient(135deg, #f9ca24 0%, #f0932b 100%);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(249, 202, 36, 0.4);
}

.clickable-tag.selected.tag-skill {
    background: linear-gradient(135deg, #6c5ce7 0%, #5f3dc4 100%);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.4);
}

.clickable-tag.selected.tag-social {
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 184, 148, 0.4);
}

.clickable-tag.selected.tag-academic {
    background: linear-gradient(135deg, #e84393 0%, #d63384 100%);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(232, 67, 147, 0.4);
}

.clickable-tag.selected.tag-physical {
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(253, 121, 168, 0.4);
}

.clickable-tag.selected.tag-regulation {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(116, 185, 255, 0.4);
}

.clickable-tag.selected.tag-development {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(162, 155, 254, 0.4);
}

.manual-search-container {
    margin: 16px 0;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.show-search-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 8px 0;
}

.show-search-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.tag-help-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 8px;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .clickable-tag {
        padding: 8px 12px;
        font-size: 0.85rem;
        min-height: 36px;
        margin: 2px;
    }
    
    .ai-suggested-tags, .popular-tags {
        padding: 12px;
        margin: 12px 0;
    }
    
    .suggested-tags-header, .popular-tags-header {
        font-size: 0.8rem;
        margin-bottom: 8px;
    }
    
    .suggested-tags-grid, .popular-tags-grid {
        gap: 4px;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-heavy);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.3s ease;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 22px;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Behavior Logging Modal */
.behavior-modal {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 0;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-heavy);
}

.behavior-modal-header {
    background: var(--gradient-secondary);
    color: white;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.behavior-modal-header-content {
    flex: 1;
    text-align: center;
}

.behavior-modal-header .modal-close {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 20px;
    width: 36px;
    height: 36px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.behavior-modal-header .modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.behavior-modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.behavior-modal-subtitle {
    opacity: 0.9;
    font-size: 0.95rem;
}

.behavior-modal-content {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.behavior-form-group {
    margin-bottom: 24px;
}

.behavior-form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.behavior-textarea {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.behavior-textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(240, 147, 251, 0.1);
}

.behavior-textarea::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.child-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.child-option {
    padding: 16px;
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.child-option:hover {
    border-color: #ff6b6b;
    transform: translateY(-2px);
}

.child-option.selected {
    border-color: #ff6b6b;
    background: linear-gradient(135deg, #ff6b6b 0%, #ffa726 100%);
    color: white;
}

.child-option-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-size: 18px;
    font-weight: 600;
}

.child-option.selected .child-option-avatar {
    background: rgba(255, 255, 255, 0.2);
}

.child-option-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.behavior-type-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
    margin-bottom: 24px;
}

.behavior-type-option {
    padding: 12px 16px;
    border: 2px solid var(--glass-border);
    border-radius: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    backdrop-filter: blur(5px);
}

.behavior-type-option:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-light);
}

.behavior-type-option.positive {
    border-color: rgba(74, 222, 128, 0.5);
    color: var(--success-color);
}

.behavior-type-option.positive.selected {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.3), rgba(74, 222, 128, 0.2));
    border-color: var(--success-color);
    color: var(--success-color);
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.3);
}

.behavior-type-option.negative {
    border-color: rgba(248, 113, 113, 0.5);
    color: var(--error-color);
}

.behavior-type-option.negative.selected {
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.3), rgba(248, 113, 113, 0.2));
    border-color: var(--error-color);
    color: var(--error-color);
    box-shadow: 0 0 20px rgba(248, 113, 113, 0.3);
}

.behavior-type-option.neutral {
    border-color: rgba(156, 163, 175, 0.5);
    color: #9ca3af;
}

.behavior-type-option.neutral.selected {
    background: linear-gradient(135deg, rgba(156, 163, 175, 0.3), rgba(156, 163, 175, 0.2));
    border-color: #9ca3af;
    color: #9ca3af;
    box-shadow: 0 0 20px rgba(156, 163, 175, 0.3);
}

.behavior-type-option.milestone {
    border-color: rgba(168, 85, 247, 0.5);
    color: #a855f7;
}

.behavior-type-option.milestone.selected {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(168, 85, 247, 0.2));
    border-color: #a855f7;
    color: #a855f7;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.3);
}

.behavior-type-option.medical {
    border-color: rgba(59, 130, 246, 0.5);
    color: #3b82f6;
}

.behavior-type-option.medical.selected {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(59, 130, 246, 0.2));
    border-color: #3b82f6;
    color: #3b82f6;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.tag-input-container {
    position: relative;
}

.tag-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    backdrop-filter: blur(5px);
}

.tag-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(240, 147, 251, 0.1);
}

.tag-input::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-medium);
}

.tag-suggestion {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.tag-suggestion:last-child {
    border-bottom: none;
}

.tag-suggestion:hover {
    background: rgba(255, 255, 255, 0.15);
}

.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.tag-chip {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tag-chip-remove {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}

/* ===== ENHANCED TAG STYLING WITH TYPES ===== */

/* Enhanced tag suggestions */
.enhanced-suggestion {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
}

.tag-suggestion-icon {
    font-size: 16px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.tag-suggestion-content {
    flex: 1;
    min-width: 0;
}

.tag-suggestion-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.tag-suggestion-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-suggestion-meta {
    flex-shrink: 0;
    text-align: right;
}

.tag-frequency {
    font-size: 10px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

/* Enhanced tag chips with type indicators */
.tag-chip.tag-type-behavior {
    background: linear-gradient(135deg, #4caf50 0%, #81c784 100%);
}

.tag-chip.tag-type-emotion {
    background: linear-gradient(135deg, #ff9800 0%, #ffb74d 100%);
}

.tag-chip.tag-type-context {
    background: linear-gradient(135deg, #2196f3 0%, #64b5f6 100%);
}

.tag-chip.tag-type-trigger {
    background: linear-gradient(135deg, #e91e63 0%, #f06292 100%);
}

.tag-chip.tag-type-skill {
    background: linear-gradient(135deg, #9c27b0 0%, #ba68c8 100%);
}

.tag-icon {
    font-size: 12px;
    flex-shrink: 0;
}

.tag-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== ENHANCED TAG INPUT COMPONENT (TASK 03) ===== */

.tag-input-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.tag-help-text {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: normal;
    font-style: italic;
}

.tag-input-wrapper {
    position: relative;
}

.enhanced-tag-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    backdrop-filter: blur(5px);
}

.enhanced-tag-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(240, 147, 251, 0.1);
    background: rgba(255, 255, 255, 0.15);
}

/* Enhanced Autocomplete Dropdown */
.tag-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: var(--shadow-heavy);
    z-index: 1000;
    max-height: 320px;
    overflow: hidden;
    margin-top: 4px;
}

.tag-dropdown-header {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tag-dropdown-title {
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-dropdown-count {
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}

.tag-dropdown-content {
    max-height: 220px;
    overflow-y: auto;
    padding: 4px 0;
}

/* Enhanced Tag Suggestions */
.tag-suggestion {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.15s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    position: relative;
}

.tag-suggestion:hover,
.tag-suggestion.highlighted {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(2px);
}

.tag-suggestion.selected {
    background: rgba(240, 147, 251, 0.1);
    color: var(--accent-color);
}

.tag-suggestion.keyboard-focus {
    background: rgba(240, 147, 251, 0.15);
    border-left: 3px solid var(--accent-color);
}

.tag-type-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.tag-suggestion:hover .tag-type-icon {
    transform: scale(1.1);
}

/* Tag type color coding for icons */
.tag-type-icon.tag-type-behavior { 
    background: rgba(76, 175, 80, 0.2); 
    color: #4caf50; 
}
.tag-type-icon.tag-type-emotion { 
    background: rgba(255, 152, 0, 0.2); 
    color: #ff9800; 
}
.tag-type-icon.tag-type-context { 
    background: rgba(33, 150, 243, 0.2); 
    color: #2196f3; 
}
.tag-type-icon.tag-type-trigger { 
    background: rgba(233, 30, 99, 0.2); 
    color: #e91e63; 
}
.tag-type-icon.tag-type-skill { 
    background: rgba(156, 39, 176, 0.2); 
    color: #9c27b0; 
}

.tag-suggestion-main {
    flex: 1;
    min-width: 0;
}

.tag-suggestion-name {
    font-weight: 500;
    margin-bottom: 2px;
    color: var(--text-primary);
    font-size: 14px;
}

.tag-suggestion-description {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.tag-suggestion-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.tag-frequency {
    font-size: 10px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    min-width: 20px;
    text-align: center;
}

.tag-age-range {
    font-size: 9px;
    color: var(--text-muted);
    font-style: italic;
}

/* Selected Tags Display */
.selected-tags-container {
    margin-top: 12px;
}

.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    min-height: 40px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px dashed var(--glass-border);
    transition: all 0.3s ease;
}

.selected-tags.has-tags {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-style: solid;
}

.selected-tags.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-style: italic;
    color: var(--text-muted);
    font-size: 13px;
}

.selected-tags-count {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
}

/* Enhanced Tag Chips with improved styling */
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s ease;
    cursor: default;
    max-width: 160px;
    backdrop-filter: blur(10px);
}

.tag-chip:hover {
    border-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(240, 147, 251, 0.2);
    transform: translateY(-1px);
}

.tag-chip-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.tag-remove {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--text-primary);
    opacity: 0.6;
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.tag-remove:hover {
    opacity: 1;
    background: rgba(255, 107, 107, 0.8);
    color: white;
    transform: scale(1.1);
}

/* Create New Tag Button */
.tag-dropdown-footer {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid var(--glass-border);
}

.tag-create-new {
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: 1px dashed var(--glass-border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.tag-create-new:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(240, 147, 251, 0.05);
}

.plus-icon {
    font-weight: bold;
    font-size: 14px;
}

/* Loading State */
.tag-dropdown.loading .tag-dropdown-content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.tag-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No suggestions state */
.tag-no-suggestions {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    font-size: 13px;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .tag-dropdown {
        max-height: 280px;
    }
    
    .tag-suggestion {
        padding: 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .tag-suggestion:last-child {
        border-bottom: none;
    }
    
    .tag-input-label {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .enhanced-tag-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 14px 16px;
    }
    
    .tag-chip {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .tag-suggestion-name {
        font-size: 15px;
    }
    
    .tag-suggestion-description {
        max-width: 150px;
    }
}

/* Accessibility enhancements */
.tag-suggestion:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: -2px;
}

.enhanced-tag-input:focus {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .tag-dropdown {
        border: 2px solid;
    }
    
    .tag-suggestion.highlighted {
        background: rgba(255, 255, 255, 0.3);
    }
    
    .tag-chip {
        border: 2px solid;
    }
}

/* Behavior form actions - now inside scrollable content */
.behavior-form-actions {
    padding: 24px 0 0 0;
    margin-top: 24px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

/* Legacy footer styles - kept for backward compatibility but hidden */
.behavior-modal-footer {
    display: none; /* Hidden since buttons moved to scrollable area */
}

.btn-behavior-primary {
    flex: 1;
    padding: 14px 24px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-light);
}

.btn-behavior-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.btn-behavior-secondary {
    flex: 1;
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.btn-behavior-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

#behaviorMessage {
    padding: 0 24px;
}

#behaviorMessage .message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}

#behaviorMessage .message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#behaviorMessage .message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Journal Modal Styles */
.journal-modal {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    max-width: 900px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-heavy);
}

.journal-modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.journal-modal-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.journal-filters {
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--glass-border);
}

.filter-group {
    margin-bottom: 16px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-label {
    display: block;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.child-filter-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.child-pill {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 2px solid var(--glass-border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.child-pill:hover {
    border-color: #667eea;
}

.child-pill.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.search-inputs {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-clear-filters {
    padding: 12px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.btn-clear-filters:hover {
    background: #5a6268;
}

.journal-events {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    min-height: 300px;
}

.loading-message {
    text-align: center;
    color: #666;
    padding: 40px;
    font-size: 16px;
}

.journal-event {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.journal-event:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.journal-event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.journal-event-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.journal-event-child {
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.journal-event-date {
    color: #666;
    font-size: 14px;
}

.journal-event-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.journal-event:hover .journal-event-actions {
    opacity: 1;
}

.journal-action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.journal-action-btn.edit {
    background: #e3f2fd;
    color: #1976d2;
}

.journal-action-btn.edit:hover {
    background: #1976d2;
    color: white;
}

.journal-action-btn.delete {
    background: #ffebee;
    color: #d32f2f;
}

.journal-action-btn.delete:hover {
    background: #d32f2f;
    color: white;
}

.journal-event-type {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.journal-event-type.positive {
    background: #d4edda;
    color: #155724;
}

.journal-event-type.negative {
    background: #f8d7da;
    color: #721c24;
}

.journal-event-type.neutral {
    background: #e2e3e5;
    color: #383d41;
}

.journal-event-type.milestone {
    background: #e2e9f4;
    color: #495057;
}

.journal-event-description {
    color: #555;
    line-height: 1.5;
    margin-bottom: 12px;
}

.journal-event-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.journal-event-tag {
    background: #f8f9fa;
    color: #666;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.no-events-message {
    text-align: center;
    color: #666;
    padding: 60px 20px;
}

.no-events-message h4 {
    margin-bottom: 8px;
    color: #555;
}

.no-events-message p {
    margin-bottom: 20px;
}

.no-events-message button {
    padding: 12px 24px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ffa726 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: transform 0.2s ease;
}

.no-events-message button:hover {
    transform: translateY(-2px);
}

.edit-child-display {
    padding: 12px 16px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    color: #555;
    font-weight: 500;
}

/* Mobile Responsiveness for Modals */
@media (max-width: 576px) {
    .modal {
        width: 95%;
        max-width: none;
        margin: 10px;
        padding: 20px;
    }
    
    .behavior-modal {
        width: 95%;
        max-width: none;
        margin: 5vh 2.5%;
        max-height: 90vh;
    }
    
    .behavior-modal-content {
        padding: 20px;
        max-height: 70vh;
    }
    
    .journal-modal {
        width: 95%;
        max-width: none;
        margin: 5vh 2.5%;
        max-height: 90vh;
    }
    
    .child-selector {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .child-option {
        padding: 12px 8px;
    }
    
    .behavior-type-selector {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 6px;
    }
    
    .behavior-form-actions {
        padding: 20px 0 0 0;
        margin-top: 20px;
        flex-direction: column;
        gap: 12px;
    }
    
    .btn-behavior-primary,
    .btn-behavior-secondary {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .btn-behavior-secondary {
        margin-bottom: 0;
    }
}

/* PROFESSIONAL MOBILE UX - FULL COMPLIANCE */
@media (max-width: 480px) {
    .modal {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        margin: 0;
        padding: 20px;
        border-radius: 0;
        padding-top: calc(20px + env(safe-area-inset-top, 0px));
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }
    
    .modal-title {
        font-size: 1.4rem;
        font-weight: 700;
    }
    
    .behavior-modal {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        margin: 0;
        border-radius: 0;
    }
    
    .behavior-modal-header {
        padding: 24px 20px;
        padding-top: calc(24px + env(safe-area-inset-top, 0px));
    }
    
    .behavior-modal-header .modal-close {
        right: 16px;
        width: 44px;
        height: 44px;
        border-radius: 22px;
        font-size: 24px;
        background: rgba(255, 255, 255, 0.15);
        border: 2px solid rgba(255, 255, 255, 0.25);
        min-width: 44px;
        min-height: 44px;
    }
    
    .behavior-modal-header .modal-close:hover {
        background: rgba(255, 255, 255, 0.25);
        border-color: rgba(255, 255, 255, 0.4);
    }
    
    .behavior-modal-title {
        font-size: 1.4rem;
        font-weight: 700;
    }
    
    .behavior-modal-content {
        padding: 20px;
        max-height: calc(100vh - 160px); /* Increased available space since no fixed footer */
        max-height: calc(100dvh - 160px); /* More space for content + buttons inside scroll area */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); /* Ensure safe area at bottom */
    }
    
    .behavior-form-actions {
        padding: 20px 0;
        margin-top: 20px;
        flex-direction: column;
        gap: 12px;
        background: rgba(255, 255, 255, 0.05);
        border-top: 1px solid var(--glass-border);
    }
    
    .behavior-textarea {
        min-height: 120px;
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 16px 20px;
        border-radius: 12px;
    }
    
    .tag-input {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 14px 18px;
        min-height: 48px;
        border-radius: 12px;
    }
    
    .search-input {
        font-size: 16px !important; /* Prevents zoom on iOS */
        min-width: 150px;
        min-height: 48px;
        padding: 14px 18px;
        border-radius: 12px;
    }
    
    .child-selector {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 12px;
    }
    
    .child-option {
        padding: 16px 12px;
        min-height: 80px;
        border-radius: 16px;
    }
    
    .child-option-name {
        font-size: 0.9rem;
        font-weight: 600;
    }
    
    .behavior-type-selector {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 8px;
    }
    
    .behavior-type-option {
        padding: 14px 16px;
        font-size: 15px;
        min-height: 48px;
        border-radius: 24px;
        font-weight: 600;
    }
    
    .btn-behavior-primary,
    .btn-behavior-secondary {
        min-height: 52px;
        padding: 16px 24px;
        font-size: 17px;
        font-weight: 700;
        border-radius: 16px;
    }
    
    .journal-modal {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        margin: 0;
        border-radius: 0;
    }
    
    .journal-filters {
        padding: 20px;
    }
    
    .journal-events {
        padding: 20px;
        max-height: calc(100vh - 300px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .search-inputs {
        flex-direction: column;
        gap: 12px;
    }
    
    .btn-clear-filters {
        min-height: 48px;
        padding: 14px 20px;
        font-size: 16px;
        border-radius: 12px;
    }
    
    .journal-action-btn {
        min-height: 40px;
        padding: 10px 16px;
        font-size: 14px;
        border-radius: 10px;
    }
}