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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    color: #333;
    padding-top: 100px; /* Reduced padding since header is now more compact */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #eee;
    text-align: center;
    margin-bottom: 0;
    padding: 1rem 0;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    gap: 2rem;
}

.logo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.logo {
    height: 50px;
    width: auto;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.logo:hover {
    opacity: 0.8;
}

.slogan {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
    margin: 0;
    text-align: center;
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #000;
    margin: 0;
}

.header-content p {
    font-size: 1.1rem;
    color: #666;
    font-weight: 400;
}

.home-btn {
    padding: 1rem;
    background: #f8f9fa;
    color: #333;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    order: -1;
}

.home-btn:hover {
    background: #e9ecef;
    border-color: #000;
}

.home-btn:active {
    transform: scale(0.98);
}

.main {
    max-width: 800px;
    margin: 0 auto;
    padding-top: 2rem;
}

.search-section {
    position: relative;
    flex: 1;
    max-width: 800px;
    z-index: 999;
    background: transparent;
    backdrop-filter: none;
    padding: 0;
    box-shadow: none;
    margin-bottom: 0;
}

.mode-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 0.25rem;
    border: 1px solid #e9ecef;
}

.mode-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #666;
}

.mode-btn.active {
    background: #000;
    color: white;
}

.mode-btn:hover:not(.active) {
    background: rgba(0,0,0,0.1);
}

.search-container {
    display: flex;
    gap: 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 0.5rem;
    align-items: center;
}

#transactionInput {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    outline: none;
    background: white;
    text-transform: uppercase;
}

#transactionInput::placeholder {
    color: #999;
    text-transform: none;
}

.analyze-btn {
    padding: 1rem 2rem;
    background: #000;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
    justify-content: center;
}

.analyze-btn:hover {
    background: #333;
}

.analyze-btn:active {
    transform: scale(0.98);
}

.analyze-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

.analyze-btn.loading .loading-spinner {
    display: block;
}

.analyze-btn.loading .btn-text {
    display: none;
}

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

.suggestions-section {
    margin-top: 5rem; /* Increased top margin for better spacing */
    margin-bottom: 3rem;
    animation: fadeInUp 0.5s ease-out;
}

.suggestions-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #000;
    margin-bottom: 1.5rem;
    text-align: center;
}

.glossary-section {
    display: none;
    margin-top: 5rem;
    margin-bottom: 3rem;
    animation: fadeInUp 0.5s ease-out;
}

.glossary-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #000;
    margin-bottom: 1.5rem;
    text-align: center;
}

