/* TFJA Analyzer Styles */

:root {
    --tfja-primary: #01273e;
    --tfja-secondary: #d4a574;
    --tfja-light: #f5f5f5;
    --tfja-border: #e0e0e0;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--tfja-light);
    color: #333;
    padding: 0 !important;
}

/* Header Styles */
.tfja-header {
    background: white;
    color: #333;
    padding: 40px 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 50px;
    border-bottom: 3px solid var(--tfja-primary);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.header-left {
    flex: 0 0 auto;
}

.header-center {
    flex: 1;
    text-align: center;
}

.header-right {
    flex: 0 0 auto;
}

.logo-tfja img,
.logo-aniversario img {
    filter: brightness(1.1) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
    max-height: 89px;
}

.logo-tfja,
.logo-aniversario {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.logo-tfja:hover img,
.logo-aniversario:hover img {
    transform: scale(1.05);
}

.header-center h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: var(--tfja-primary);
}

.header-center .subtitle {
    font-size: 1.1rem;
    margin: 0;
    color: #666;
}

/* Main Content */
.tfja-main {
    min-height: calc(100vh - 400px);
    padding: 30px 0;
}

.container-lg {
    max-width: 1000px;
}

/* Step Sections */
.step-section {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.step-section.active {
    display: block;
}

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

/* Card Styles */
.card {
    border: none;
    border-radius: 12px;
    border-top: 4px solid var(--tfja-primary);
}

.card.border-info {
    border-top: 4px solid var(--info-color);
}

.card-body {
    background: white;
}

.card-body h2 {
    color: var(--tfja-primary);
    margin-bottom: 15px;
    font-weight: 700;
}

/* Upload Area */
.upload-area {
    border: 3px dashed var(--tfja-border);
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

.upload-area:hover {
    border-color: var(--tfja-primary);
    background-color: rgba(0, 61, 122, 0.02);
}

.upload-area.drag-over {
    border-color: var(--tfja-primary);
    background-color: rgba(0, 61, 122, 0.05);
    box-shadow: 0 0 20px rgba(0, 61, 122, 0.1);
}

.upload-content i {
    font-size: 3rem;
    color: var(--tfja-primary);
    margin-bottom: 15px;
    display: block;
}

.upload-content h5 {
    color: var(--tfja-primary);
    font-weight: 600;
    margin-bottom: 10px;
}

/* File Preview */
.file-preview {
    margin: 20px 0;
}

.file-preview .alert {
    border-left: 4px solid var(--tfja-primary);
    background-color: rgba(0, 61, 122, 0.05);
}

/* Textarea */
textarea.form-control {
    border: 2px solid var(--tfja-border);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
}

textarea.form-control:focus {
    border-color: var(--tfja-primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 61, 122, 0.15);
}

/* Buttons */
.btn-primary {
    background-color: var(--tfja-primary);
    border-color: var(--tfja-primary);
    font-weight: 600;
}

.btn-primary:hover {
    background-color: #002a56;
    border-color: #002a56;
}

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
    font-weight: 600;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #218838;
}

.btn-outline-secondary {
    font-weight: 600;
}

.btn-lg {
    padding: 12px 40px;
    font-size: 1.1rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Analysis Options */
.analysis-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .analysis-options {
        grid-template-columns: 1fr;
    }
}

.analysis-option {
    border: 2px solid var(--tfja-border);
    border-radius: 12px;
    padding: 25px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: white;
}

.analysis-option:hover {
    border-color: var(--tfja-primary);
    box-shadow: 0 4px 12px rgba(0, 61, 122, 0.1);
    background-color: rgba(0, 61, 122, 0.02);
}

.analysis-option .form-check-input {
    width: 1.5rem;
    height: 1.5rem;
    margin-top: 0.3rem;
    cursor: pointer;
    border: 2px solid var(--tfja-border);
    accent-color: var(--tfja-primary);
}

.analysis-option .form-check-label {
    cursor: pointer;
    display: flex;
    gap: 15px;
    align-items: flex-start;
    margin-bottom: 0;
}

.analysis-option h5 {
    color: var(--tfja-primary);
    font-weight: 600;
    margin-bottom: 8px;
}

.analysis-option h5 i {
    margin-right: 8px;
}

.analysis-option p {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 0;
}

.analysis-option.selected {
    border-color: var(--tfja-primary);
    background-color: rgba(0, 61, 122, 0.05);
    box-shadow: 0 0 0 3px rgba(0, 61, 122, 0.1);
}

/* Results Container */
#results-container {
    margin-top: 30px;
}

.result-section {
    background: white;
    border-radius: 12px;
    border-left: 4px solid var(--tfja-primary);
    padding: 30px;
    margin-bottom: 50px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.result-section h3 {
    color: var(--tfja-primary);
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-section.success {
    border-left-color: var(--success-color);
}

.result-section.warning {
    border-left-color: var(--warning-color);
}

.result-section.info {
    border-left-color: var(--info-color);
}

/* Markdown Content */
.markdown-content {
    line-height: 1.8;
    color: #333;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    color: var(--tfja-primary);
    margin-top: 20px;
    margin-bottom: 10px;
    font-weight: 600;
}

.markdown-content code {
    background-color: #f5f5f5;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.markdown-content pre {
    background-color: #f5f5f5;
    border-radius: 8px;
    padding: 15px;
    overflow-x: auto;
}

.markdown-content pre code {
    background: none;
    padding: 0;
}

.markdown-content ul,
.markdown-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.markdown-content li {
    margin-bottom: 8px;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0 8px;
    margin-bottom: 20px;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid var(--tfja-border);
    padding: 16px 24px;
    text-align: left;
    line-height: 1.6;
}

.markdown-content th {
    background-color: var(--tfja-light);
    font-weight: 600;
    color: var(--tfja-primary);
}

/* Copy Button */
.copy-btn {
    background-color: var(--tfja-secondary);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.copy-btn:hover {
    background-color: #c4954a;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(212, 165, 116, 0.3);
}

/* Table Styles */
.table-responsive {
    border-radius: 8px;
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: var(--tfja-primary);
    color: white;
    font-weight: 600;
    border: none;
    padding: 14px 16px;
}

.table tbody td {
    padding: 14px 16px;
    line-height: 1.6;
}

.table tbody tr:hover {
    background-color: rgba(0, 61, 122, 0.05);
}

/* Alert Styles */
.alert {
    border-radius: 8px;
    border: none;
    padding: 15px 20px;
}

.alert-info {
    background-color: rgba(23, 162, 184, 0.1);
    color: #004085;
    border-left: 4px solid #17a2b8;
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.1);
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    color: #721c24;
    border-left: 4px solid #dc3545;
}

/* Flesch Index Tooltip */
.flesch-tooltip {
    cursor: help;
    color: var(--tfja-primary);
    font-weight: 500;
    border-bottom: 2px dotted var(--tfja-primary);
    padding-bottom: 2px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: relative;
    transition: all 0.2s ease;
}

.flesch-tooltip i {
    font-size: 0.85rem;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.flesch-tooltip:hover i {
    opacity: 1;
    color: var(--tfja-secondary);
}

.flesch-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--tfja-primary);
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 400;
    white-space: normal;
    max-width: 300px;
    width: max-content;
    text-align: left;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 39, 62, 0.3);
    line-height: 1.4;
}

.flesch-tooltip:hover::before {
    content: '';
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--tfja-primary);
    z-index: 1000;
}

