/* ai-therapist.css - Modern Redesign */

:root {
    --primary-gradient: linear-gradient(135deg, #00BCD4 0%, #28a745 100%);
    --secondary-gradient: linear-gradient(135deg, #28a745 0%, #00BCD4 100%);
    --surface-color: #ffffff;
    --surface-elevated: #f8fafc;
    --surface-hover: #f1f5f9;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --accent-blue: #00BCD4;
    --accent-green: #28a745;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
}

/* ===== LAYOUT ===== */
.ai-therapist-container {
    display: flex;
    height: calc(100vh - 3rem);
    margin-top: 3rem;
    background: none;
    position: relative;
}

/* ===== SIDEBAR ===== */
.ai-sidebar {
    width: 280px;
    background: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 50;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.02);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-elevated);
}

.sidebar-header h2 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: 0;
}

.drawer-close-btn {
    background: none;
    width: 40px;
    height: 40px;
    border: 1px;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-close-btn:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

/* ===== NEW FORM BUTTON ===== */
.new-conversation-btn {
    margin: 16px;
    padding: 14px 16px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all var(--transition-base);
    box-shadow: 0 2px 8px rgba(0, 188, 212, 0.25);
    position: relative;
    overflow: hidden;
}

.new-conversation-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.new-conversation-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 188, 212, 0.35);
}

.new-conversation-btn:hover::after {
    left: 100%;
}

/* ===== HISTORY LIST ===== */
.history-title {
    padding: 16px 20px 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
}

.history-item {
    padding: 14px 16px;
    margin-bottom: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    background: var(--surface-elevated);
    position: relative;
}

.history-item:hover {
    background: var(--surface-hover);
    border-color: var(--border-color);
    transform: translateX(2px);
}

.history-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 3px;
    background: var(--primary-gradient);
    border-radius: 0 2px 2px 0;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.history-item:hover::before {
    opacity: 1;
}

.item-title {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.item-sub {
    color: var(--text-secondary);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ===== MAIN CONTENT ===== */
.ai-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: none;
}

/* ===== HEADER ===== */
.tool-header {
    padding: 16px 28px;
    margin-top: 20px;
    background: none;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 10;
}

.tool-header h2 {
    font-size: 1.4rem;
    color: var(--text-primary);
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.tool-header h2 i {
    color: var(--accent-blue);
    font-size: 1.2em;
}

.sidebar-toggle {
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    font-size: 1.2rem;
}

.sidebar-toggle:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-color: var(--accent-blue);
    transform: translateY(-1px);
}

/* ===== ACTION BUTTONS ===== */
.action-buttons {
    display: flex;
    gap: 12px;
}

.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-base);
    letter-spacing: 0.02em;
}

.btn-primary {
    background: var(--secondary-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.35);
}

.btn-secondary {
    background: var(--surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--text-tertiary);
    transform: translateY(-1px);
}

/* ===== GENERATOR CONTAINER ===== */
.generator-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 30px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    height: 100%;
}

/* ===== CONFIG PANEL ===== */
.config-panel {
    width: 100%;
    max-width: 680px;
    animation: fadeInUp 0.5s ease;
}

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

/* ===== FORM CARDS ===== */
.form-card {
    background: var(--surface-color);
    padding: 28px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    transition: box-shadow var(--transition-base);
}

.form-card:hover {
    box-shadow: var(--shadow-lg);
}

.form-card h3 {
    margin-bottom: 22px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.1rem;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--surface-hover);
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-card h3::before {
    content: '';
    width: 6px;
    height: 20px;
    background: var(--primary-gradient);
    border-radius: 3px;
}

/* ===== FORM ELEMENTS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--surface-elevated);
    transition: all var(--transition-fast);
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: var(--surface-color);
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-row .form-group {
    flex: 1;
}

/* ===== RANGE SLIDER ===== */
.range-slider {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0;
}

.range-slider input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-gradient);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: var(--shadow-sm);
}

.range-slider input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-gradient);
    cursor: pointer;
    border: 1px solid white;
    box-shadow: var(--shadow-sm);
}

