/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

/* Header Styles */
h1 {
    font-size: 2.5em;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.chart-icon {
    font-size: 1.2em;
}

p {
    font-size: 1.1em;
    line-height: 1.6;
    color: #555;
    margin-bottom: 30px;
    text-align: center;
}

/* Upload Section */
.upload-section {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
    padding: 20px;
    border: 3px dashed #667eea;
    border-radius: 15px;
    background: rgba(102, 126, 234, 0.05);
}

/* Disclaimer */
.disclaimer {
    text-align: center;
    margin-top: 0px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #565454;
    font-style: italic;
    line-height: 1.2;
}

#pdfUpload {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    font-size: 16px;
    color: #555;
    cursor: pointer;
}

#pdfUpload::-webkit-file-upload-button {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 8px 16px;
    margin-right: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
    transition: all 0.3s ease;
}

#pdfUpload::-webkit-file-upload-button:hover {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
    transform: translateY(-1px);
}

/* Main Analyze Button */
#analyzeBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    white-space: nowrap;
}

#analyzeBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4c96 100%);
}

#analyzeBtn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

/* Loading Styles */
#loading {
    text-align: center;
    padding: 30px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 15px;
    margin: 20px 0;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(102, 126, 234, 0.3);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-detail {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

/* Company Info Display */
#companyInfo {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.3);
    border-radius: 10px;
    text-align: center;
}

.company-detection {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.1em;
    color: #28a745;
    font-weight: 600;
}

.company-icon {
    font-size: 1.2em;
}

.company-text {
    font-weight: 500;
}

/* Results Section */
h2 {
    font-size: 1.8em;
    font-weight: 600;
    color: #333;
    margin: 30px 0 15px;
    text-align: center;
    line-height: 1.4;
}

/* Company/Year in Analysis Title */
.company-year-title {
    font-size: 0.7em;
    color: #667eea;
    font-weight: 500;
    display: block;
    margin-top: 5px;
}

#resultBox {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    max-height: 500px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.results {
    margin-top: 40px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 15px;
    display: none;
}

.results.show {
    display: block;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.result-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.result-card:hover {
    transform: translateY(-3px);
}

.result-card.pass {
    border-left: 5px solid #28a745;
}

.result-card.fail {
    border-left: 5px solid #dc3545;
}

.result-card.unknown {
    border-left: 5px solid #ffc107;
}

.result-card.partial {
    border-left: 5px solid #fd7e14;
}

.result-card.likely {
    border-left: 5px solid #20c997;
}

.result-card.image-card {
    border-left: 5px solid #6f42c1;
    cursor: pointer;
    transition: all 0.3s ease;
}

.result-card.image-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-left-color: #5a32a3;
}

.image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    cursor: pointer;
}

.image-icon {
    font-size: 3em;
    color: #6f42c1;
    transition: all 0.3s ease;
}

.result-card.image-card:hover .image-icon {
    color: #5a32a3;
    transform: scale(1.1);
}

.image-text {
    font-size: 0.9em;
    color: #666;
    font-weight: 500;
}

.result-card.image-card:hover .image-text {
    color: #5a32a3;
}

