/* Modern CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Variables for theming */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #059669;
    --error-color: #dc2626;
    --warning-color: #d97706;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-900: #111827;
    --border-radius: 8px;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-elegant: 0 25px 50px -12px rgba(0, 0, 0, 0.35), 0 12px 25px -8px rgba(0, 0, 0, 0.2);
}

/* Base styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--gray-900);
    background: linear-gradient(135deg, #8B0000 0%, #5C0000 100%);
    min-height: 100vh;
    overflow-x: hidden; /* Prevent horizontal scroll */
    width: 100%;
    max-width: 100vw;
}

html {
    overflow-x: hidden; /* Prevent horizontal scroll at root level */
    max-width: 100vw;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
    box-sizing: border-box;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Upload Card */
.upload-card {
    background: linear-gradient(145deg, #ffffff 0%, #fafafa 100%);
    border-radius: 20px;
    padding: 3rem 2.5rem;
    box-shadow: var(--shadow-elegant);
    margin-bottom: 2rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.upload-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color) 0%, #667eea 50%, var(--primary-color) 100%);
}

/* Form Styles */
.upload-form {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
}

label {
    font-weight: 700;
    color: var(--gray-900);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

label::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 2px;
}

input[type="text"],
input[type="date"] {
    padding: 1rem 1.25rem;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

input[type="text"]:hover,
input[type="date"]:hover {
    border-color: var(--gray-300);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

input[type="text"]:focus,
input[type="date"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1),
        0 4px 12px rgba(37, 99, 235, 0.15);
    transform: translateY(-1px);
}

input[type="text"]:invalid {
    border-color: var(--error-color);
}

small {
    color: var(--gray-600);
    font-size: 0.8rem;
    font-style: italic;
    padding-left: 1.25rem;
}

/* File Input Styling */
.file-input-wrapper {
    position: relative;
}

input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-input-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 1.25rem;
    border: 3px dashed var(--gray-300);
    border-radius: 16px;
    background: linear-gradient(145deg, #fafafa 0%, #f5f5f5 100%);
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
}

.file-input-display:hover {
    border-color: var(--primary-color);
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.08) 0%, rgba(37, 99, 235, 0.05) 100%);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15),
        inset 0 2px 4px rgba(0, 0, 0, 0.04);
    transform: translateY(-2px);
}

.file-input-display.has-file {
    border-color: var(--success-color);
    background: linear-gradient(145deg, rgba(5, 150, 105, 0.08) 0%, rgba(5, 150, 105, 0.05) 100%);
    border-style: solid;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.15);
}

.file-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.file-text {
    color: var(--gray-700);
    font-weight: 600;
    font-size: 1rem;
}

/* Upload Button */
.upload-btn {
    background: linear-gradient(145deg, #e8eef9 0%, #d4e1f5 100%);
    color: var(--primary-color);
    border: none;
    padding: 1.125rem 2.25rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.15),
        -10px -10px 20px rgba(255, 255, 255, 0.7);
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}

