/* ===================================
   Slick Line Analysis Tool - Modern UI/UX Design
   Professional Oil & Gas Industry Theme
   ==================================== */

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

:root {
    /* Oil & Gas Industry Colors */
    --primary-color: #1e40af;        /* Deep oil blue */
    --primary-light: #3b82f6;        /* Bright blue */
    --primary-dark: #0f2847;         /* Dark navy */
    --accent-color: #f59e0b;         /* Amber/Gold */
    --accent-light: #fbbf24;         /* Light amber */
    --success-color: #10b981;        /* Green */
    --danger-color: #ef4444;         /* Red */
    --warning-color: #f97316;        /* Orange */
    --pressure-color: #dc2626;       /* Deep red */
    --temperature-color: #0ea5e9;    /* Sky blue */

    /* Neutral Colors */
    --bg-dark: #0f172a;              /* Very dark blue */
    --bg-light: #f8fafc;             /* Light gray */
    --bg-white: #ffffff;             /* White */
    --text-primary: #0f172a;         /* Dark text */
    --text-secondary: #64748b;       /* Gray text */
    --text-light: #94a3b8;           /* Light gray text */
    --border-color: #e2e8f0;         /* Border */

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 25px 50px rgba(0, 0, 0, 0.2);
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-white);
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: white;
    padding: 40px 20px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.header-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.header-content h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    font-weight: 700;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.header-content h1::before {
    content: '';
    width: 50px;
    height: 50px;
    background: var(--accent-color);
    border-radius: 12px;
    display: inline-block;
}

.header-content .subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    letter-spacing: 1px;
    font-weight: 300;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    padding: 40px 20px;
}

/* ===== UPLOAD SECTION ===== */
.upload-section {
    margin-bottom: 50px;
}

.upload-box {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 50px 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.upload-box:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow-xl);
}

.upload-box h2 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 20px;
    font-weight: 600;
}

.file-info-banner {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.05) 0%, rgba(245, 158, 11, 0.05) 100%);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

.file-info-banner h3 {
    color: var(--primary-color);
    margin: 0 0 15px 0;
    font-size: 1.1rem;
}

.file-info-banner p {
    color: var(--text-secondary);
    margin: 8px 0;
    font-size: 0.95rem;
}

.file-info-banner code {
    background: rgba(30, 64, 175, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--primary-color);
    font-weight: 600;
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 500px;
    margin-bottom: 25px;
}

#fileInput {
    display: none;
}

.file-input-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 50px 40px;
    border: 3px dashed var(--primary-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.02) 0%, rgba(245, 158, 11, 0.02) 100%);
}

.file-input-label:hover {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.05) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.file-input-label.drag-over {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.1) 0%, rgba(245, 158, 11, 0.1) 100%);
    border-color: var(--accent-color);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.upload-icon {
    font-size: 3rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.file-input-label span:last-child {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.file-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.file-name {
    height: 30px;
    color: var(--success-color);
    font-weight: 600;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== BUTTONS ===== */
.analyze-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    padding: 16px 50px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
}

.analyze-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

.analyze-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.analyze-btn:active:not(:disabled) {
    transform: translateY(-1px);
}

/* ===== LOADING INDICATOR ===== */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 30px;
}

.loading-indicator.hidden {
    display: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(30, 64, 175, 0.2);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-indicator p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== RESULTS SECTION ===== */
.results-section.hidden {
    display: none;
}

.results-section {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-white);
    border-radius: 14px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.card h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 20px;
    font-weight: 600;
}

/* ===== FORMAT CARD ===== */
.format-card {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.05) 0%, rgba(245, 158, 11, 0.05) 100%);
    border: 2px solid var(--primary-color);
    margin-bottom: 30px;
}

.format-badge {
    padding: 25px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.format-badge h4 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.format-badge p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.format-badge code {
    background: rgba(0, 0, 0, 0.05);
    padding: 4px 10px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
}

.csv-badge {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
    border-left: 5px solid var(--success-color);
}

.csv-badge h4 {
    color: #059669;
}

.log-badge {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1) 0%, rgba(234, 88, 12, 0.1) 100%);
    border-left: 5px solid var(--warning-color);
}

.log-badge h4 {
    color: #ea580c;
}

/* ===== METADATA CARD ===== */
.metadata-card {
    background: linear-gradient(135deg, var(--bg-white) 0%, rgba(30, 64, 175, 0.02) 100%);
}

.device-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.device-info-item {
    background: var(--bg-light);
    padding: 18px;
    border-radius: 10px;
    border-left: 4px solid var(--accent-color);
}