.details-button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.details-button:hover {
    background: linear-gradient(135deg, #5a6fd8, #6a4c96);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.details-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.result-title {
    font-weight: bold; 
    margin-bottom: 10px;
    color: #333;
    font-size: 14px; 
}

.result-status {
    font-size: 1.2em;
    font-weight: bold;
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-block;
}

.result-status.pass {
    background: #d4edda;
    color: #155724;
}

.result-status.fail {
    background: #f8d7da;
    color: #721c24;
}

.result-status.unknown {
    background: #fff3cd;
    color: #856404;
}

.result-status.partial {
    background: #ffeaa7;
    color: #856404;
}

.result-status.likely {
    background: #d1ecf1;
    color: #0c5460;
}

.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.details-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    background: white;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { 
        opacity: 0;
        transform: scale(0.8);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

.details-content {
    padding: 30px;
    max-width: 600px;
    max-height: 70vh;
    overflow-y: auto;
}

.details-content h3 {
    color: #333;
    font-size: 1.5em;
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.details-content h4 {
    color: #333;
    font-size: 1.3em;
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.details-item {
    margin-bottom: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.details-item strong {
    color: #333;
    display: inline-block;
    min-width: 180px;
}

.details-item.csv-info {
    background: #e8f5e9;
    border-left-color: #28a745;
    margin-top: 20px;
    text-align: center;
    font-style: italic;
    color: #2e7d32;
}

.modal-image {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-image.loaded {
    opacity: 1;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10001;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.modal-close:active {
    transform: scale(0.95);
}

/* Canvas Gauge Styles - COMPLETE VERSION */
.score-gauge-container {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.score-gauge-container h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5em;
}

.gauge-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

.gauge-container {
    position: relative;
    display: inline-block;
}

#gauge {
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.1));
}

.gauge-score-text {
    margin-top: 15px;
    text-align: center;
}

.gauge-text {
    font-size: 2.5em;
    font-weight: bold;
    color: #333;
    margin: 0;
    line-height: 1;
}

.score-description {
    font-size: 1.2em;
    margin-top: 15px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 25px;
    display: inline-block;
    transition: all 0.3s ease;
}

.score-description.excellent {
    background: #E8F5E9;
    color: #2E7D32;
    border: 1px solid #baedbc;
}

.score-description.good {
    background: #E0F2F1;
    color: #00796B;
    border: 1px solid #9eded8;
}

.score-description.caution {
    background: #FFF8E1;
    color: #856404;
    border: 1px solid #fce6a3;
}

.score-description.risk {
    background: #FDECEA;
    color: #C62828;
    border: 1px solid #f37a62;
}

.score-description.avoid {
    background: #F9F9F9;
    color: #B71C1C;
    border: 1px solid #f05c5c;
}

.final-verdict {
    text-align: center;
    padding: 25px;
    border-radius: 15px;
    font-size: 1.3em;
    font-weight: 600;
}

.final-verdict.pass {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #000000;
    border: 1px solid #8ae3a0;
}

.final-verdict.fail {
    background: linear-gradient(135deg, #f8d7da, #f1b0b7);
    color: #000000;
    border: 1px solid #d34e4e;
}

.error-box {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    color: #721c24;
}

.error-box h3 {
    margin-bottom: 10px;
}

.error-box details {
    margin-top: 15px;
}

.error-box summary {
    cursor: pointer;
    font-weight: 500;
    padding: 5px 0;
}

.error-box pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 10px;
    border-radius: 5px;
    font-size: 12px;
    margin-top: 10px;
    overflow-x: auto;
}

.hidden {
    display: none;
}

.manual-calculator-section {
    margin-top: 50px;
    padding: 30px;
    background: rgba(40, 167, 69, 0.05);
    border: 2px solid rgba(40, 167, 69, 0.2);
    border-radius: 20px;
    text-align: center;
}

.manual-calculator-section h2 {
    color: #28a745;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.manual-icon {
    font-size: 1.2em;
}

.manual-calculator-section p {
    color: #555;
    margin-bottom: 25px;
}

.manual-features {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 50px;
    margin-bottom: 30px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1em;
    color: #555;
}

.feature-icon {
    font-size: 1.2em;
    width: 25px;
    text-align: center;
}

.feature-text {
    flex: 1;
    text-align: left;
}

.manual-button-section {
    margin: 25px 0;
}

.manual-calc-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    white-space: nowrap;
}

.manual-calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
}

.manual-calc-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(40, 167, 69, 0.3);
}

.manual-note {
    font-size: 0.9em;
    color: #666;
    font-style: italic;
    margin-top: 15px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 25px;
    }
    
    h1 {
        font-size: 2em;
        flex-direction: column;
        gap: 10px;
    }
    
    .upload-section {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    #analyzeBtn,
    .manual-calc-btn {
        padding: 12px 25px;
        font-size: 15px;
    }
    
    .manual-features {
        gap: 10px;
    }
    
    .feature-item {
        font-size: 0.95em;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .result-card {
        padding: 15px;
    }
    
    .image-icon {
        font-size: 2.5em;
    }
    
    .image-text {
        font-size: 0.8em;
    }
    
    .details-button {
        padding: 6px 12px;
        font-size: 0.8em;
        margin-top: 10px;
    }
    
    .modal-content {
        max-width: 98vw;
        max-height: 98vh;
        margin: 1vh;
    }
    
    .details-content {
        padding: 20px;
        max-height: 85vh;
    }
    
    .details-content h3 {
        font-size: 1.3em;
        margin-bottom: 15px;
    }
    
    .details-content h4 {
        font-size: 1.2em;
        margin-bottom: 15px;
    }
    
    .details-item {
        padding: 10px;
        margin-bottom: 12px;
    }
    
    .details-item strong {
        min-width: 140px;
        font-size: 0.9em;
    }
    
    .modal-image {
        max-height: 85vh;
    }
    
    .modal-close {
        top: 10px;
        right: 15px;
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
    
    #gauge {
        width: 320px;
        height: 200px;
    }
    
    .gauge-text {
        font-size: 2em;
    }
    
    .score-gauge-container {
        padding: 20px;
    }
    
    .gauge-wrapper {
        margin: 15px 0;
    }
    
    .score-description {
        font-size: 1em;
        padding: 8px 15px;
    }
    
    .final-verdict {
        font-size: 1.1em;
        padding: 20px;
    }
    
    .company-detection {
        flex-direction: column;
        gap: 5px;
    }
    
    .company-year-title {
        font-size: 0.8em;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    p {
        font-size: 1em;
    }
    
    #analyzeBtn,
    .manual-calc-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .gauge-text {
        font-size: 1.8em;
    }
    
    #gauge {
        width: 280px;
        height: 175px;
    }
    
    .score-gauge-container h3 {
        font-size: 1.3em;
    }
    
    .image-icon {
        font-size: 2em;
    }
    
    .details-button {
        padding: 5px 10px;
        font-size: 0.75em;
    }
    
    .details-content {
        padding: 15px;
    }
    
    .details-content h3 {
        font-size: 1.2em;
    }
    
    .details-content h4 {
        font-size: 1.1em;
    }
    
    .details-item {
        padding: 8px;
        margin-bottom: 10px;
    }
    
    .details-item strong {
        min-width: 120px;
        font-size: 0.85em;
    }
    
    .modal-close {
        width: 30px;
        height: 30px;
        font-size: 16px;
        top: 5px;
        right: 10px;
    }
    
    .company-detection {
        font-size: 1em;
    }
    
    .company-year-title {
        font-size: 0.75em;
    }
}