/* Category Page Styles */

/* Global box-sizing fix */
.category-page * {
    box-sizing: border-box;
}

/* Page layout */
.category-page {
    min-height: 100vh;
    background: #f8f9fa;
    overflow-x: hidden;
    width: 100%;
}

/* Purple header section */
.category-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    padding: 60px 0 80px;
    text-align: center;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.header-icon-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 16px;
}

.header-icon {
    font-size: 3rem;
}

.header-title {
    font-size: 3rem;
    font-weight: 700;
    margin: 0;
}

.header-description {
    font-size: 1.25rem;
    margin: 0;
    opacity: 0.95;
}

/* Category AI Summary Section */
.summary-section {
    margin-top: -60px;
    position: relative;
    z-index: 10;
    padding: 0 20px 20px;
}

.summary-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.summary-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 16px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.summary-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.summary-card.recommendations .summary-icon {
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
}

.summary-content {
    flex: 1;
}

.summary-title {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 8px 0;
}

.summary-text {
    font-size: 0.95rem;
    color: #6b7280;
    line-height: 1.6;
    margin: 0;
}

/* White content section */
.content-section {
    background: white;
    margin-top: 20px;
    border-radius: 32px 32px 0 0;
    padding: 24px 0;
    min-height: calc(100vh - 200px);
}

/* AI Analysis button */
.ai-button-container {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 24px;
    margin-left: 32px;
}

/* Progress Overview */
.progress-overview {
    margin: 0 32px 24px 32px;
}

.progress-card {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bfdbfe;
    border-radius: 16px;
    padding: 24px;
}

.progress-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e40af;
    margin: 0 0 16px 0;
}

.progress-stats {
    display: flex;
    gap: 32px;
    margin-bottom: 16px;
}

.stat-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1e40af;
}

.stat-item.attention .stat-value {
    color: #f59e0b;
}

.stat-label {
    font-size: 0.95rem;
    color: #64748b;
}

.progress-hint {
    margin: 0;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #475569;
    display: flex;
    align-items: center;
}

