/* Modern Medical ECG Analyzer Styles */
:root {
    --primary-color: #2c5aa0;
    --secondary-color: #4a90e2;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-blue: #e3f2fd;
    --dark-blue: #1565c0;
    --text-dark: #2c3e50;
    --text-light: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 2.8rem;
    font-weight: 300;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header .subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Main Content Card */
.main-card {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-hover);
    overflow: hidden;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 30px;
    text-align: center;
}

.card-header h2 {
    font-size: 1.8rem;
    font-weight: 400;
    margin-bottom: 10px;
}

.card-header p {
    opacity: 0.9;
    font-size: 1rem;
}

/* Patient Details Section */
.patient-details-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    border: 2px solid #e3f2fd;
}

.patient-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 10fr));
    gap: 20px;
    margin-bottom: 20px;
}

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

.field-label {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.field-group input,
.field-group select {
    padding: 12px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    width: 100%;
}

.field-group input:focus,
.field-group select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
    transform: translateY(-1px);
}

.field-group input:valid,
.field-group select:valid {
    border-color: var(--success-color);
}

/* Specific styling for select dropdown */
.field-group select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 12px;
    padding-right: 40px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.field-group select:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%234a90e2' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

.field-error {
    color: var(--danger-color);
    font-size: 0.8rem;
    margin-top: 5px;
    padding: 5px 10px;
    background: #f8d7da;
    border-radius: 5px;
    border-left: 3px solid var(--danger-color);
}

/* File Upload Section */
.file-upload-section {
    margin-bottom: 25px;
}

/* Upload Form Improvements */
.upload-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

/* Form validation states */
.field-group input.is-valid,
.field-group select.is-valid {
    border-color: var(--success-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='m2.3 6.73.94-.94-.94-.94L1.36 5.8l-.94-.94L0 5.27l1.88 1.46L6 2.6l-.94-.94z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

.field-group input.is-invalid,
.field-group select.is-invalid {
    border-color: var(--danger-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 4.6l1.4 1.4 1.4-1.4M8.6 6l-1.4 1.4 1.4 1.4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

@media (max-width: 768px) {
    .patient-fields-grid {
        grid-template-columns: 1fr;
    }
    
    .patient-details-section {
        padding: 20px 15px;
    }
}

/* Upload Section */
.upload-section {
    padding: 40px;
}

.upload-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 400px;
}

.file-input {
    width: 105%;
    height: 130px;
    border: 3px dashed var(--secondary-color);
    border-radius: 15px;
    background: var(--light-blue);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.file-input:hover {
    border-color: var(--primary-color);
    background: #bbdefb;
    transform: translateY(-2px);
}

.file-input input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-input-icon {
    font-size: 2.5rem;
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.file-input-text {
    color: var(--text-dark);
    font-weight: 500;
    text-align: center;
}

/* Upload Button */
.upload-btn {
    background: linear-gradient(135deg, var(--success-color), #20c997);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    background: linear-gradient(135deg, #20c997, var(--success-color));
}

.upload-btn:active {
    transform: translateY(0);
}

/* Image Preview */
.image-preview {
    margin: 30px 0;
    text-align: center;
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.preview-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 15px;
}

.image-info {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Analysis Results */
.results-section {
    margin-top: 40px;
}

.results-card {
    background: white;
    border-radius: 15px;
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: slideInUp 0.6s ease-out;
}

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

.results-header {
    background: linear-gradient(135deg, var(--success-color), #20c997);
    color: white;
    padding: 20px 30px;
}

.results-header h3 {
    font-size: 1.5rem;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 10px;
}

.results-content {
    padding: 30px;
}

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

.analysis-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border-left: 4px solid var(--secondary-color);
    transition: all 0.3s ease;
}

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

.analysis-item h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.analysis-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.analysis-detail {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* Detailed Findings */
.findings-section {
    margin-top: 30px;
}

.findings-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab-button {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--text-light);
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.finding-list {
    list-style: none;
}

.finding-list li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.finding-list li:before {
    content: "✓";
    color: var(--success-color);
    font-weight: bold;
    margin-top: 2px;
}

/* Recommendations */
.recommendations {
    background: #e8f5e8;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    border-left: 4px solid var(--success-color);
}

.recommendations h4 {
    color: var(--success-color);
    margin-bottom: 15px;
}

.recommendation-list {
    list-style: none;
}

.recommendation-list li {
    padding: 5px 0;
    color: var(--text-dark);
}

.recommendation-list li:before {
    content: "→";
    color: var(--success-color);
    font-weight: bold;
    margin-right: 8px;
}

/* Disclaimer */
.disclaimer {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin-top: 25px;
    color: #856404;
    font-size: 0.9rem;
    line-height: 1.4;
}

.disclaimer strong {
    color: #b8860b;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2.2rem;
    }
    
    .upload-section {
        padding: 30px 20px;
    }
    
    .analysis-grid {
        grid-template-columns: 1fr;
    }
    
    .findings-tabs {
        flex-direction: column;
    }
    
    .tab-button {
        border-bottom: 1px solid var(--border-color);
        border-right: none;
    }
    
    .tab-button.active {
        border-bottom-color: var(--primary-color);
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .card-header {
        padding: 20px;
    }
    
    .upload-section {
        padding: 20px 15px;
    }
    
    .file-input {
        height: 100px;
    }
    
    .results-content {
        padding: 20px;
    }
}

/* Icons (you can replace with actual icon fonts like Font Awesome) */
.icon-heart::before { content: "♥"; }
.icon-activity::before { content: "⚡"; }
.icon-chart::before { content: "📊"; }
.icon-check::before { content: "✓"; }
.icon-upload::before { content: "⬆"; }
.icon-image::before { content: "🖼"; }