/**
 * Custom CSS for Writing Coach Platform
 */

/* General Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

/* Card Styles */
.card {
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.card-header {
    font-weight: 600;
    border-radius: 10px 10px 0 0 !important;
}

/* Writing Content Area */
#writing-content {
    font-size: 1.05rem;
    line-height: 1.7;
    min-height: 50vh;
    max-height: 70vh;
    overflow-y: auto;
}

#writing-panel .card-body {
    padding: 0.5rem 0.75rem;
}

.writing-block {
    padding: 8px 10px;
    margin-bottom: 6px;
    background: white;
    border-left: 3px solid #007bff;
    border-radius: 4px;
    position: relative;
}

.writing-block:hover {
    background: #f0f8ff;
}

.block-number {
    position: absolute;
    top: 3px;
    right: 8px;
    font-size: 0.75rem;
    color: #6c757d;
}

/* Variant Options */
.variant-option {
    padding: 10px 12px;
    margin-bottom: 6px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.variant-option:hover {
    border-color: #007bff;
    background: #f0f8ff;
}

.variant-option.selected {
    border-color: #28a745;
    background: #d4edda;
}

.variant-word-count {
    font-size: 0.85rem;
    color: #6c757d;
    float: right;
}

/* Prompt Suggestions */
.prompt-suggestion {
    cursor: pointer;
    transition: all 0.3s;
}

.prompt-suggestion:hover {
    background: #007bff;
    color: white;
}

/* Why This? Button & Panel */
.btn-xs {
    padding: 0.1rem 0.35rem;
    font-size: 0.7rem;
    line-height: 1.3;
}

.why-this-btn {
    white-space: nowrap;
    font-size: 0.75rem;
}

.variant-option .why-this-btn {
    font-size: 0.8rem;
}

.why-this-panel {
    background: #f0f7ff;
    border-left: 3px solid #0d6efd;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.85rem;
}

.why-this-panel .why-this-content .small {
    line-height: 1.5;
}

.prompt-suggestion-row,
.textarea-suggestion-row {
    padding: 6px 14px;
}

.prompt-suggestion-row .prompt-suggestion,
.textarea-suggestion-row .textarea-suggestion-item {
    text-decoration: none;
    color: inherit;
}

/* Session Status Badges */
.badge-active {
    background-color: #28a745;
}

.badge-completed {
    background-color: #6c757d;
}

/* Sidebar Menu */
.list-group-item {
    border: none;
    padding: 12px 20px;
    transition: all 0.3s;
}

.list-group-item:hover {
    background: #f0f8ff;
    padding-left: 25px;
}

.list-group-item.active {
    background: #007bff;
    color: white;
}

.list-group-item i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Admin Panels */
.table-hover tbody tr:hover {
    background-color: #f0f8ff;
}

/* Statistics Cards */
.stat-card {
    text-align: center;
    padding: 20px;
    border-radius: 10px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.stat-card .stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #007bff;
}

.stat-card .stat-label {
    color: #6c757d;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* xAPI Logs */
.log-entry {
    padding: 10px;
    margin-bottom: 5px;
    background: white;
    border-left: 3px solid #17a2b8;
    border-radius: 5px;
}

.log-entry .log-timestamp {
    font-size: 0.85rem;
    color: #6c757d;
}

.log-entry .log-verb {
    font-weight: bold;
    color: #007bff;
}

.log-entry .log-actor {
    color: #28a745;
}

/* Comments Section */
.comment-box {
    padding: 10px;
    margin-bottom: 10px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.comment-header {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 5px;
}

.comment-header .comment-author {
    font-weight: bold;
    color: #333;
}

.comment-content {
    font-size: 1rem;
    line-height: 1.5;
}

.ai-critique-comment {
    background: #fff3cd;
    border-color: #ffc107;
}

/* Loading Spinner */
.spinner-container {
    text-align: center;
    padding: 50px;
}

.spinner-border-sm {
    width: 0.85rem;
    height: 0.85rem;
    border-width: 0.15em;
}

/* Toast Notifications */
.toast {
    min-width: 300px;
}

.toast-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.toast-error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.toast-info {
    background-color: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

/* Modal Styles */
.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* Form Styles */
.form-control:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Button Styles */
.btn {
    border-radius: 5px;
    font-weight: 500;
    transition: all 0.3s;
}

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

/* Responsive Adjustments */
@media (max-width: 768px) {
    .sidebar {
        margin-bottom: 20px;
    }
    
    .stat-card .stat-value {
        font-size: 2rem;
    }
    
    #writing-content {
        min-height: 200px;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in {
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Block History List */
#blocks-list .block-item {
    padding: 8px;
    margin-bottom: 5px;
    background: #f8f9fa;
    border-radius: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
}

#blocks-list .block-item:hover {
    background: #e9ecef;
}

#blocks-list .block-item .block-preview {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* User Role Badges */
.role-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.role-badge.admin {
    background: #dc3545;
    color: white;
}

.role-badge.author {
    background: #007bff;
    color: white;
}

.role-badge.reader {
    background: #28a745;
    color: white;
}

/* Session Card Styles */
.session-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.3s;
}

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

.session-card .session-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.session-card .session-meta {
    font-size: 0.9rem;
    color: #6c757d;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h5 {
    color: #495057;
    margin-bottom: 10px;
}

/* Progress Indicator */
.progress-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s;
    z-index: 9999;
}

.progress-indicator.active {
    transform: scaleX(1);
}

/* AI Suggestion Dropdowns */
.ai-suggestions-dropdown {
    position: relative;
    z-index: 1050;
    min-width: 100%;
    max-width: 100%;
    max-height: 280px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0,0,0,.12);
    padding: 4px 0;
    margin-top: 2px;
}

.ai-suggestions-dropdown .dropdown-item {
    padding: 6px 14px;
    font-size: 0.875rem;
    cursor: pointer;
    white-space: normal;
    word-break: break-word;
}

.ai-suggestions-dropdown .dropdown-item:hover,
.ai-suggestions-dropdown .dropdown-item:focus {
    background: #e9ecef;
    color: #212529;
}

.ai-suggestions-dropdown .dropdown-item.text-muted {
    cursor: default;
    font-style: italic;
}

/* Required field highlighting */
.form-control.is-required,
.form-select.is-required {
    border-left: 3px solid #dc3545;
}

.form-control.is-required:focus,
.form-select.is-required:focus {
    border-left: 3px solid #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.18);
}

.label-required {
    color: #dc3545;
    font-weight: 700;
}

/* Floating Story Panel */
#story-panel {
    position: fixed;
    top: 80px;
    right: 40px;
    width: 500px;
    height: 400px;
    min-width: 300px;
    min-height: 200px;
    resize: both;
    overflow: hidden;
    z-index: 1040;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
}

