:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --text: #1f2937;
    --border: #e5e7eb;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}

.container {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    width: 100%;
    max-width: 500px;
}

.card {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

h1 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.5rem;
    color: var(--text);
}

h2 {
    color: #059669;
    margin-top: 0;
}

/* Menu Bar */
.menu-bar {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.menu-item {
    position: relative;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.menu-item:hover {
    background-color: #e5e7eb;
}

.menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border);
    border-radius: 6px;
    z-index: 100;
    padding: 0.5rem 0;
}

.menu-item:hover .menu-dropdown {
    display: block;
}

.menu-dropdown a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
}

.menu-dropdown a:hover {
    background-color: var(--bg);
    color: var(--primary);
}

.menu-divider {
    height: 1px;
    background-color: var(--border);
    margin: 0.4rem 0;
}

.menu-recents-title {
    display: block;
    padding: 0.25rem 1rem;
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    font-weight: 600;
}

.menu-recents-item {
    display: block;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu-recents-item:hover {
    background-color: var(--bg);
    color: var(--primary);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.tab {
    flex: 1;
    padding: 0.6rem 1rem;
    border: none;
    background: none;
    font-size: 0.95rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    width: auto;
    margin-top: 0;
}

.tab:hover {
    color: var(--primary);
    background: none;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: none;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Form */
.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

input[type="text"],
input[type="number"],
input[type="file"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1rem;
}

.hint {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.submit-btn {
    width: 100%;
    background-color: var(--primary);
    color: white;
    padding: 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 1rem;
}

.submit-btn:hover {
    background-color: var(--primary-hover);
}

.submit-btn:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

#loading {
    display: none;
    text-align: center;
    margin-top: 1rem;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 0.5rem auto;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Result page buttons */
.btn {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    border-radius: 6px;
    margin-top: 1rem;
    transition: 0.2s;
}

.btn:hover {
    background: var(--primary-hover);
}

.secondary {
    background: #e5e7eb;
    color: #374151;
    margin-left: 0.5rem;
}

.secondary:hover {
    background: #d1d5db;
}

.download-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.download-list li {
    margin-bottom: 0.5rem;
}

/* Tooltips */
.tooltip-wrap {
    position: relative;
}

.tooltip-wrap .tooltip {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 10;
    background: #1f2937;
    color: #f3f4f6;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    line-height: 1.5;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    margin-top: 0.25rem;
}

.tooltip-wrap .tooltip hr {
    border: none;
    border-top: 1px solid #4b5563;
    margin: 0.3rem 0;
}

.tooltip-wrap:hover .tooltip {
    display: block;
}

.help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #4b5563;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    margin-left: 0.3rem;
    vertical-align: middle;
    transition: background 0.15s;
}

.help-btn:hover {
    background: #d1d5db;
    color: #1f2937;
}

.help-popup {
    display: none;
    position: relative;
    margin-top: 0.5rem;
    background: #1f2937;
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.help-popup.visible {
    display: block;
}

.help-popup img {
    display: block;
    width: 100%;
    max-width: 640px;
    height: auto;
    border-radius: 6px;
}

.help-popup-close {
    position: absolute;
    top: 6px;
    right: 10px;
    color: #9ca3af;
    cursor: pointer;
    font-size: 1.1rem;
    z-index: 2;
    line-height: 1;
}

.help-popup-close:hover {
    color: white;
}