.range-slider span {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    min-width: 60px;
}

/* ===== GENERATE BUTTON ===== */
.generate-btn {
    width: 100%;
    padding: 18px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 15px rgba(0, 188, 212, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.02em;
}

.generate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 188, 212, 0.35);
}

.generate-btn:hover::before {
    left: 100%;
}

.generate-btn i {
    font-size: 1.2em;
    transition: transform 0.3s ease;
}

.generate-btn:hover i {
    transform: scale(1.1) rotate(5deg);
}

/* ===== DISCLAIMER ===== */
.disclaimer {
    margin-top: 16px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.disclaimer a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.disclaimer a:hover {
    color: var(--primary-gradient);
    text-decoration: underline;
}

/* ===== DOCUMENT PREVIEW ===== */
.document-preview {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    animation: fadeIn 0.4s ease;
    background-color: transparent;
    margin: 0;
    max-width: 100%;
}

/* ===== PAPER - UPDATED FOR SCREEN FIT ===== */
.paper {
    background: var(--surface-color);
    width: 100%;
    max-width: 210mm; /* Maximum width for larger screens */
    min-height: 297mm;
    padding: 25mm;
    box-shadow: var(--shadow-lg);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: visible; /* Changed from scroll/hidden */
    margin: 0 auto; /* Center the paper */
    box-sizing: border-box; /* Include padding in width calculation */
}

.paper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
}

/* ===== LOADING STATE ===== */
.loading-state {
    text-align: center;
    padding: 60px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 400px;
    margin: 0 auto;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 3px solid var(--surface-hover);
    border-top: 3px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
    margin-bottom: 24px;
    position: relative;
}

.spinner::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: rgba(59, 130, 246, 0.3);
    animation: spin 1.5s linear infinite;
}

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

.loading-state h3 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 1.3rem;
}

.loading-state p {
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 300px;
}

/* ===== AI GENERATED HTML STYLES ===== */
.paper h1, .paper h2, .paper h3, .paper h4 {
    color: var(--text-primary);
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
}

.paper h1 {
    text-align: center;
    border-bottom: 3px solid var(--surface-hover);
    padding-bottom: 16px;
    margin-top: 0;
    color: var(--text-primary);
    font-size: 2.2rem;
}

.paper .section-header {
    background: linear-gradient(90deg, #f0f9ff 0%, #f8fafc 100%);
    padding: 14px 20px;
    border-left: 4px solid var(--accent-blue);
    margin-top: 28px;
    font-weight: 600;
    color: var(--text-primary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.paper label {
    font-weight: 500;
    display: block;
    margin-top: 16px;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.paper input[type="text"],
.paper textarea,
.paper select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-elevated);
    font-family: inherit;
    margin-top: 8px;
    transition: all var(--transition-fast);
    color: var(--text-primary);
    box-sizing: border-box; /* Ensure consistent sizing */
}

.paper input[type="text"]:focus,
.paper textarea:focus,
.paper select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: var(--surface-color);
}

.paper textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

.paper .checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
}

.paper .checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface-elevated);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.paper .checkbox-item:hover {
    background: var(--surface-hover);
    transform: translateY(-1px);
}

.paper table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.paper th, .paper td {
    border: 1px solid var(--border-color);
    padding: 14px 16px;
    text-align: left;
}