#story-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: move;
    user-select: none;
    border-radius: 10px 10px 0 0;
    font-weight: 600;
}

#story-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
}

/* AI Suggestion modal items */
#ai-suggest-list .suggest-item {
    cursor: pointer;
    transition: background-color 0.15s;
}
#ai-suggest-list .suggest-item:hover {
    background-color: rgba(13, 110, 253, 0.06);
}
#ai-suggest-list .suggest-item.selected {
    background-color: rgba(13, 110, 253, 0.1);
    border-left: 3px solid #0d6efd;
}
#ai-suggest-list .suggest-item .suggest-explanation {
    display: none;
    margin-top: 4px;
}
#ai-suggest-list .suggest-item.show-explanation .suggest-explanation {
    display: block;
}

/* Highlight inputs/selects/textareas that have a value */
#new-session-modal .form-control.has-value,
#new-session-modal .form-select.has-value {
    border-color: #0d6efd;
    background-color: #f0f4ff;
    box-shadow: inset 0 0 0 1px rgba(13, 110, 253, 0.15);
}
[data-bs-theme="dark"] #new-session-modal .form-control.has-value,
[data-bs-theme="dark"] #new-session-modal .form-select.has-value {
    border-color: #6ea8fe;
    background-color: rgba(13, 110, 253, 0.1);
}
