/* Security Audit Framework Styles */

/* Variables - Purple Theme (Matching other frameworks) */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #06b6d4;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --critical: #dc2626;
    --border: #e2e8f0;
    --red-50: #fef2f2;
    --red-100: #fee2e2;
    --red-500: #ef4444;
    --red-600: #dc2626;
    --red-700: #b91c1c;
    --red-800: #991b1b;
    --red-900: #7f1d1d;
}

/* 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: var(--dark);
    background: var(--light);
    margin: 0;
    padding: 0;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 5rem 0 2rem 0; /* Extra top padding to account for fixed navbar */
    margin-top: 0; /* No margin needed with fixed navbar */
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.25);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
    animation: securityPattern 20s linear infinite;
}

@keyframes securityPattern {
    0% { transform: translateX(0) translateY(0); }
    100% { transform: translateX(60px) translateY(60px); }
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 1;
}

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

.header p {
    font-size: 1.2rem;
    opacity: 0.95;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Navigation Tabs */
.nav-tabs {
    background: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
    position: sticky;
    top: 59px; /* Account for site navigation - 1px less to avoid gap */
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.nav-tabs-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    min-height: 60px;
    align-items: center;
    scrollbar-width: thin;
    scrollbar-color: var(--red-300) transparent;
}

.nav-tabs-container::-webkit-scrollbar {
    height: 4px;
}

.nav-tabs-container::-webkit-scrollbar-track {
    background: transparent;
}

.nav-tabs-container::-webkit-scrollbar-thumb {
    background: var(--red-300);
    border-radius: 2px;
}

.nav-tab {
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--gray);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.nav-tab span {
    font-size: 1.1rem;
    display: inline-block;
    line-height: 1;
}

.nav-tab:hover {
    color: var(--primary);
    background: var(--red-50);
}

.nav-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--red-50);
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

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

.tab-content.active {
    display: block;
}

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

/* Sections */
.section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1);
    border: 1px solid var(--border);
}

.section h2 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

/* Removed automatic lock icon - icons should be added manually in HTML when needed */

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid;
    position: relative;
}

.alert-info {
    background: var(--red-50);
    color: var(--red-800);
    border-color: var(--red-200);
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}

.alert-danger {
    background: var(--border);
    color: var(--red-900);
    border-color: var(--red-300);
}

/* Maturity Assessment Container */
#maturity-assessment-container {
    margin-top: 1rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.assessment-dimension {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.dimension-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.dimension-header h3 {
    color: var(--primary);
    font-size: 1.2rem;
    margin: 0;
}

.framework-badge {
    background: var(--border);
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.dimension-questions {
    margin-top: 1rem;
}

.question-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--light);
    border-radius: 6px;
    gap: 1rem;
}

.question-item label {
    flex: 1;
    margin-bottom: 0;
    color: var(--dark);
    font-weight: 400;
    font-size: 0.95rem;
    line-height: 1.5;
}

.question-item select {
    width: 200px;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: white;
    font-size: 0.9rem;
}

.overall-maturity-score {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--red-50) 0%, white 100%);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.overall-maturity-score h3 {
    color: var(--primary);
    margin-bottom: 1rem;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

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

.form-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

/* Tables */
.assessment-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
    margin-bottom: 1.5rem;
}

.assessment-table th {
    background: var(--primary);
    color: white;
    padding: 1rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.assessment-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.assessment-table tr:hover {
    background: var(--red-50);
}

.assessment-table input,
.assessment-table select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.3s;
}

.assessment-table input:focus,
.assessment-table select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--gray);
    color: white;
    box-shadow: 0 2px 8px rgba(100, 116, 139, 0.3);
}

.btn-secondary:hover {
    background: #475569;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--critical);
    color: white;
    box-shadow: 0 4px 12px rgba(153, 27, 27, 0.3);
}

.btn-danger:hover {
    background: #7f1d1d;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
}

.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin: 2rem 0;
    padding: 2rem;
    background: var(--red-50);
    border-radius: 12px;
    border: 1px solid var(--red-200);
}

/* Remove Button */
.remove-btn {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s;
}

.remove-btn:hover {
    background: var(--critical);
    transform: scale(1.05);
}

/* Score Display */
.score-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.score-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1);
    border: 2px solid var(--border);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.score-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.score-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
}

.score-label {
    font-size: 0.9rem;
    color: var(--gray);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.score-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
    line-height: 1.2;
}

.score-value.critical {
    color: var(--critical);
    animation: pulse 2s ease-in-out infinite alternate;
}

