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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(31, 38, 135, 0.25);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 0.95rem;
    color: #666;
    margin: 0;
}

/* Navigation */
.config-nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.nav-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Main content - no longer used as tabs are standalone */

/* Form sections */
.form-section {
    margin-bottom: 30px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.form-section:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.form-section h2 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Form groups */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

input[type="text"],
input[type="url"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input[readonly] {
    background-color: #f8f9fa;
    color: #666;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.field-help {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

/* Toggle password button */
.toggle-password {
    position: absolute;
    right: 12px;
    top: 38px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    z-index: 1;
}

/* Checkbox styling */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    gap: 10px;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.checkmark {
    position: relative;
}

/* File upload area */
.file-upload-area {
    border: 2px dashed #667eea;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background: rgba(102, 126, 234, 0.02);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: #5a67d8;
    background: rgba(102, 126, 234, 0.05);
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    color: #667eea;
}

.upload-btn {
    background: none;
    border: none;
    color: #667eea;
    text-decoration: underline;
    cursor: pointer;
    font-size: inherit;
    pointer-events: all;
}

.upload-help {
    font-size: 12px;
    color: #666;
    margin-top: 10px;
}

#fileInput {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* File list */
.file-list {
    margin-top: 15px;
}

/* Security Warning Styles */
.security-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    margin-top: 8px;
    border-radius: 6px;
    font-size: 0.9em;
    border: 1px solid transparent;
}

.security-warning.high { /* Matched with JS: validation.risk */
    background-color: #fff5f5;
    border-color: #e53e3e;
    color: #c53030;
}

.security-warning.medium { /* Matched with JS: validation.risk */
    background-color: #fffaf0;
    border-color: #dd6b20;
    color: #c05621;
}

.security-warning.low { /* Matched with JS: validation.risk */
    background-color: #f0fff4; /* A light green for low risk */
    border-color: #38a169;
    color: #2f855a;
}

.security-warning-field { /* Default for high risk */
    border: 2px solid #e53e3e !important; 
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.2) !important;
}

.security-warning-field.medium-risk {
    border: 2px solid #dd6b20 !important;
    box-shadow: 0 0 0 3px rgba(221, 107, 32, 0.2) !important;
}

.security-warning-field.low-risk {
    border: 2px solid #38a169 !important; 
    box-shadow: 0 0 0 3px rgba(56, 161, 105, 0.2) !important;
}

.warning-icon { /* Used in JS: displaySecurityWarning */
    font-size: 1.2em;
}

.warning-text { /* Used in JS: displaySecurityWarning */
    flex-grow: 1;
}

/* Security Blockade Modal Styles */
.security-blockade-overlay { /* Used in JS: displaySecurityBlockade */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75); /* Darker overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000; 
    animation: fadeIn 0.3s ease-out;
    padding: 20px; /* Add padding for smaller screens */
}