.glossary-cloud {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.category-section {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.category-section:hover {
    border-color: #000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.category-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #000;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.terms-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.term-tag {
    background: #f8f9fa;
    color: #333;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.term-tag:hover {
    background: #000;
    color: white;
    transform: translateY(-2px);
}

.glossary-results-section {
    display: none;
    animation: fadeInUp 0.5s ease-out;
    margin-top: 5rem; /* Added top margin for better spacing */
}

.category-badge {
    background: #007bff;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.related-terms {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.related-term-tag {
    background: #f8f9fa;
    color: #333;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #e9ecef;
}

.related-term-tag:hover {
    background: #000;
    color: white;
    border-color: #000;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.module-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.module-card:hover {
    border-color: #000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.module-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #000;
    margin-bottom: 0.5rem;
}

.module-description {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

.transaction-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.transaction-tag {
    background: #f8f9fa;
    color: #333;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.transaction-tag:hover {
    background: #000;
    color: white;
}

.results-section {
    display: none;
    animation: fadeInUp 0.5s ease-out;
    margin-top: 5rem; /* Added top margin for better spacing */
}

.result-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 2rem;
    page-break-inside: avoid; /* Helps with image capture */
    break-inside: avoid; /* Modern browsers */
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.card-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #000;
}

.module-badge {
    background: #000;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-content {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.info-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #000;
    margin-bottom: 0.5rem;
}

.info-section p {
    color: #666;
    line-height: 1.6;
}

.info-section ul {
    list-style: none;
    padding: 0;
}

.info-section li {
    color: #666;
    line-height: 1.6;
    margin-bottom: 0.5rem;
    position: relative;
    padding-left: 1.5rem;
}

.info-section li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #000;
    font-weight: bold;
}

.compatibility-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.compatibility-tag {
    background: #f8f9fa;
    color: #666;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid #e9ecef;
}

.compatibility-tag.supported {
    background: #000;
    color: white;
    border-color: #000;
}

.business-areas-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.business-area-tag {
    background: #f8f9fa;
    color: #333;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid #e9ecef;
}

.business-area-tag.primary {
    background: #000;
    color: white;
    border-color: #000;
}

.related-modules {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.related-module-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.related-module-item:hover {
    border-color: #000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.module-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.module-code {
    background: #000;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.module-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
}

.module-usage {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
}

.industry-processes {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.industry-process-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.industry-process-item:hover {
    border-color: #000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.process-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.industry-name {
    background: #000;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.process-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
}

.process-description {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
}

.transaction-diagram {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1rem;
}

.relationship-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.group-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.transactions-in-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-left: 1rem;
}

.transaction-node {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 0.75rem;
    min-width: 120px;
    text-align: center;
    transition: all 0.2s ease;
}

.transaction-node.main-node {
    background: #000;
    color: white;
    border-color: #000;
    align-self: center;
    margin-bottom: 1rem;
}

.transaction-node.related-node {
    cursor: pointer;
}

.transaction-node.related-node:hover {
    background: #000;
    color: white;
    border-color: #000;
    transform: translateY(-2px);
}

.node-code {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.node-label {
    font-size: 0.7rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.node-description {
    font-size: 0.7rem;
    opacity: 0.8;
    line-height: 1.2;
}

.prerequisite .group-label {
    color: #dc3545;
}

.dependent .group-label {
    color: #28a745;
}

.alternative .group-label {
    color: #ffc107;
}

.workflow .group-label {
    color: #007bff;
}

.empty-state, .error-state {
    text-align: center;
    padding: 3rem 2rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    color: #666;
}

.empty-state {
    display: none;
}

.error-state {
    display: none;
}

.empty-icon, .error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state h3, .error-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #000;
}

.empty-state p, .error-state p {
    color: #666;
    font-size: 1rem;
    line-height: 1.6;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .header {
        position: relative; /* Change from fixed to relative on mobile */
        border-bottom: 1px solid #eee;
    }

    body {
        padding-top: 0; /* Remove padding since header is not fixed anymore */
    }

    .header-content {
        flex-direction: column;
        padding: 0 1rem;
    }

    .logo-section {
        margin-bottom: 0.5rem;
    }

    .slogan {
        font-size: 0.8rem;
    }

    .search-section {
        width: 100%;
        margin-top: 1rem;
    }
    
    .container {
        padding: 0 1rem 1rem;
    }
    
    .search-section {
        padding: 0.5rem;
    }
    
    .header-content h1 {
        font-size: 2rem;
    }
    
    .search-container {
        flex-direction: row;
        gap: 0.5rem;
        align-items: center;
    }
    
    .home-btn {
        order: -1;
        min-width: 44px;
        padding: 0.8rem;
    }
    
    .analyze-btn {
        width: 100%;
    }
    
    .card-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .result-card {
        padding: 1.5rem;
    }
    
    .module-grid {
        grid-template-columns: 1fr;
    }
    
    .mode-toggle {
        margin-bottom: 0.5rem;
    }
    
    .mode-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .terms-container {
        gap: 0.25rem;
    }
    
    .term-tag {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

.download-options {
    display: flex;
    gap: 0.5rem;
    margin-top: 2rem;
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

.download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
}

.download-btn:hover {
    background: #000;
    color: white;
    border-color: #000;
}

.download-btn span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

@media (max-width: 768px) {
    .download-options {
        flex-wrap: wrap;
        margin-top: 1.5rem;
    }

    .download-btn {
        width: 100%;
    }
}

.footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

.credit {
    font-size: 0.8rem;
    color: #aaa;
    margin: 0;
}