.btn-ai-analysis {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-ai-analysis:hover:not(:disabled) {
    background: linear-gradient(135deg, #5558e3 0%, #7c4ce8 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.btn-ai-analysis:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Questions container */
.questions-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

.question-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e9ecef;
    padding: 32px;
    transition: all 0.3s ease;
}

.question-card:hover {
    border-color: #dee2e6;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.question-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.question-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
    line-height: 1.5;
}

.question-hint {
    font-size: 0.95rem;
    color: #6c757d;
    margin: 0;
}

.upload-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.upload-button {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.upload-button:hover {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.file-count {
    font-size: 0.9rem;
    color: #28a745;
    font-weight: 500;
}

.no-file {
    font-size: 0.9rem;
    color: #6c757d;
}

.selected-files-preview {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    margin-top: 8px;
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    color: #6c757d;
    font-size: 0.85rem;
}

.uploaded-documents {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

.uploaded-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.uploaded-doc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    gap: 8px;
    flex-wrap: wrap;
}

.doc-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.doc-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.uploading-indicator {
    display: flex;
    align-items: center;
    color: #6b7280;
    font-size: 0.9rem;
    margin-top: 8px;
}

.btn-delete {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn-delete:hover {
    background: #fee2e2;
    color: #dc2626;
}

.btn-download {
    background: none;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn-download:hover {
    background: #dbeafe;
    color: #2563eb;
}

.uploaded-doc-item.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.uploaded-doc-item.clickable:hover {
    background: #f3f4f6;
}

.uploaded-doc-item.has-recommendations {
    border: 1px solid #fbbf24;
    background: #fffbeb;
}

.uploaded-doc-item.has-recommendations:hover {
    background: #fef3c7;
    border-color: #f59e0b;
}

/* Recommendations indicator */
.recommendations-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(245, 158, 11, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

.rec-count {
    font-weight: 700;
}

/* Summary action text */
.summary-action {
    margin-top: 12px;
    margin-bottom: 0;
    font-size: 0.9rem;
    color: #f59e0b;
    font-weight: 500;
    display: flex;
    align-items: center;
    animation: bounce 2s infinite;
}

.summary-link {
    color: #f59e0b;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.summary-link:hover {
    color: #d97706;
    transform: translateY(2px);
}

/* Loading state styles for AI analysis */
.summary-section.analyzing {
    margin-top: -60px;
}

.analysis-loading-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.analysis-spinner {
    margin-bottom: 24px;
    color: #6366f1;
}

.analysis-loading-content {
    max-width: 500px;
    margin: 0 auto;
}

.analysis-loading-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 12px;
}

.analysis-loading-text {
    font-size: 1.1rem;
    color: #6b7280;
    margin-bottom: 24px;
}

.analysis-progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.analysis-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
    width: 0%;
    animation: progressAnimation 3s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes progressAnimation {
    0% {
        width: 0%;
    }
    50% {
        width: 80%;
    }
    100% {
        width: 95%;
    }
}

.analysis-loading-hint {
    font-size: 0.875rem;
    color: #9ca3af;
    margin: 0;
    font-style: italic;
}

.navigation-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.next-doc-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
}

.next-doc-link:hover {
    color: #2563eb;
    transform: translateY(2px);
}

/* Highlight animation for scrolled elements */
.highlight-animation {
    animation: highlightPulse 2s ease;
}

@keyframes highlightPulse {
    0% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(251, 191, 36, 0.1);
        box-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
    }
    100% {
        background-color: transparent;
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-3px);
    }
    60% {
        transform: translateY(-1px);
    }
}

.expand-icon {
    color: #6b7280;
    margin-left: 8px;
    font-size: 0.875rem;
}

.analysis-details {
    background: #f9fafb;
    padding: 20px;
    margin: -8px -12px 8px -12px;
    border-top: 1px solid #e5e7eb;
}

.analysis-content {
    max-width: 100%;
    overflow-x: auto;
}

.criterion-summary {
    margin-bottom: 20px;
}

.criterion-summary h5 {
    color: #1f2937;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.summary-text {
    color: #4b5563;
    line-height: 1.6;
    margin: 0;
    word-break: break-word;
    overflow-wrap: break-word;
}

.document-summary, .assessment-conclusion {
    background: #f9fafb;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid #e5e7eb;
}

.document-summary h6, .assessment-conclusion h6 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 8px;
}

.questions-analysis {
    margin-bottom: 20px;
}

.question-item {
    background: white;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #e5e7eb;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
    flex-wrap: wrap;
}

.question-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.95rem;
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.question-score {
    font-weight: 700;
    font-size: 1.1rem;
    padding: 4px 12px;
    border-radius: 20px;
}

.score-high {
    color: #059669;
    background: #d1fae5;
}

.score-medium {
    color: #d97706;
    background: #fef3c7;
}

.score-low {
    color: #dc2626;
    background: #fee2e2;
}

.question-proof {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
    word-break: break-word;
    overflow-wrap: break-word;
}

.recommendations-section {
    background: white;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.recommendations-section h6 {
    color: #1f2937;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.recommendations-list {
    margin: 0;
    padding-left: 20px;
}

.recommendations-list li {
    color: #4b5563;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 8px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-secondary {
    background: #e9ecef;
    color: #6c757d;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-primary {
    background: #cce5ff;
    color: #004085;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.score-badge {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}


.btn-modern-success {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-modern-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
    color: white;
}

/* Responsive design */
@media (max-width: 991px) {
    .category-header {
        padding: 40px 0 60px;
    }

    .header-content h1 {
        font-size: 2rem;
    }

    .content-section {
        padding: 30px 15px;
    }

    .questions-container {
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .question-card {
        padding: 20px;
        border-radius: 12px;
    }

    .question-title {
        font-size: 1.25rem;
    }

    .question-hint {
        font-size: 0.875rem;
    }

    .upload-section {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .upload-button {
        width: 100%;
        text-align: center;
        padding: 12px 20px;
    }

    .uploaded-doc-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px;
    }

    .doc-info {
        width: 100%;
        overflow: hidden;
    }

    .doc-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: block;
    }

    .doc-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
    }

    .analysis-details {
        padding: 15px;
    }

    .criterion-summary h5 {
        font-size: 1.1rem;
    }

    .question-item {
        padding: 12px;
    }

    .recommendations-section {
        padding: 15px;
    }

    .summary-card {
        padding: 20px;
    }
}

@media (max-width: 576px) {
    .category-header {
        padding: 30px 0 40px;
    }

    .header-content h1 {
        font-size: 1.75rem;
    }

    .header-content p {
        font-size: 0.9rem;
    }

    .content-section {
        padding: 20px 10px;
    }

    .question-card {
        padding: 15px;
    }

    .question-title {
        font-size: 1.1rem;
    }

    .uploaded-documents {
        margin-top: 15px;
    }

    .uploaded-title {
        font-size: 0.9rem;
    }

    .badge {
        font-size: 0.75rem;
        padding: 3px 8px;
    }

    .score-badge {
        font-size: 0.75rem;
        padding: 2px 8px;
    }

    .btn-delete,
    .btn-download {
        width: 30px;
        height: 30px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .analysis-details {
        padding: 15px;
        margin: -8px -15px 8px -15px;
    }

    .question-header {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .question-label {
        flex: 1 0 100%;
        margin-bottom: 4px;
    }

    .question-score {
        align-self: flex-start;
        font-size: 0.9rem;
        padding: 2px 10px;
    }

    .recommendations-list {
        font-size: 0.875rem;
        padding-left: 16px;
    }

    .question-item {
        padding: 12px;
        margin-bottom: 8px;
    }

    .recommendations-section {
        padding: 12px;
    }

    .recommendations-indicator {
        font-size: 0.75rem;
        padding: 3px 8px;
    }

    .doc-info {
        flex: 1 0 100%;
        margin-bottom: 8px;
    }

    .doc-actions {
        flex: 1 0 100%;
        justify-content: space-between;
    }

    .uploaded-doc-item {
        flex-direction: column;
        align-items: stretch;
    }

    .upload-section {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .upload-button {
        width: 100%;
        justify-content: center;
    }

    /* Summary section mobile adjustments */
    .summary-section {
        padding: 0 10px 15px;
        margin-top: -40px;
    }

    .summary-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .summary-card {
        padding: 16px;
        flex-direction: column;
        text-align: center;
    }

    .summary-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        margin: 0 auto 12px;
    }

    .summary-title {
        font-size: 0.95rem;
    }

    .summary-text {
        font-size: 0.875rem;
    }

    /* Progress overview mobile */
    .progress-overview {
        margin: 0 15px 20px 15px;
    }

    .progress-card {
        padding: 16px;
    }

    .progress-title {
        font-size: 1rem;
    }

    .progress-items {
        gap: 8px;
    }

    .progress-item {
        padding: 8px;
    }

    /* AI button container */
    .ai-button-container {
        margin-left: 15px;
        margin-right: 15px;
    }

    .btn-analyze {
        width: 100%;
        justify-content: center;
    }

    /* Header adjustments */
    .header-icon-title {
        flex-direction: column;
        gap: 12px;
    }

    .header-icon {
        font-size: 2rem;
    }

    .header-title {
        font-size: 1.5rem;
    }

    .header-description {
        font-size: 1rem;
    }

    /* Questions container */
    .questions-container {
        gap: 12px;
    }

    /* Analysis loading card mobile */
    .analysis-loading-card {
        padding: 24px 16px;
    }

    .analysis-loading-title {
        font-size: 1.25rem;
    }

    .analysis-loading-text {
        font-size: 1rem;
    }

    /* Floating buttons for mobile */
    .floating-actions {
        position: fixed;
        bottom: 20px;
        right: 20px;
        display: flex;
        flex-direction: column;
        gap: 10px;
        z-index: 100;
    }

    .floating-actions button {
        width: 50px;
        height: 50px;
        border-radius: 25px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
    .upload-button,
    .btn-analyze,
    .btn-delete,
    .next-doc-link {
        min-height: 44px;
    }

    .uploaded-doc-item.clickable {
        padding: 15px;
    }

    .expand-icon {
        padding: 10px;
        margin: -10px;
    }
}

/* History Section Styles */
.history-section {
    margin-top: 3rem;
    padding: 2rem 20px 0;
    border-top: 2px solid #e9ecef;
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.history-header {
    margin-bottom: 1rem;
    display: flex;
    justify-content: flex-start;
}

.history-header button {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 12px;
    transition: all 0.3s ease;
    white-space: nowrap;
    max-width: 100%;
}

.history-header button:hover {
    background-color: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.history-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.history-item {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.history-item:hover {
    border-color: #dee2e6;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.history-date-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e9ecef;
}

.history-date-header h4 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #495057;
    flex: 1;
}

.history-date-header i {
    color: #6c757d;
}

.history-documents {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Responsive adjustments for history section */
@media (max-width: 768px) {
    .history-section {
        margin-top: 2rem;
        padding-top: 1.5rem;
    }

    .history-header button {
        width: 100%;
        justify-content: center;
    }

    .history-item {
        padding: 16px;
    }

    .history-date-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .history-date-header h4 {
        font-size: 1.1rem;
        flex: 1 0 100%;
    }
}