.security-blockade-modal { /* Used in JS: displaySecurityBlockade */
    background: white;
    border-radius: 12px;
    max-width: 600px; 
    width: 100%; /* Responsive width */
    max-height: 90vh; 
    display: flex; 
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

.security-blockade-header { /* Used in JS: displaySecurityBlockade */
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    color: white;
    padding: 20px 25px; 
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    gap: 15px; 
    position: relative;
    flex-shrink: 0; 
}

.security-blockade-icon { /* Used in JS: displaySecurityBlockade */
    font-size: 28px; 
}

.security-blockade-header h3 { /* Used in JS: displaySecurityBlockade */
    margin: 0;
    font-size: 1.4em; 
}

.security-blockade-close { /* Used in JS: displaySecurityBlockade */
    position: absolute;
    top: 10px; /* Adjusted for better alignment */
    right: 10px; /* Adjusted for better alignment */
    background: none;
    border: none;
    color: white;
    font-size: 28px; 
    cursor: pointer;
    width: 40px; /* Larger touch target */
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.security-blockade-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.security-blockade-content { /* Used in JS: displaySecurityBlockade */
    padding: 25px; 
    overflow-y: auto; 
    flex-grow: 1; 
}

.security-blockade-message { /* Used in JS: displaySecurityBlockade */
    margin-bottom: 20px;
    line-height: 1.6;
    color: #4a5568;
    font-size: 1.05em; 
}

.security-issues { /* Used in JS: displaySecurityBlockade */
    max-height: 40vh; 
    overflow-y: auto; 
    padding-right: 10px; 
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    background-color: #f8f9fa; /* Light background for issue list */
}

.security-issue-section { /* Used in JS: renderSecurityIssues */
    margin-bottom: 20px;
}
.security-issue-section:last-child {
    margin-bottom: 0;
}

.security-issue-title { /* Used in JS: renderSecurityIssues */
    font-size: 1.15em; /* Slightly larger */
    margin-bottom: 12px; /* Increased margin */
    padding-bottom: 8px; /* Increased padding */
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600; /* Bolder title */
}
.security-issue-title.danger { color: #c53030; } /* Matched with JS */
.security-issue-title.warning { color: #c05621; } /* Matched with JS */

.security-issue { /* Used in JS: renderSecurityIssues */
    padding: 12px; /* Increased padding */
    border-radius: 6px;
    margin-bottom: 10px;
    line-height: 1.5;
}
.security-issue.danger { background-color: #fff5f5; border-left: 4px solid #e53e3e; } /* Matched with JS */
.security-issue.warning { background-color: #fffaf0; border-left: 4px solid #dd6b20; } /* Matched with JS */

.security-issue strong {
    display: block;
    margin-bottom: 5px; /* Increased margin */
    color: #2d3748;
    font-weight: 600;
}
.security-issue p {
    margin: 0 0 5px 0; /* Increased margin */
    color: #4a5568;
}
.security-issue small {
    font-size: 0.9em;
    color: #718096;
    display: block;
    margin-top: 3px; /* Added margin */
}

.security-blockade-actions { /* Used in JS: displaySecurityBlockade */
    display: flex;
    gap: 15px; 
    justify-content: flex-end;
    margin-top: 25px; 
    padding: 20px 25px; /* Added padding to match content */
    border-top: 1px solid #e2e8f0; 
    flex-shrink: 0; 
    background-color: #f8f9fa; /* Light background for actions footer */
    border-radius: 0 0 12px 12px; /* Rounded bottom corners */
}

/* Tab Container */
.tab-container {
    display: flex;
    flex-direction: column;
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid #e1e5e9;
}

.logout-btn {
    margin-left: auto;
    margin-right: 0;
    /* Removed absolute positioning for better flexbox alignment */
    transform: none;
    position: static;
    top: auto;
    right: auto;
    z-index: 2;
}

.tab-nav .tab-btn, .tab-nav .logout-btn {
    /* Ensure all buttons in tab-nav have consistent height */
    height: 38px;
}

.tab-btn {
    padding: 12px 25px;
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-size: 1rem;
    font-weight: 500;
    color: #555;
    position: relative;
    transition: color 0.3s ease, border-bottom-color 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    font-weight: 600;
    border-bottom-color: #667eea;
}

/* Tab Content */
.tab-content {
    display: none; /* Hide inactive tab content by default */
    animation: fadeIn 0.5s ease-in-out;
}

.tab-content.active {
    display: block; /* Show active tab content */
}

/* Keyframes for animations (already in app.js, but good for CSS consistency) */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Security toast notifications */
.security-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 15px 20px;
    max-width: 350px;
    z-index: 1000;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid #e53e3e;
}

.security-toast.warning {
    border-left-color: #dd6b20;
}

.security-toast.info {
    border-left-color: #3182ce;
}

.security-toast.success {
    border-left-color: #38a169;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Security field validation states */
.form-group.security-validated .security-status {
    margin-top: 5px;
}

.security-feedback {
    margin-top: 8px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.security-feedback.positive {
    color: #38a169;
}

.security-feedback.negative {
    color: #e53e3e;
}

.security-feedback .icon {
    font-size: 14px;
}

/* Security overlay for dangerous inputs */
.security-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(229, 62, 62, 0.1);
    border-radius: 8px;
    pointer-events: none;
    animation: shake 0.5s ease-in-out;
    z-index: 5;
}

/* Auth Modal Styles */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(30, 34, 90, 0.45);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-width: 100vw;
    /* Center content with flexbox */
}
.modal-content {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.25);
    padding: 40px 32px 32px 32px;
    min-width: 340px;
    max-width: 95vw;
    width: 100%;
    max-width: 400px;
    position: relative;
    animation: slideUp 0.4s;
    margin: 0 auto;
    /* Remove any margin-top or translateY that would offset from center */
}
.close {
    position: absolute;
    top: 18px;
    right: 22px;
    font-size: 1.7rem;
    color: #888;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10;
}
.close:hover {
    color: #e53e3e;
}
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 10px;
    animation: fadeIn 0.5s;
}
.auth-form h2 {
    text-align: center;
    margin-bottom: 10px;
    color: #4f46e5;
    font-size: 1.4rem;
    font-weight: 600;
}
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
    padding: 12px 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    background: #f8fafc;
    transition: border 0.2s, box-shadow 0.2s;
    outline: none;
    margin-bottom: 2px;
}
.auth-form input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px #a5b4fc55;
    background: #fff;
}
.auth-form button {
    padding: 12px 0;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(76, 81, 255, 0.08);
}
.auth-form button:hover {
    background: linear-gradient(90deg, #5a67d8 0%, #6b21a8 100%);
    box-shadow: 0 4px 16px rgba(76, 81, 255, 0.13);
}
.auth-error {
    color: #e53e3e;
    font-size: 0.98rem;
    text-align: center;
    min-height: 1.2em;
    margin-top: 2px;
}
#authTabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 18px;
}
.auth-tab-btn {
    background: none;
    border: none;
    color: #6366f1;
    font-size: 1.08rem;
    font-weight: 500;
    padding: 6px 18px;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.auth-tab-btn.active, .auth-tab-btn:hover {
    background: #eef2ff;
    color: #4f46e5;
}

/* Hide assessment tab when modal is open */
.hide-assessment #assessment-tab,
.hide-assessment .tab-nav,
.hide-assessment footer {
    display: none !important;
}

/* Modal dialog for assessment results */
#sra-results-modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(30,34,90,0.45);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}
#sra-results-modal > div {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(31,38,135,0.25);
    padding: 32px 24px 24px 24px;
    max-width: 900px;
    width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}
#sra-modal-report-preview {
    margin-bottom: 18px;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 12px;
    background: #fafbff;
    max-height: 60vh;
    overflow-y: auto;
}
#sra-results-modal button {
    min-width: 120px;
}

