/* SkyPin Web Application Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

header h1 {
    color: #2c3e50;
    margin-bottom: 5px;
}

.logo-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.header-logo {
    width: 48px;
    height: 48px;
}

.subtitle {
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* Info Box */
.info-box {
    background: #e8f4f8;
    border-left: 4px solid #3498db;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: 4px;
}

.info-box p {
    margin: 0;
    color: #2c3e50;
    line-height: 1.6;
}

/* Format Help */
.format-help {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #7f8c8d;
}

.format-help p {
    margin: 0.5rem 0;
}

.format-example {
    background: #f5f5f5;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
    margin: 0.5rem 0;
    white-space: pre-line;
}

.back-link {
    display: inline-block;
    margin-top: 10px;
    color: #3498db;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 20px;
}

.flash-message {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 10px;
}

/* Form Styles */
.upload-form {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.form-section {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #eee;
}

.form-section h2 {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.form-group {
    margin-bottom: 15px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    color: #444;
}

.form-group input[type="file"],
.form-group input[type="number"],
.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input[type="range"] {
    width: 100%;
    margin-top: 5px;
}

.form-group select {
    background-color: white;
}

.form-group small {
    display: block;
    color: #7f8c8d;
    margin-top: 5px;
    font-size: 0.85rem;
}

.form-row {
    margin-bottom: 15px;
}

/* Radio Group */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-weight: normal;
}

.radio-label input[type="radio"] {
    width: auto;
}

/* Buttons */
.form-actions {
    text-align: center;
    padding-top: 10px;
}

.btn-primary {
    display: inline-block;
    background-color: #3498db;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    display: inline-block;
    background-color: #95a5a6;
    color: white;
    padding: 10px 25px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

/* Results Page */
.summary-section,
.download-section,
.results-section,
.gallery-section,
.raw-output-section {
    margin-bottom: 30px;
}

.summary-section h2,
.download-section h2,
.results-section h2,
.gallery-section h2,
.raw-output-section h2 {
    font-size: 1.2rem;
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* Summary Grid */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.summary-item {
    text-align: center;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #eee;
}

.summary-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: #3498db;
}

.summary-label {
    display: block;
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-top: 5px;
}

/* Download Section */
.download-section {
    text-align: center;
    padding: 20px;
    background: #e8f6ff;
    border-radius: 6px;
}

.epsg-info {
    margin-top: 10px;
    color: #666;
    font-family: monospace;
}

/* Results Table */
.table-wrapper {
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.results-table th,
.results-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.results-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #444;
}

.results-table tr:hover {
    background-color: #f9f9f9;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

/* Image Gallery */
.gallery-info {
    color: #7f8c8d;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.gallery-item {
    background: #f9f9f9;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #eee;
}

.gallery-link {
    display: block;
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s;
}

.gallery-item img:hover {
    opacity: 0.9;
}

.gallery-caption {
    display: block;
    padding: 10px;
    font-size: 0.85rem;
    color: #666;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Image groups for crops by source */
.image-group {
    margin-bottom: 25px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #eee;
}

.image-group:last-child {
    margin-bottom: 0;
}

.image-group-title {
    font-size: 1rem;
    color: #444;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

/* Crop gallery - smaller items for marker crops */
.crop-gallery {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.crop-item img {
    height: 150px;
    object-fit: contain;
    background: #f0f0f0;
}

/* Raw Output */
.raw-output {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid #ddd;
}

/* Footer */
.results-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    text-align: center;
    color: white;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #3498db;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.loading-subtext {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Progress Bar */
.progress-container {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #3498db;
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-percent {
    font-size: 0.9rem;
    min-width: 45px;
    text-align: right;
}

/* Processing Page */
.processing-section {
    padding: 60px 20px;
    text-align: center;
}

.processing-content {
    max-width: 500px;
    margin: 0 auto;
}

.processing-content .spinner {
    width: 80px;
    height: 80px;
    border-width: 6px;
    border-color: rgba(52, 152, 219, 0.2);
    border-top-color: #3498db;
    margin-bottom: 30px;
}

.processing-content h2 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.status-detail {
    color: #7f8c8d;
    margin-bottom: 30px;
}

.progress-container.large {
    flex-direction: column;
    gap: 10px;
}

.progress-container.large .progress-bar {
    width: 100%;
    height: 12px;
}

.progress-text {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.markers-found {
    margin-top: 20px;
    padding: 15px;
    background: #e8f6ff;
    border-radius: 6px;
    color: #2c3e50;
}

.markers-found #markers-count {
    font-weight: bold;
    font-size: 1.2rem;
    color: #3498db;
}

/* Site Footer */
.site-footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    font-size: 0.85rem;
    color: #7f8c8d;
}

.site-footer a {
    color: #3498db;
    text-decoration: none;
}

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

.footer-tagline {
    margin-top: 5px;
    font-size: 0.8rem;
    color: #95a5a6;
}

/* Responsive */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
    }

    .radio-group {
        flex-direction: column;
        gap: 10px;
    }

    .image-gallery {
        grid-template-columns: 1fr;
    }
}