.paper th {
    background: linear-gradient(90deg, #f8fafc 0%, #f1f5f9 100%);
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.paper td {
    background: var(--surface-color);
}

.paper td:hover {
    background: var(--surface-hover);
}

.paper a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.paper a:hover {
    color: var(--primary-gradient);
    text-decoration: underline;
}

/* ===== STATUS INDICATOR ===== */
.status-indicator {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--secondary-gradient);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInUp 0.3s ease;
    z-index: 1000;
}

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

/* ===== RESPONSIVE DESIGN ===== */
@media screen and (max-width: 1200px) {
    .paper {
        width: 100%;
        max-width: 100%;
        padding: 20px;
        margin: 0;
        border-radius: var(--radius-md);
    }
    
    .form-row {
        flex-direction: column;
        gap: 16px;
    }
    
    .generator-container {
        padding: 20px;
    }
}

@media screen and (max-width: 992px) {
    .ai-sidebar {
        position: fixed;
        left: -100%;
        height: calc(100vh - 3rem);
        top: 3rem;
        box-shadow: var(--shadow-lg);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .ai-sidebar.active {
        left: 0;
    }
    
    .tool-header {
        padding: 16px 20px;
    }
    
    .generator-container {
        padding: 15px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-primary, .btn-secondary {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    
    .paper {
        padding: 15px;
        min-height: auto;
        box-shadow: var(--shadow-md);
    }
}

@media screen and (max-width: 768px) {
    .ai-therapist-container {
        height: calc(100vh - 3rem);
        margin-top: 1rem;
    }
    
    .tool-header {
        padding: 12px 15px;
    }
    
    .tool-header h2 {
        font-size: 1.2rem;
    }
    
    .generator-container {
        padding: 10px;
    }
    
    .generate-btn {
        padding: 16px;
        font-size: 1rem;
    }
    
    .paper {
        padding: 12px;
        border-radius: var(--radius-sm);
        box-shadow: var(--shadow-sm);
    }
    
    .paper h1 {
        font-size: 1.8rem;
        padding-bottom: 12px;
    }
    
    .form-card {
        padding: 20px;
    }
}

@media screen and (max-width: 480px) {
    .tool-header {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .tool-header h2 {
        order: 1;
        width: 100%;
        margin-bottom: 12px;
    }
    
    .sidebar-toggle {
        order: 2;
    }
    
    .action-buttons {
        order: 3;
        width: 100%;
        flex-direction: row;
        justify-content: flex-end;
    }
    
    .generate-btn {
        font-size: 0.95rem;
        padding: 14px;
    }
    
    .paper {
        padding: 10px;
    }
    
    .paper h1 {
        font-size: 1.5rem;
    }
    
    .paper h2 {
        font-size: 1.2rem;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .l-header, .ai-sidebar, .tool-header, .sidebar-toggle, .action-buttons {
        display: none !important;
    }
    
    .ai-therapist-container {
        margin: 0;
        height: auto;
        background: none;
    }
    
    .ai-main {
        overflow: visible;
    }
    
    .document-preview {
        display: block !important;
        padding: 0;
    }
    
    .paper {
        box-shadow: none;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 15mm !important;
        border: none !important;
        border-radius: 0 !important;
        min-height: 297mm !important;
    }
    
    .paper::before {
        display: none;
    }
    
    .page-break {
        page-break-after: always;
    }
}

/* ===== SCROLLBAR STYLING ===== */
.history-list::-webkit-scrollbar,
.generator-container::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track,
.generator-container::-webkit-scrollbar-track {
    background: var(--surface-hover);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb,
.generator-container::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover,
.generator-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ===== EVALUATION SECTION STYLES ===== */
#evaluationControls {
    animation: fadeInUp 0.5s ease;
    width: 100%;
    max-width: 210mm;
    margin-top: 24px;
    display: none;
}

#evaluateBtn {
    margin-bottom: 20px;
    width: 100%;
}

/* Specific styling for the generated report */
.report-header {
    background: #e6fffa;
    color: #047481;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #b2f5ea;
}

.diagnosis-box {
    border-left: 4px solid #e53e3e;
    padding-left: 15px;
    margin: 15px 0;
}

.prognosis-box {
    border-left: 4px solid #dd6b20;
    padding-left: 15px;
    margin: 15px 0;
}

.referral-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.referral-card {
    display: block; /* Makes the whole card clickable */
    background: white;
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.referral-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-blue);
    box-shadow: 0 5px 15px rgba(0, 188, 212, 0.2);
}

.referral-card i {
    font-size: 24px;
    color: var(--accent-blue);
    margin-bottom: 10px;
}

.referral-card span {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
}

/* ===== MOBILE EVALUATION ADAPTATIONS ===== */
@media screen and (max-width: 768px) {
    /* Ensure evaluation report sits below document */
    #evaluationControls {
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-top: 20px !important;
        padding: 0 10px !important;
        z-index: 1 !important;
    }
    
    /* Stack evaluation button and report vertically */
    #evaluateBtn {
        width: 100% !important;
        margin: 0 auto 20px !important;
        padding: 14px !important;
        font-size: 0.95rem !important;
    }
    
    /* Evaluation report formatting for mobile */
    #evaluationReport {
        margin-top: 20px !important;
        width: 100% !important;
        padding: 20px 15px !important;
        border-radius: var(--radius-md) !important;
        box-shadow: var(--shadow-sm) !important;
    }
    
    /* Adjust report header for mobile */
    #evaluationReport .report-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }
    
    #evaluationReport .report-header h2 {
        font-size: 1.2rem !important;
    }
    
    /* Make dismiss button more mobile-friendly */
    #dismissReportBtn {
        position: absolute !important;
        top: 15px !important;
        right: 15px !important;
        font-size: 1.8rem !important;
        padding: 5px !important;
        background: rgba(0,0,0,0.05) !important;
        border-radius: 50% !important;
        width: 36px !important;
        height: 36px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Adjust referral cards for mobile */
    .referral-list {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    
    .referral-card {
        padding: 12px !important;
    }
    
    /* Ensure paper doesn't overflow */
    .paper {
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Add space between document and evaluation */
    .document-preview {
        flex-direction: column !important;
        gap: 20px !important;
    }
}

/* Tablet adjustments */
@media screen and (min-width: 769px) and (max-width: 992px) {
    #evaluationControls {
        max-width: 210mm !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    
    .referral-list {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ===== STYLED HISTORY DELETE BUTTON ===== */
.delete-history-btn {
    background: var(--surface-elevated) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    color: #ef4444 !important;
    cursor: pointer !important;
    padding: 8px 10px !important;
    font-size: 0.9rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all var(--transition-fast) !important;
    opacity: 0.7 !important;
    margin-left: 10px !important;
    width: 40px;
    height: 40px;
}

.delete-history-btn:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: #ef4444 !important;
    opacity: 1 !important;
    transform: scale(1.05) !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15) !important;
}

.delete-history-btn:active {
    transform: scale(0.95) !important;
}

.delete-history-btn i {
    font-size: 0.95rem !important;
}

/* History item with delete button adjustments */
.history-item {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.item-content {
    flex: 1 !important;
    min-width: 0 !important; /* Allow text truncation */
}

/* Prevent text overflow */
.item-title {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 180px !important;
}

/* Mobile adjustments for delete button */
@media screen and (max-width: 768px) {
    .delete-history-btn {
        padding: 6px 8px !important;
        font-size: 0.8rem !important;
    }
    
    .delete-history-btn i {
        font-size: 0.85rem !important;
    }
    
    .item-title {
        max-width: 140px !important;
    }
}

/* ===== GLOBAL RESET TO ENSURE NO SCROLLBARS ON PAPER ===== */
* {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    max-width: 100%;
}


/* Add to your existing CSS */
.questionnaire-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: center;
}

.questionnaire-actions button {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

#saveResponsesBtn {
    background: #00BCD4;
    color: white;
    border: none;
}

#viewSummaryBtn {
    background: #28a745;
    color: white;
    border: none;
}

#clearFormBtn {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.response-summary {
    margin-top: 30px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #28a745;
    display: none;
}

.summary-header {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3em;
}

.summary-item {
    margin-bottom: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #eaeaea;
}

.summary-question {
    font-weight: 500;
    color: #34495e;
    margin-bottom: 8px;
}

.summary-answer {
    color: #2c3e50;
    font-size: 1.1em;
}

/* Update config panel to be more client-friendly */
.config-panel h3 {
    color: #2c3e50;
}

.form-card {
    background: #ffffff;
    border: 1px solid #eaeaea;
}

.form-input:focus {
    border-color: #00BCD4;
    box-shadow: 0 0 0 3px rgba(0, 188, 212, 0.1);
}