/* Loading Modal */
.modal {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
}

.modal.d-none {
    display: none;
}

.modal-dialog-centered {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
}

.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
}

/* Footer */
.tfja-footer {
    background-color: white;
    color: #333;
    padding: 30px 20px;
    text-align: center;
    margin-top: 100px;
    border-top: 3px solid var(--tfja-primary);
}

.tfja-footer p {
    margin: 0;
    line-height: 1.6;
    color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-top {
        flex-direction: column;
    }

    .header-bottom h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .analysis-option .form-check-label {
        flex-direction: column;
    }

    .upload-content i {
        font-size: 2rem;
    }

    .card-body {
        padding: 2rem 1.5rem !important;
    }

    .btn-lg {
        padding: 10px 32px;
        font-size: 1rem;
    }
}

/* Utility Classes */
.text-tfja-primary {
    color: var(--tfja-primary);
}

.bg-tfja-light {
    background-color: var(--tfja-light);
}

/* Loading Animation */
.spinner-border {
    border-color: rgba(0, 61, 122, 0.25);
    border-right-color: var(--tfja-primary);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Feature Box Styles */
.feature-box {
    background: white;
    border: 2px solid var(--tfja-border);
    border-radius: 10px;
    padding: 25px;
    transition: all 0.3s ease;
    height: 100%;
}

.feature-box:hover {
    border-color: var(--tfja-primary);
    box-shadow: 0 4px 12px rgba(0, 61, 122, 0.1);
    transform: translateY(-3px);
}

.feature-box h5 {
    color: var(--tfja-primary);
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.feature-box h5 i {
    font-size: 1.3rem;
}

.feature-box ul li {
    margin-bottom: 12px;
    line-height: 1.5;
    color: #555;
}

.feature-box ul li i {
    color: var(--success-color);
    margin-right: 8px;
    font-size: 0.9rem;
}

/* Welcome Section Styles */
.welcome-section {
    background: linear-gradient(135deg, #01273e 0%, #004085 100%);
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 39, 62, 0.2);
}

.welcome-content {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 30px;
    position: relative;
}

.welcome-icon {
    font-size: 3rem;
    color: #d4a574;
    flex-shrink: 0;
    animation: wave 2s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
}

.welcome-icon img.iustitia-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(255, 255, 255, 0.2));
}

@keyframes wave {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(20deg);
    }
    75% {
        transform: rotate(-20deg);
    }
}

.welcome-title {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.welcome-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 5px 0 0 0;
}

.welcome-disclaimer {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
    line-height: 1.4;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 10px;
}