/* Admin User Table Styles */
.table-container {
    overflow-x: auto;
    margin-top: 18px;
    margin-bottom: 18px;
}
.admin-user-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 2px 8px rgba(30,34,90,0.07);
    border-radius: 10px;
    overflow: hidden;
    font-size: 1em;
}
.admin-user-table th, .admin-user-table td {
    padding: 12px 18px;
    text-align: left;
}
.admin-user-table th {
    background: #f3f4f6;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}
.admin-user-table tr:nth-child(even) {
    background: #f9fafb;
}
.admin-user-table tr:hover {
    background: #eef2ff;
}
.admin-user-table td {
    border-bottom: 1px solid #e5e7eb;
}
.admin-user-table td:last-child {
    text-align: right;
}
.admin-user-table button {
    background: #e53e3e;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 0.98em;
    cursor: pointer;
    transition: background 0.2s;
    margin-left: 6px;
}
.admin-user-table button:hover {
    background: #b91c1c;
}

/* Logo Bar Styles */
.app-logo-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding: 8px 0 8px 0;
}
.app-logo {
    height: 60px;
    width: 60px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(102,126,234,0.10);
    background: #fff;
    object-fit: contain;
    border: 2px solid #e3eafc;
}
.app-title-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}
.app-title-group h1 {
    font-size: 2rem;
    margin-bottom: 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: 0.5px;
}
.app-title-group .subtitle {
    font-size: 1.05rem;
    color: #555;
    margin: 0;
    font-weight: 500;
}