.device-info-item strong {
    display: block;
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.device-info-item span {
    color: var(--text-secondary);
    font-size: 1rem;
}

.calibration-note {
    background: #fef3c7;
    border-right: 4px solid #f59e0b;
    padding: 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #92400e;
}

.calibration-note p {
    margin: 0;
}

.calibration-note strong {
    color: #78350f;
}

/* ===== STATISTICS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: 14px;
    padding: 28px;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card.pressure-card {
    border-top-color: var(--pressure-color);
}

.stat-card.temperature-card {
    border-top-color: var(--temperature-color);
}

.stat-card.data-card {
    border-top-color: var(--accent-color);
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    gap: 15px;
}

.stat-card h3 {
    margin: 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.unit-badge {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.1) 0%, rgba(245, 158, 11, 0.1) 100%);
    color: var(--primary-color);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    border: 2px solid var(--primary-color);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: unitBadgeUpdate 0.4s ease;
}

@keyframes unitBadgeUpdate {
    0% {
        transform: scale(1);
        box-shadow: none;
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 0 20px rgba(30, 64, 175, 0.4);
    }
    100% {
        transform: scale(1);
        box-shadow: none;
    }
}

.stat-values {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.stat-item:hover {
    background: rgba(30, 64, 175, 0.05);
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
}

.stat-value {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.1rem;
    font-family: 'Courier New', monospace;
}

/* ===== CHARTS SECTION ===== */
.charts-section {
    margin-bottom: 35px;
}

.charts-section h2 {
    font-size: 1.6rem;
    color: white;
    margin-bottom: 30px;
    padding: 20px 30px;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 25px;
}

.chart-card {
    background: var(--bg-white);
    border-radius: 14px;
    padding: 25px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.chart-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-card h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.chart-container {
    position: relative;
    height: 350px;
    margin-top: 15px;
}

/* ===== CONVERSION CONTROLS ===== */
.conversion-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin: 30px 0;
    padding: 25px;
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.05) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-radius: 12px;
    border: 2px solid var(--primary-color);
}

.conversion-btn {
    padding: 14px 24px;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.95rem;
}

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

/* ===== EXPORT SECTION ===== */
.export-card {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.05) 0%, rgba(245, 158, 11, 0.05) 100%);
    border: 2px solid var(--primary-color);
}

.export-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
}

.export-btn {
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.95rem;
}

.json-btn {
    background: #3b82f6;
    color: white;
}

.csv-btn {
    background: #10b981;
    color: white;
}

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

.export-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    opacity: 0.9;
}

/* ===== ERROR SECTION ===== */
.error-section.hidden {
    display: none;
}

.error-box {
    background: white;
    border-radius: 14px;
    padding: 50px 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    border-right: 5px solid var(--danger-color);
}

.error-box h3 {
    color: var(--danger-color);
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.error-box p {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1rem;
}

.retry-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 12px 35px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ===== FOOTER ===== */
.footer {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: white;
    text-align: center;
    padding: 35px 20px;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.footer p {
    margin: 8px 0;
    font-size: 0.95rem;
    opacity: 0.9;
}

.footer-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    margin: 12px 0;
}

.footer-designer {
    font-size: 0.9rem;
    margin-top: 10px;
    padding-top: 10px;
}

.footer-designer strong {
    color: var(--accent-color);
    font-weight: 700;
}

.facebook-link {
    color: var(--accent-light);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.facebook-link:hover {
    color: white;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .header-content h1 {
        font-size: 2.2rem;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 25px 15px;
    }

    .upload-box {
        padding: 30px 20px;
    }

    .header-content h1 {
        font-size: 2rem;
    }

    .header-content .subtitle {
        font-size: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .file-input-label {
        padding: 30px 20px;
    }

    .upload-icon {
        font-size: 2rem;
    }

    .chart-container {
        height: 300px;
    }

    .conversion-controls {
        grid-template-columns: 1fr;
    }

    .export-buttons {
        grid-template-columns: 1fr;
    }

    .device-info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    .header {
        padding: 25px 15px;
    }

    .header-content h1 {
        font-size: 1.5rem;
        gap: 10px;
    }

    .header-content h1::before {
        width: 35px;
        height: 35px;
    }

    .card {
        padding: 20px;
    }

    .analyze-btn {
        width: 100%;
        padding: 12px 20px;
    }

    .chart-container {
        height: 250px;
    }

    .device-info-item {
        padding: 15px;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    body {
        background: white;
    }

    .header {
        box-shadow: none;
    }

    .upload-section,
    .export-card,
    .footer,
    .conversion-controls {
        display: none;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--border-color);
        page-break-inside: avoid;
    }

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

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}