.welcome-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.welcome-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Instruction Banner Styles */
.instruction-banner {
    background: linear-gradient(135deg, rgba(1, 39, 62, 0.05) 0%, rgba(0, 64, 133, 0.05) 100%);
    border-left: 4px solid var(--tfja-primary);
    border-radius: 8px;
    padding: 0;
}

.instruction-banner-compact {
    background: linear-gradient(135deg, rgba(1, 39, 62, 0.03) 0%, rgba(0, 64, 133, 0.03) 100%);
    border-left: 3px solid var(--tfja-primary);
}

.instruction-banner-content {
    padding: 25px;
}

.instruction-banner-compact .instruction-banner-content {
    padding: 12px 16px;
}

.instruction-banner-title {
    color: var(--tfja-primary);
    font-weight: 600;
    font-size: 1.1rem;
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.instruction-banner-compact .instruction-banner-title {
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.instruction-banner-title i {
    font-size: 1.3rem;
}

.instruction-banner-compact .instruction-banner-title i {
    font-size: 1rem;
}

.instruction-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.instruction-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--tfja-border);
    transition: all 0.3s ease;
}

.instruction-option:hover {
    border-color: var(--tfja-primary);
    box-shadow: 0 2px 8px rgba(0, 61, 122, 0.1);
    transform: translateY(-2px);
}

.instruction-option i {
    font-size: 1.5rem;
    color: var(--tfja-primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.instruction-option strong {
    color: var(--tfja-primary);
    display: block;
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.instruction-option p {
    color: #666;
    font-size: 0.8rem;
    margin: 0;
    line-height: 1.3;
}

.instruction-formats {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--tfja-border);
    font-size: 0.9rem;
    color: #555;
}

.instruction-formats i {
    font-size: 1.1rem;
}

/* Analysis Types List */
.instruction-text {
    color: #333;
    font-size: 0.95rem;
}

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

.analysis-types-list-compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.analysis-type-item {
    display: flex;
    gap: 12px;
    padding: 15px;
    background: white;
    border: 1px solid var(--tfja-border);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.analysis-type-item-compact {
    display: flex;
    gap: 8px;
    padding: 10px;
    background: white;
    border: 1px solid var(--tfja-border);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.analysis-type-item:hover,
.analysis-type-item-compact:hover {
    border-color: var(--tfja-primary);
    box-shadow: 0 4px 12px rgba(0, 61, 122, 0.1);
    transform: translateY(-2px);
}

.analysis-type-item i {
    font-size: 1.5rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.analysis-type-item-compact i {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 0;
}

.analysis-type-item strong {
    display: block;
    color: #333;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.analysis-type-item-compact strong {
    display: block;
    color: #333;
    font-size: 0.75rem;
    margin-bottom: 2px;
    font-weight: 600;
}

.analysis-type-item p {
    color: #666;
    font-size: 0.8rem;
    margin: 0;
    line-height: 1.4;
}

.analysis-type-item-compact p {
    color: #666;
    font-size: 0.7rem;
    margin: 0;
    line-height: 1.3;
}

/* Ready Banner Styles */
.ready-banner {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.08) 0%, rgba(25, 135, 84, 0.08) 100%);
    border-left: 4px solid var(--success-color);
    border-radius: 8px;
    padding: 0;
}

.ready-banner-content {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px 25px;
}

.ready-banner-icon {
    font-size: 1.8rem;
    color: var(--success-color);
    flex-shrink: 0;
}

.ready-banner-title {
    color: #155724;
    font-weight: 600;
    font-size: 1.1rem;
    margin: 0;
}

.ready-banner-text {
    color: #4a4a4a;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 3px 0 0 0;
}

/* Accordion Styles */
.accordion {
    border: none;
}

.accordion-item {
    border: 1px solid var(--tfja-border);
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.accordion-item:hover {
    box-shadow: 0 2px 8px rgba(0, 61, 122, 0.08);
}

.accordion-button {
    background-color: white;
    color: var(--tfja-primary);
    font-weight: 600;
    border: none;
    padding: 18px 20px;
    box-shadow: none;
}

.accordion-button:not(.collapsed) {
    background-color: rgba(0, 61, 122, 0.05);
    color: var(--tfja-primary);
    box-shadow: none;
}

.accordion-button:focus {
    border-color: var(--tfja-primary);
    box-shadow: 0 0 0 0.25rem rgba(0, 61, 122, 0.25);
}

.accordion-button::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23013e7e' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    filter: contrast(0.75);
}

.accordion-body {
    padding: 20px;
    background-color: #f9f9f9;
    color: #555;
}

.accordion-body ul {
    margin-left: 0;
    padding-left: 25px;
}

.accordion-body li {
    margin-bottom: 10px;
}

.accordion-body small {
    display: block;
    margin-top: 10px;
}

/* Badge Styles */
.badge {
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.badge.bg-primary {
    background-color: var(--tfja-primary) !important;
}

/* Instructions Section */
#instructionsAccordion {
    margin-top: 20px;
}

/* Additional Alert Styling for Notes */
.alert-heading {
    color: inherit;
    font-weight: 600;
    margin-bottom: 10px;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
