/**
 * Well Pumps Selector - Main Stylesheet
 * Professional, clean design with responsive layout
 */

:root {
    --primary-color: #0054A6;
    --primary-dark: #003d7a;
    --primary-light: #e6f0ff;
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --text-primary: #333;
    --text-secondary: #666;
    --border-color: #ddd;
    --bg-light: #f8f9fa;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

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

/* Container and Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 40px 20px;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 40px 20px;
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: bold;
}

.logo svg {
    width: 40px;
    height: 40px;
}

.app-header h1 {
    font-size: 32px;
    font-weight: 600;
    margin: 0;
}

/* Section Titles */
.section-title {
    margin-bottom: 30px;
}

.section-title h2 {
    font-size: 28px;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.section-title p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Form Styles */
.pump-form {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 14px;
}

.required {
    color: var(--error-color);
}

.form-group input,
.form-group select {
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 84, 166, 0.1);
}

.input-with-unit {
    position: relative;
    display: flex;
}

.input-with-unit input {
    flex: 1;
}

.input-with-unit .unit {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    background: white;
    padding: 0 4px;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: var(--bg-light);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

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

/* Spinner for loading state */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Alert Messages */
.alert {
    padding: 16px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Results Section */
.results-section {
    margin-bottom: 40px;
}

.results-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Result Card */
.result-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.result-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: var(--primary-color);
}

.result-card.recommended {
    border: 2px solid var(--success-color);
    background-color: rgba(40, 167, 69, 0.05);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 12px;
}

.model-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.family-name {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
}

/* Badge */
.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-recommended {
    background-color: var(--success-color);
    color: white;
}

/* Card Details */
.card-details {
    flex: 1;
    margin-bottom: 16px;
}

.detail {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
}

.detail:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.detail-value {
    font-weight: 700;
    color: var(--primary-color);
}

/* Card Actions */
.card-actions {
    display: flex;
    gap: 10px;
}

.card-actions .btn {
    flex: 1;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 16px;
}

/* Datasheet Styles */
.datasheet-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
}

.datasheet-header h2 {
    font-size: 28px;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.datasheet-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.datasheet-actions {
    display: flex;
    gap: 10px;
}

.datasheet-section {
    background: white;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
}

.datasheet-section h3 {
    font-size: 18px;
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-light);
}

/* Chart Container */
.chart-container {
    position: relative;
    width: 100%;
    height: 400px;
    margin-bottom: 20px;
}

/* Tables */
.specs-table,
.perf-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.specs-table th,
.perf-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
}

.specs-table td,
.perf-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.specs-table tbody tr:nth-child(even),
.perf-table tbody tr:nth-child(even) {
    background-color: var(--bg-light);
}

.spec-label {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 150px;
}

.no-data {
    color: var(--text-secondary);
    font-style: italic;
    padding: 20px;
    text-align: center;
}

/* Footer */
.app-footer {
    background-color: var(--bg-light);
    padding: 30px 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

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

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

/* Action Links */
.action-links {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.action-links .btn {
    flex: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .pump-form {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .results-list {
        grid-template-columns: 1fr;
    }

    .app-header {
        padding: 30px 20px;
    }

    .header-content {
        flex-direction: column;
        gap: 10px;
    }

    .logo {
        justify-content: center;
    }

    .app-header h1 {
        font-size: 24px;
        text-align: center;
    }

    .section-title h2 {
        font-size: 22px;
    }

    .datasheet-header {
        flex-direction: column;
        gap: 20px;
    }

    .datasheet-actions {
        flex-direction: column;
    }

    .datasheet-actions .btn {
        width: 100%;
    }

    .main-content {
        padding: 20px 15px;
    }

    .chart-container {
        height: 300px;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 20px 15px;
    }

    .logo {
        font-size: 16px;
    }

    .logo svg {
        width: 32px;
        height: 32px;
    }

    .app-header h1 {
        font-size: 20px;
    }

    .section-title h2 {
        font-size: 18px;
    }

    .datasheet-section {
        padding: 15px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    table {
        font-size: 12px;
    }

    .specs-table td,
    .perf-table td {
        padding: 8px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .app-header,
    .app-footer,
    .btn,
    button {
        display: none;
    }

    .container {
        max-width: 100%;
    }

    .main-content {
        padding: 0;
    }

    .datasheet-section,
    .result-card {
        box-shadow: none;
        page-break-inside: avoid;
    }

    .chart-container {
        page-break-inside: avoid;
    }

    table {
        page-break-inside: avoid;
    }
}