@keyframes pulse {
    0% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* Security Level Indicators */
.security-level {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.security-level.critical {
    background: #fee2e2;
    color: var(--critical);
    border: 1px solid var(--red-300);
}

.security-level.high {
    background: #fed7d7;
    color: #c53030;
    border: 1px solid #fc8181;
}

.security-level.medium {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.security-level.low {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

/* Risk Score Styling */
.risk-score,
.vulnerability-score,
.compliance-score {
    font-weight: bold;
    padding: 0.5rem;
    border-radius: 6px;
    text-align: center;
    min-width: 60px;
}

.risk-score.high,
.vulnerability-score.high {
    background: var(--border);
    color: var(--red-800);
}

.risk-score.medium,
.vulnerability-score.medium {
    background: #fef3c7;
    color: #92400e;
}

.risk-score.low,
.vulnerability-score.low {
    background: #d1fae5;
    color: #065f46;
}

/* Progress Bars */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Range Inputs */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--red-200);
    outline: none;
    margin: 0.5rem 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
    transition: all 0.3s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.5);
}

.range-value {
    display: inline-block;
    min-width: 20px;
    text-align: center;
    font-weight: bold;
    color: var(--primary);
    margin-left: 0.5rem;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.25px;
}

.status-badge.compliant {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.non-compliant {
    background: var(--border);
    color: var(--red-800);
}

.status-badge.partial {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.pending {
    background: #e0e7ff;
    color: #3730a3;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .nav-tabs-container {
        padding: 0 1rem;
        gap: 0.5rem;
    }
    
    .nav-tab {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
    
    .container {
        padding: 1rem;
    }
    
    .section {
        padding: 1.5rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .assessment-table {
        font-size: 0.85rem;
    }
    
    .assessment-table th,
    .assessment-table td {
        padding: 0.5rem;
    }
    
    .button-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn {
        justify-content: center;
    }
    
    .score-display {
        grid-template-columns: 1fr;
    }
    
    .question-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .question-item label {
        margin-bottom: 0.5rem;
    }
    
    .question-item select {
        width: 100%;
    }
    
    .dimension-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .nav-tab span {
        display: none;
    }
    
    .assessment-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Print Styles */
@media print {
    .nav-tabs,
    .button-group,
    .remove-btn {
        display: none;
    }
    
    .tab-content {
        display: block !important;
    }
    
    .section {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .score-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
.nav-tab:focus,
.btn:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Missing styles for JavaScript-generated elements */
.maturity-questions {
    margin-top: 1rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}
#maturity-assessment-container .dimension-section {
    display: block !important;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#maturity-assessment-container .question-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

#maturity-assessment-container .question-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

#maturity-assessment-container .question-text {
    flex: 1;
    color: var(--dark);
    font-weight: 400;
    font-size: 0.95rem;
    margin-right: 1rem;
}

#maturity-assessment-container .question-input {
    min-width: 200px;
}

#maturity-assessment-container .question-input select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: white;
    font-size: 0.9rem;
    color: var(--dark);
}

#maturity-assessment-container .question-input select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

#maturity-assessment-container .dimension-score {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary);
    margin-left: 1rem;
    min-width: 60px;
    text-align: center;
}

#maturity-assessment-container .framework-badge {
    font-size: 0.8rem;
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    margin-left: 0.5rem;
    font-weight: normal;
}

#maturity-assessment-container .overall-maturity-score {
    margin-top: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 12px;
    text-align: center;
}

.score-display {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.score-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 8px;
    min-width: 120px;
}

#maturity-assessment-container .overall-maturity-score .score-card {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#maturity-assessment-container .overall-maturity-score .score-label {
    color: var(--gray);
    opacity: 1;
}

#maturity-assessment-container .overall-maturity-score .score-value {
    color: var(--primary);
}

#maturity-assessment-container .overall-maturity-score .score-value.critical {
    color: var(--danger);
}

.score-label {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.score-value {
    font-size: 1.5rem;
    font-weight: bold;
}

.score-value.critical {
    color: #ff6b6b;
}

/* Responsive styles for question rows */
@media (max-width: 768px) {
    #maturity-assessment-container .question-row {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
    }
    
    #maturity-assessment-container .question-text {
        margin-right: 0;
        margin-bottom: 0.5rem;
        font-weight: 500;
    }
    
    #maturity-assessment-container .question-input {
        min-width: auto;
        width: 100%;
    }
    
    .dimension-header {
        flex-direction: column;
        text-align: center;
    }
    
    #maturity-assessment-container .dimension-score {
        margin-left: 0;
        margin-top: 0.5rem;
    }
    
    .score-display {
        flex-direction: column;
        align-items: center;
    }
    
    .score-card {
        width: 100%;
        max-width: 200px;
    }
}