:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --background-color: #f5f6fa;
    --success-color: #2ecc71;
    --warning-color: #f1c40f;
    --error-color: #e74c3c;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--background-color);
    color: var(--primary-color);
    line-height: 1.6;
    padding: 2rem;
}

.container {
    width: 95%;
    /* Use percentage instead of max-width */
    margin: 0 auto;
}

.upload-container {
    max-width: 800px;
    /* Keep upload area constrained */
    margin: 0 auto 2rem auto;
}

.header-section {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.header-section h1 {
    margin: 0;
    text-align: center;
}

.editor-button {
    background-color: var(--secondary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s ease;
    margin-left: 1rem;
}

.editor-button:hover {
    background-color: #2980b9;
}

.upload-container {
    background-color: white;
    border: 2px dashed var(--secondary-color);
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    transition: border-color 0.3s ease;
}

.upload-container.dragover {
    border-color: var(--success-color);
    background-color: rgba(46, 204, 113, 0.1);
}

.upload-content {
    cursor: pointer;
}

.upload-icon {
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.progress-container {
    margin-top: 1rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #eee;
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress {
    width: 0%;
    height: 100%;
    background-color: var(--success-color);
    transition: width 0.3s ease;
}

.results-container {
    background-color: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.file-info {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.info-tooltip {
    font-size: 0.8rem;
    color: var(--secondary-color);
    cursor: pointer;
    margin-left: 0.5rem;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close-modal {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.modal-body {
    margin-top: 1rem;
}

.modal-body h4 {
    margin: 1.5rem 0 0.5rem 0;
    color: var(--primary-color);
}

.modal-body ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.modal-body li {
    margin-bottom: 0.5rem;
    color: #666;
}

.modal-body p {
    color: #666;
    line-height: 1.6;
}

.file-info {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.matches-container {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.matches-container h4 {
    margin: 0 0 0.75rem 0;
    color: var(--primary-color);
    font-size: 0.95rem;
}

.matched-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.matched-item {
    background: white;
    padding: 0.35rem 0.75rem;
    /* Standard padding for all items */
    border-radius: 4px;
    font-size: 0.85rem;
    border: 1px solid #e0e0e0;
    color: var(--primary-color);
    margin: 0.25rem;
    position: relative;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center the text */
}

.matched-item.no-cards {
    border: 1px dashed #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
    padding-right: 2rem;
    /* Extra padding only for items with exclamation marks */
}

.matched-item.no-cards::after {
    content: "!";
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #e74c3c;
    font-weight: bold;
    font-size: 14px;
    width: 14px;
    text-align: center;
}

/* Downloadable card styling */
.line-out-card.downloadable {
    border-left: 3px solid var(--accent-color);
    transition: transform 0.2s ease;
}

.line-out-card.downloadable:hover {
    transform: translateY(-2px);
}

/* Download link styling */
.download-link {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.download-link:hover {
    color: var(--accent-color);
}

/* Download icon styling */
.download-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.download-link:hover .download-icon {
    opacity: 1;
}

.warning-message {
    background-color: rgba(241, 196, 15, 0.1);
    border: 1px solid var(--warning-color);
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1.5rem;
}

.line-out-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.line-out-card {
    background-color: white;
    border-radius: 6px;
    padding: 0.75rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-size: 0.9rem;
}

.line-out-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.35rem;
    font-size: 1rem;
}

.line-out-card p {
    color: #666;
    margin-bottom: 0.35rem;
    flex-grow: 1;
    font-size: 0.85rem;
}

.required-by {
    font-size: 0.8rem;
    color: var(--secondary-color);
    margin-top: 0.5rem;
}

.required-by ul {
    list-style: none;
    padding-left: 0.75rem;
    margin-top: 0.15rem;
}

.required-by li {
    line-height: 1.3;
}

.error-message {
    color: var(--error-color);
    text-align: center;
    margin: 1rem 0;
}

.debug-container {
    background-color: #1a1a1a;
    border-radius: 10px;
    padding: 2rem;
    margin-top: 2rem;
    color: #fff;
}

.debug-section {
    margin-bottom: 1.5rem;
}

.debug-section h4 {
    color: #3498db;
    margin-bottom: 0.5rem;
}

.debug-text {
    background-color: #2d2d2d;
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: monospace;
    font-size: 0.9rem;
    color: #e0e0e0;
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .container {
        width: 100%;
    }

    .upload-container {
        padding: 1rem;
    }
}