/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #ffffff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 15px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

header p {
    font-size: 1.2rem;
    color: #ffffff;
    font-weight: 400;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Utility classes */
.hidden {
    display: none !important;
}

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

/* Upload Section */
.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 50px 30px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.upload-area:hover::before,
.upload-area.dragover::before {
    opacity: 1;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.upload-area p {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #ffffff;
    font-weight: 500;
    position: relative;
    z-index: 1;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.upload-area small {
    color: #f1f5f9;
    font-size: 0.95rem;
    position: relative;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.link-button {
    background: none;
    border: none;
    color: #fbbf24;
    cursor: pointer;
    text-decoration: underline;
    font-size: inherit;
    padding: 0;
    font-weight: 600;
    transition: color 0.3s ease;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.link-button:hover {
    color: #fcd34d;
}

.file-info {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid rgba(34, 197, 94, 0.4);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    color: #ffffff;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    font-weight: 500;
}

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

.message {
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    position: relative;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.message.with-progress::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.6) 100%);
    border-radius: 0 0 12px 12px;
    animation: progressBar var(--duration, 3s) linear forwards;
}

.message.info.with-progress::after {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.8) 0%, rgba(96, 165, 250, 0.6) 100%);
}

.message.success.with-progress::after {
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.8) 0%, rgba(74, 222, 128, 0.6) 100%);
}

@keyframes progressBar {
    from {
        width: 0;
        opacity: 1;
    }
    to {
        width: 100%;
        opacity: 1;
    }
}

.message.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25) 0%, rgba(59, 130, 246, 0.15) 100%);
    border-color: rgba(59, 130, 246, 0.4);
    color: #ffffff;
    font-weight: 500;
}

.message.success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.25) 0%, rgba(34, 197, 94, 0.15) 100%);
    border-color: rgba(34, 197, 94, 0.4);
    color: #ffffff;
    font-weight: 500;
}

.message.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.25) 0%, rgba(239, 68, 68, 0.15) 100%);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ffffff;
    font-weight: 500;
}

.message .close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
}

.message .close-btn:hover {
    opacity: 1;
}

/* Configuration Section */
.config-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.config-section h3 {
    margin-bottom: 25px;
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

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

.config-item {
    display: flex;
    flex-direction: column;
}

.config-item label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #ffffff;
    font-size: 0.95rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.config-item input,
.config-item select {
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    font-weight: 500;
}

.config-item input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.config-item input:focus,
.config-item select:focus {
    outline: none;
    border-color: rgba(96, 165, 250, 0.6);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
    background: rgba(255, 255, 255, 0.15);
}

/* Preview Section */
.preview-section {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 25px;
    margin-top: 25px;
}

.preview-section h4 {
    margin-bottom: 20px;
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.label-preview {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.sample-label {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.8) 100%);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 20px;
    font-size: 10px;
    line-height: 1.6;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
    color: #1a202c;
}

/* Patient Section */
.patient-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 20px;
}

.section-header h3 {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

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

.patient-list {
    max-height: 400px;
    overflow-y: auto;
}

.patient-item {
    display: flex;
    align-items: center;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.patient-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.patient-item.selected {
    background: rgba(96, 165, 250, 0.15);
    border-color: rgba(96, 165, 250, 0.4);
    box-shadow: 0 4px 16px rgba(96, 165, 250, 0.2);
}

.patient-checkbox {
    margin-right: 15px;
}

.patient-info {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

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

.patient-field label {
    font-size: 0.85rem;
    color: #e2e8f0;
    margin-bottom: 4px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.patient-field span {
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.patient-actions {
    margin-left: 15px;
}

.remove-btn {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(220, 38, 38, 0.2) 100%);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ffffff;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    font-weight: 600;
}

.remove-btn:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3) 0%, rgba(220, 38, 38, 0.3) 100%);
    color: #ffffff;
    transform: scale(1.05);
}

/* Action Section */
.action-section {
    text-align: center;
    margin: 30px 0;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 14px 28px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0 10px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.btn-primary::before,
.btn-secondary::before,
.btn-danger::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.8) 0%, rgba(29, 78, 216, 0.8) 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.9) 0%, rgba(30, 64, 175, 0.9) 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:disabled {
    background: linear-gradient(135deg, rgba(156, 163, 175, 0.6) 0%, rgba(107, 114, 128, 0.6) 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-secondary {
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.350) 0%, rgba(75, 85, 99, 0.350) 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, rgba(75, 85, 99, 0.5) 0%, rgba(55, 65, 81, 0.5) 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(107, 114, 128, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-secondary:hover::before {
    opacity: 1;
}

.btn-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.8) 0%, rgba(220, 38, 38, 0.8) 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.9) 0%, rgba(185, 28, 28, 0.9) 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(239, 68, 68, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-danger:hover::before {
    opacity: 1;
}

/* Spinner */
.spinner {
    animation: spin 1s linear infinite;
}

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

/* Custom Scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    backdrop-filter: blur(10px);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.2) 100%);
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.3) 100%);
}

::-webkit-scrollbar-corner {
    background: rgba(255, 255, 255, 0.1);
}

/* Apply to html and body specifically */
html::-webkit-scrollbar,
body::-webkit-scrollbar {
    width: 14px;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.15) 100%);
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.25) 100%);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header {
        padding: 30px 15px;
    }
    
    header h1 {
        font-size: 2.2rem;
    }
    
    .config-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .config-section,
    .patient-section {
        padding: 20px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .header-actions {
        justify-content: center;
        gap: 8px;
    }
    
    .patient-info {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .patient-item {
        padding: 15px;
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        margin: 5px;
        width: 100%;
        max-width: 300px;
        padding: 12px 20px;
    }
    
    .upload-area {
        padding: 30px 20px;
    }
    
    .label-preview {
        padding: 20px;
        min-height: 200px;
    }
}