/* GPX Converter Styles */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #16a34a;
    --error-color: #dc2626;
    --warning-color: #d97706;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

header .subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--card-bg);
    padding: 0.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: calc(var(--radius) - 2px);
    transition: all 0.2s ease;
}

.tab:hover {
    color: var(--text-color);
    background: var(--bg-color);
}

.tab.active {
    background: var(--primary-color);
    color: white;
}

/* Tab Content */
.tab-content {
    display: none;
}

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

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card .description {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="datetime-local"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--input-bg);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="url"]:focus,
.form-group input[type="datetime-local"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px dashed var(--input-border);
    border-radius: var(--radius);
    background: var(--bg-color);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.form-group input[type="file"]:hover {
    border-color: var(--primary-color);
}

.form-group input[type="file"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group small {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.form-group.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group.checkbox input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
}

.form-group.checkbox label {
    margin-bottom: 0;
    font-weight: 400;
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

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

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

.btn-primary:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.btn-loading {
    display: none;
}

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

.btn.loading .btn-loading {
    display: inline;
}

/* Status Messages */
.status {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
}

.status.success {
    background: #dcfce7;
    color: var(--success-color);
    border: 1px solid #86efac;
}

.status.error {
    background: #fef2f2;
    color: var(--error-color);
    border: 1px solid #fecaca;
}

.status.warning {
    background: #fef3c7;
    color: var(--warning-color);
    border: 1px solid #fcd34d;
}

.status.info {
    background: #dbeafe;
    color: var(--primary-color);
    border: 1px solid #93c5fd;
}

/* Footer */
footer {
    margin-top: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer p {
    margin-bottom: 0.5rem;
}

footer .credits {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Loading Spinner */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
}

/* Combine Sources */
#combine-sources {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.source-item {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.source-item .source-type {
    flex-shrink: 0;
    padding: 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--input-bg);
    cursor: pointer;
}

.source-item .source-input {
    flex: 1;
}

.source-item .source-input input[type="file"],
.source-item .source-input input[type="url"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--input-bg);
}

.source-item .source-input input[type="file"] {
    border-style: dashed;
    background: var(--bg-color);
}

.btn-remove {
    flex-shrink: 0;
    width: 2rem;
    height: 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-remove:hover {
    background: var(--error-color);
    border-color: var(--error-color);
    color: white;
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
    width: auto;
}

.btn-secondary:hover {
    background: var(--border-color);
}

#add-source {
    margin-bottom: 0.5rem;
}

/* History Section */
.history-card {
    margin-top: 2rem;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.history-header h2 {
    margin: 0;
}

.btn-icon {
    padding: 0.5rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--bg-color);
    color: var(--text-color);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 1.5rem;
    font-size: 0.95rem;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-color);
    border-radius: var(--radius);
    gap: 1rem;
}

.history-item.unavailable {
    opacity: 0.6;
}

.history-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.history-source {
    background: var(--primary-color);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 500;
}

.history-item-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.btn-download,
.btn-delete {
    padding: 0.5rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.btn-download:hover {
    background: var(--success-color);
    color: white;
}

.btn-delete:hover {
    background: var(--error-color);
    color: white;
}

.unavailable-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.5rem;
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .tabs {
        flex-direction: column;
    }

    .tab {
        text-align: center;
    }
}