.upload-btn:hover:not(:disabled) {
    background: linear-gradient(145deg, #dce7f7 0%, #c8d9f3 100%);
    box-shadow: 8px 8px 16px rgba(0, 0, 0, 0.15),
        -8px -8px 16px rgba(255, 255, 255, 0.7);
}

.upload-btn:active:not(:disabled) {
    background: linear-gradient(145deg, #c8d9f3 0%, #dce7f7 100%);
    box-shadow: inset 5px 5px 10px rgba(0, 0, 0, 0.15),
        inset -5px -5px 10px rgba(255, 255, 255, 0.5);
    transform: scale(0.98);
}

.upload-btn:disabled {
    background: linear-gradient(145deg, #e5e7eb 0%, #d1d5db 100%);
    color: var(--gray-600);
    cursor: not-allowed;
    box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.1),
        -5px -5px 10px rgba(255, 255, 255, 0.5);
    opacity: 0.6;
}

.btn-loader {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Result Display */
.result {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    border-left: 4px solid;
}

.result.success {
    background: rgba(5, 150, 105, 0.1);
    border-color: var(--success-color);
    color: var(--success-color);
}

.result.error {
    background: rgba(220, 38, 38, 0.1);
    border-color: var(--error-color);
    color: var(--error-color);
}

.result-content h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.result-details {
    margin-top: 0.75rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.75rem;
    border-radius: 4px;
    overflow-x: auto;
}

/* Info Section */
.info-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.info-section h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--gray-700);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.info-item {
    text-align: center;
    padding: 1rem;
}

.info-item h3 {
    margin-bottom: 0.5rem;
    color: var(--gray-700);
    font-size: 1rem;
}

.info-item p {
    color: var(--gray-600);
    font-size: 0.875rem;
}

code {
    background: var(--gray-100);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
}

/* Footer */
footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .upload-card {
        padding: 1.5rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-loader::before {
    content: '';
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Progress Bar */
.progress-container {
    margin-top: 1rem;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    height: 8px;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
    width: 0%;
}

/* Validation Styles */
.form-group.error input {
    border-color: var(--error-color);
}

.form-group.error small {
    color: var(--error-color);
}

.form-group.success input {
    border-color: var(--success-color);
}

/* 
Authentication Styles */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.title-section {
    text-align: left;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    color: white;
    font-size: 0.875rem;
}

.user-name {
    font-weight: 600;
    font-size: 1rem;
}

.user-email {
    opacity: 0.8;
}

.user-dept {
    opacity: 0.7;
    font-size: 0.75rem;
}

/* Role Badges */
.role-badge {
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.admin-badge {
    background: rgba(220, 38, 38, 0.2);
    color: rgba(220, 38, 38, 1);
    border: 1px solid rgba(220, 38, 38, 0.3);
}

.data-team-badge {
    background: rgba(37, 99, 235, 0.2);
    color: rgba(37, 99, 235, 1);
    border: 1px solid rgba(37, 99, 235, 0.3);
}

.field-user-badge {
    background: rgba(5, 150, 105, 0.2);
    color: rgba(5, 150, 105, 1);
    border: 1px solid rgba(5, 150, 105, 0.3);
}

.unauthorized-badge {
    background: rgba(156, 163, 175, 0.2);
    color: rgba(156, 163, 175, 1);
    border: 1px solid rgba(156, 163, 175, 0.3);
}

.user-groups {
    font-size: 0.75rem;
    opacity: 0.8;
    font-style: italic;
    cursor: help;
}

.logout-btn {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3),
        -4px -4px 8px rgba(255, 255, 255, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.logout-btn:hover {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    box-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3),
        -3px -3px 6px rgba(255, 255, 255, 0.1);
}

.logout-btn:active {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.15));
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.3),
        inset -2px -2px 4px rgba(255, 255, 255, 0.1);
    transform: scale(0.98);
}

/* Login Card */
.login-card {
    background: white;
    border-radius: 12px;
    padding: 3rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.login-content h2 {
    color: var(--gray-900);
    margin-bottom: 1rem;
    font-size: 1.875rem;
}

.login-content p {
    color: var(--gray-600);
    margin-bottom: 2rem;
    font-size: 1.125rem;
}

.sso-login-btn {
    background: linear-gradient(145deg, #e8eef9 0%, #d4e1f5 100%);
    color: var(--primary-color);
    border: none;
    padding: 1.25rem 2.5rem;
    border-radius: 50px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.15),
        -10px -10px 20px rgba(255, 255, 255, 0.7);
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}

.sso-login-btn:hover {
    background: linear-gradient(145deg, #dce7f7 0%, #c8d9f3 100%);
    box-shadow: 8px 8px 16px rgba(0, 0, 0, 0.15),
        -8px -8px 16px rgba(255, 255, 255, 0.7);
}

.sso-login-btn:active {
    background: linear-gradient(145deg, #c8d9f3 0%, #dce7f7 100%);
    box-shadow: inset 5px 5px 10px rgba(0, 0, 0, 0.15),
        inset -5px -5px 10px rgba(255, 255, 255, 0.5);
    transform: scale(0.98);
}

.login-icon {
    font-size: 1.25rem;
}

.login-info {
    background: var(--gray-50);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: left;
}

.login-info p {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.login-info p:last-child {
    margin-bottom: 0;
}

.login-info strong {
    color: var(--gray-900);
}

/* Unauthorized Access Styles */
.user-info.unauthorized {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: var(--border-radius);
    padding: 1rem;
    color: rgba(220, 38, 38, 1);
}

.user-info.unauthorized .user-name,
.user-info.unauthorized .user-email {
    color: rgba(220, 38, 38, 1);
}

.user-role.unauthorized {
    background: rgba(220, 38, 38, 0.2);
    color: rgba(220, 38, 38, 1);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0.5rem 0;
    display: inline-block;
}

.unauthorized-message {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(220, 38, 38, 0.05);
    border-radius: var(--border-radius);
    border-left: 4px solid rgba(220, 38, 38, 0.5);
}

.unauthorized-message p {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: rgba(220, 38, 38, 0.8);
}

.unauthorized-message p:last-child {
    margin-bottom: 0;
    font-weight: 500;
}

/* Role-Based Router Styles */
.interface-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

.interface-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-200);
}

.interface-header h2 {
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    font-size: 1.875rem;
}

.interface-header p {
    color: var(--gray-600);
    font-size: 1.125rem;
}

.interface-indicator {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
    margin-left: 1rem;
}

/* Admin Interface Styles */
.admin-selector-container {
    max-width: 800px;
    margin: 0 auto;
}

.interface-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.interface-option {
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.interface-option:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.option-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 1rem;
}

.option-content h4 {
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.option-content p {
    color: var(--gray-600);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.option-content ul {
    list-style: none;
    padding: 0;
    margin-bottom: 1.5rem;
}

.option-content li {
    color: var(--gray-600);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    padding-left: 1rem;
    position: relative;
}

.option-content li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
}

.interface-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.interface-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.csv-btn {
    background: var(--primary-color);
}

.field-btn {
    background: var(--success-color);
}

.field-btn:hover {
    background: #047857;
}

.admin-tools {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--gray-200);
    text-align: center;
}

.admin-tools h4 {
    color: var(--gray-900);
    margin-bottom: 1rem;
}

.admin-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.admin-action-btn {
    background: var(--gray-600);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-action-btn:hover {
    background: var(--gray-700);
}

/* Field Upload Interface Styles */
.field-upload-form-container {
    max-width: 600px;
    margin: 0 auto;
}

.field-upload-info {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--gray-200);
}

.field-upload-info h3 {
    text-align: center;
    color: var(--gray-900);
    margin-bottom: 1.5rem;
}

.field-upload-info .info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.field-upload-info .info-item {
    text-align: center;
    padding: 1rem;
}

.field-upload-info .info-item h4 {
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.field-upload-info .info-item p {
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* Unauthorized Interface Styles */
.unauthorized-container {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
}

.unauthorized-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.unauthorized-container h3 {
    color: var(--error-color);
    margin-bottom: 1rem;
    font-size: 1.875rem;
}

.unauthorized-container>p {
    color: var(--gray-600);
    margin-bottom: 2rem;
    font-size: 1.125rem;
}

.unauthorized-details {
    background: var(--gray-50);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: left;
}

.unauthorized-details h4 {
    color: var(--gray-900);
    margin-bottom: 1rem;
}

.unauthorized-details ul {
    list-style: none;
    padding: 0;
}

.unauthorized-details li {
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

.unauthorized-help {
    background: rgba(37, 99, 235, 0.05);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: left;
}

.unauthorized-help h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.unauthorized-help p {
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.unauthorized-help ul {
    margin-top: 1rem;
}

.unauthorized-help li {
    color: var(--gray-700);
    margin-bottom: 0.25rem;
}

.unauthorized-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.retry-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.retry-btn:hover {
    background: var(--primary-hover);
}

/* Select dropdown styling */
select {
    padding: 0.75rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Responsive adjustments for router */
@media (max-width: 768px) {
    .interface-options {
        grid-template-columns: 1fr;
    }

    .admin-actions {
        flex-direction: column;
        align-items: center;
    }

    .unauthorized-actions {
        flex-direction: column;
        align-items: center;
    }

    .interface-container {
        padding: 1.5rem;
    }
}

/* Interface Type Indicators */
.interface-type-indicator {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
}

.csv-indicator {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
}

.field-indicator {
    background: linear-gradient(135deg, var(--success-color), #047857);
}

.indicator-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.indicator-text {
    font-weight: 600;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.indicator-description {
    font-size: 0.875rem;
    opacity: 0.9;
    font-style: italic;
}

@media (max-width: 768px) {
    .interface-type-indicator {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .indicator-description {
        font-size: 0.75rem;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .title-section {
        text-align: center;
    }

    .user-info {
        align-items: center;
        text-align: center;
    }

    .login-card {
        padding: 2rem 1.5rem;
        margin: 0 1rem;
    }
}

/*
 Landing Page Styles */
.landing-page {
    background: white;
    border-radius: 20px;
    margin-top: 80px; /* Add space for username at top */
    margin-left: auto;
    margin-right: auto;
    max-width: 1200px;
    width: 100%;
    padding: 3.5rem 2.5rem;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5),
        0 15px 40px rgba(0, 0, 0, 0.35),
        0 8px 20px rgba(0, 0, 0, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 2rem;
    transition: all 0.3s ease;
    position: relative;
    box-sizing: border-box;
}

.landing-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 0 1rem;
}

.portal-logo {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--gray-100);
}

.logo-image {
    max-width: 220px;
    height: auto;
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.landing-header h1 {
    color: var(--gray-900);
    font-size: 2.25rem;
    margin-bottom: 1rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.landing-header p {
    color: var(--gray-600);
    font-size: 1.125rem;
}

/* Application Grid */
.application-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Changed from auto-fill to auto-fit, increased min from 200px */
    gap: 2rem;
    margin-bottom: 2rem;
    max-width: 1200px; /* Limit maximum width for better layout */
    margin-left: auto; /* Center the grid */
    margin-right: auto;
}

/* Application Card - Compact with Expand on Hover */
.app-card {
    border: 2px solid var(--gray-200);
    border-radius: 20px;
    padding: 2rem 1.5rem;
    min-height: 200px;
    max-width: 450px; /* Prevent cards from getting too wide */
    justify-self: center; /* Center cards when fewer than grid columns */
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    background: linear-gradient(145deg, #ffffff 0%, #f5f5f5 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15),
        0 8px 20px rgba(0, 0, 0, 0.12),
        0 4px 10px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-color) 35%, transparent 35%);
    opacity: 0;
    transition: opacity 0.5s ease;
    border-radius: 20px;
    pointer-events: none;
    z-index: 0;
}

.app-card:hover::before {
    opacity: 1;
}

.app-card:hover {
    border-color: var(--primary-color);
    min-height: 400px;
    padding: 2.5rem 2rem;
    padding-top: 10rem;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25),
        0 20px 40px rgba(0, 0, 0, 0.2),
        0 10px 20px rgba(0, 0, 0, 0.15),
        inset 0 2px 0 rgba(255, 255, 255, 0.9),
        inset 0 -2px 0 rgba(0, 0, 0, 0.08);
    transform: translateY(-15px) scale(1.05);
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
}

.app-icon {
    font-size: 4.5rem;
    margin-bottom: 0;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
    transition: all 0.5s ease;
    position: relative;
    z-index: 2;
}

.app-card:hover .app-icon {
    font-size: 3rem;
    margin-bottom: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    position: absolute;
    top: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
}

.app-content {
    width: 100%;
    position: relative;
    z-index: 2;
}

.app-title {
    color: var(--gray-900);
    font-size: 1.125rem;
    margin-bottom: 0;
    font-weight: 600;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.5s ease;
}

.app-card:hover .app-title {
    max-height: 100px;
    opacity: 1;
    margin-bottom: 0.75rem;
    color: var(--gray-900);
    font-size: 1.35rem;
}

.app-description {
    color: var(--gray-600);
    font-size: 0.875rem;
    margin-bottom: 0;
    line-height: 1.5;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.5s ease 0.1s;
}

.app-card:hover .app-description {
    max-height: 200px;
    opacity: 1;
    margin-bottom: 1.5rem;
    color: var(--gray-700);
}

.app-launch-btn {
    background: linear-gradient(145deg, #ffffff 0%, #f0f0f0 100%);
    color: var(--primary-color);
    border: none;
    padding: 0.875rem 1.75rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease 0.2s;
    width: 100%;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    box-shadow: 6px 6px 12px rgba(0, 0, 0, 0.15),
        -6px -6px 12px rgba(255, 255, 255, 0.7);
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}

.app-card:hover .app-launch-btn {
    max-height: 100px;
    opacity: 1;
    padding: 0.875rem 1.75rem;
}

.app-launch-btn:hover {
    background: linear-gradient(145deg, #f5f5f5 0%, #e5e5e5 100%);
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.15),
        -4px -4px 8px rgba(255, 255, 255, 0.7);
    transform: translateY(-2px);
}

.app-launch-btn:active {
    background: linear-gradient(145deg, #e5e5e5 0%, #f5f5f5 100%);
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.15),
        inset -3px -3px 6px rgba(255, 255, 255, 0.5);
    transform: scale(0.98);
}

/* Landing Footer */
.landing-footer {
    text-align: center;
    padding-top: 2rem;
    border-top: 2px solid var(--gray-200);
}

.landing-footer p {
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* No Apps Message */
.no-apps-message {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--gray-600);
}

.no-apps-message p {
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
}

/* Responsive Landing Page */
@media (max-width: 768px) {
    .landing-page {
        padding: 2rem 1.5rem;
    }

    .landing-header h1 {
        font-size: 1.5rem;
    }

    .landing-header p {
        font-size: 1rem;
    }

    .logo-image {
        max-width: 150px;
    }

    .application-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .app-card {
        padding: 1.25rem;
    }

    .app-icon {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .landing-page {
        padding: 1.5rem 1rem;
    }

    .landing-header h1 {
        font-size: 1.25rem;
    }

    .logo-image {
        max-width: 120px;
    }
}

/* Navigation Breadcrumb Styles */
.navigation-breadcrumb {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: white;
    margin-bottom: 1rem;
}

.breadcrumb-home {
    color: white;
    font-weight: 500;
    transition: opacity 0.2s;
}

.breadcrumb-home:hover {
    opacity: 0.8;
}

.breadcrumb-separator {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 300;
}

.breadcrumb-current {
    color: white;
    font-weight: 600;
}

/* Back to Portal Button */
.back-to-portal-btn {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3),
        -4px -4px 8px rgba(255, 255, 255, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.back-to-portal-btn:hover {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    box-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3),
        -3px -3px 6px rgba(255, 255, 255, 0.1);
}

.back-to-portal-btn:active {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.15));
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.3),
        inset -2px -2px 4px rgba(255, 255, 255, 0.1);
    transform: scale(0.98);
}

.back-icon {
    font-size: 1rem;
}

@media (max-width: 768px) {
    .navigation-breadcrumb {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
}

/* Upload Section Header */
.upload-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-200);
}

.upload-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 2rem;
}

.upload-header-left {
    flex: 1;
}

.upload-header-left h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
}

.upload-header-left p {
    margin: 0;
    color: var(--gray-600);
    font-size: 1rem;
}

.upload-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.header-user-email {
    color: var(--gray-700);
    font-size: 0.95rem;
    font-weight: 500;
}

.header-logout-btn {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-logout-btn:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

@media (max-width: 768px) {
    .upload-header {
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }

    .upload-header-top {
        flex-direction: column;
        gap: 1rem;
    }

    .upload-header-right {
        width: 100%;
        justify-content: space-between;
    }
}

/* 
Landing page and upload page - position user info in top right corner */
.landing-page~header .header-content,
body:has(.landing-page[style*="display: block"]) #portalHeader .header-content,
body:has(#uploadSection[style*="display: block"]) #portalHeader .header-content {
    position: absolute; /* Scrolls with page, not fixed to viewport */
    top: 1rem;
    right: 1rem;
    width: auto;
    z-index: 1000;
}

body:has(.landing-page[style*="display: block"]) #portalHeader,
body:has(#uploadSection[style*="display: block"]) #portalHeader {
    margin-bottom: 0;
    position: relative;
    width: 100%;
    height: 0;
}

/* Alternative: Direct class-based approach for landing page */
#portalHeader.landing-header .header-content {
    position: absolute; /* Scrolls with page, not fixed to viewport */
    top: 1rem;
    right: 1rem;
    width: auto;
    z-index: 1000;
}

/* Hide header title section on upload page */
body:has(#uploadSection[style*="display: block"]) #portalHeader .title-section {
    display: none;
}


/* Back to Portal Button */
.back-to-portal-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.back-to-portal-btn:hover {
    background: var(--primary-hover);
    transform: translateX(-2px);
}

.back-icon {
    font-size: 1rem;
}

/* =====
=======================================
   PSMI File Upload Styles
   ============================================ */

/* Folder Selection */
.folder-selection {
    margin-bottom: 2rem;
}

.folder-selection label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.folder-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.folder-btn {
    background: white;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray-700);
}

.folder-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.folder-btn.selected {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.folder-icon {
    font-size: 2rem;
}

.selected-folder-display {
    padding: 0.75rem;
    background: var(--gray-100);
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 500;
    color: var(--gray-700);
}

/* File Drop Zone */
.file-drop-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    background: var(--gray-50);
}

.file-drop-zone:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.file-drop-zone.drag-over {
    border-color: var(--primary-color);
    background: var(--primary-light);
    border-style: solid;
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-icon {
    font-size: 3rem;
}

.drop-zone-content p {
    color: var(--gray-600);
    margin: 0;
}

.browse-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.browse-btn:hover {
    background: var(--primary-hover);
}

/* Selected Files List */
.selected-files {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
}

.selected-files h4 {
    margin: 0 0 1rem 0;
    color: var(--gray-800);
}

.files-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
}

.file-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: var(--gray-800);
}

.file-size {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.remove-file-btn {
    background: var(--error-color);
    color: white;
    border: none;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-file-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Upload Progress */
.upload-progress {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
}

.upload-progress h4 {
    margin: 0 0 1rem 0;
    color: var(--gray-800);
}

/* Upload Results */
.upload-results {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
}

.upload-results h4 {
    margin: 0 0 1rem 0;
    color: var(--gray-800);
}

.upload-summary {
    margin-bottom: 1rem;
    padding: 1rem;
    background: white;
    border-radius: var(--border-radius);
}

.upload-summary p {
    margin: 0.5rem 0;
}

.upload-summary .error {
    color: var(--error-color);
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border-radius: var(--border-radius);
    border-left: 4px solid;
}

.result-item.success {
    border-left-color: var(--success-color);
}

.result-item.error {
    border-left-color: var(--error-color);
}

.result-icon {
    font-size: 1.25rem;
    font-weight: bold;
}

.result-item.success .result-icon {
    color: var(--success-color);
}

.result-item.error .result-icon {
    color: var(--error-color);
}

.result-filename {
    flex: 1;
    font-weight: 500;
    color: var(--gray-800);
}

.result-error {
    font-size: 0.875rem;
    color: var(--error-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .folder-buttons {
        grid-template-columns: 1fr;
    }

    .file-drop-zone {
        padding: 1.5rem;
    }

    .upload-icon {
        font-size: 2rem;
    }
}