/*
 * FROSH Security CSS
 * Security-focused styles for multi-tenant platform
 * Version: 1.0
 * 
 * This file provides security-hardened styles and visual indicators
 * for the FROSH multi-tenant platform.
 */

/* ===== SECURITY INDICATORS ===== */

/* Secure connection indicator */
.secure-connection {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: linear-gradient(135deg, var(--report-success), #059669);
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    animation: pulse-secure 3s infinite;
}

@keyframes pulse-secure {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.9; 
        transform: scale(1.02);
    }
}

.secure-connection::before {
    content: '🔒';
    font-size: 0.875rem;
}

/* Session timeout warning */
.session-warning {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: linear-gradient(135deg, var(--report-warning), #b8941f);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    text-align: center;
    min-width: 300px;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translate(-50%, -50%) translateX(0); }
    25% { transform: translate(-50%, -50%) translateX(-5px); }
    75% { transform: translate(-50%, -50%) translateX(5px); }
}

/* ===== FORM SECURITY ===== */

/* Password strength indicator */
.password-strength {
    margin-top: 0.5rem;
    height: 4px;
    background: var(--frosh-gray-200);
    border-radius: 2px;
    overflow: hidden;
    transition: all var(--transition-base);
}

.password-strength-bar {
    height: 100%;
    width: 0%;
    transition: all var(--transition-base);
    border-radius: 2px;
}

.password-strength-weak .password-strength-bar {
    width: 25%;
    background: var(--report-danger);
}

.password-strength-fair .password-strength-bar {
    width: 50%;
    background: var(--report-warning);
}

.password-strength-good .password-strength-bar {
    width: 75%;
    background: var(--report-info);
}

.password-strength-strong .password-strength-bar {
    width: 100%;
    background: var(--report-success);
}

/* Input validation states */
.form-control.is-valid {
    border-color: var(--report-success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-control.is-invalid {
    border-color: var(--report-danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-control.is-valid:focus,
.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Security badges for forms */
.security-badge-form {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--frosh-gray-100);
    color: var(--frosh-gray-700);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.security-badge-form.secure {
    background: rgba(16, 185, 129, 0.1);
    color: var(--report-success);
}

.security-badge-form.warning {
    background: rgba(211, 175, 55, 0.1);
    color: var(--report-warning);
}

/* ===== ANTI-TAMPERING ===== */

/* Prevent text selection on sensitive elements */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Prevent right-click context menu on sensitive areas */
.no-context {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Hide sensitive information from screenshots */
.sensitive-data {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    filter: blur(0px);
    transition: filter var(--transition-base);
}

.sensitive-data:hover {
    filter: blur(0px);
}

/* Blur sensitive data when window loses focus */
.window-blur .sensitive-data {
    filter: blur(4px);
}

/* ===== AUDIT TRAIL INDICATORS ===== */

/* Activity indicator */
.activity-indicator {
    position: relative;
}

.activity-indicator::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--report-success);
    border: 2px solid white;
    border-radius: 50%;
    animation: pulse-activity 2s infinite;
}

@keyframes pulse-activity {
    0% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% { 
        transform: scale(1);
        opacity: 1;
    }
}

/* Last activity timestamp */
.last-activity {
    font-size: 0.75rem;
    color: var(--content-text-muted);
    font-style: italic;
}

/* ===== PERMISSION INDICATORS ===== */

/* Role-based styling */
.role-admin {
    border-left: 4px solid var(--report-danger);
}

.role-manager {
    border-left: 4px solid var(--report-warning);
}

.role-user {
    border-left: 4px solid var(--report-info);
}

.role-guest {
    border-left: 4px solid var(--frosh-gray-400);
}

/* Permission denied overlay */
.permission-denied {
    position: relative;
    opacity: 0.5;
    pointer-events: none;
}

.permission-denied::before {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem;
    border-radius: 50%;
    box-shadow: var(--shadow-md);
}

/* ===== TENANT ISOLATION INDICATORS ===== */

/* Tenant boundary indicator */
.tenant-boundary {
    border-top: 3px solid var(--frosh-black);
    position: relative;
}

.tenant-boundary::before {
    content: attr(data-tenant);
    position: absolute;
    top: -1px;
    right: 1rem;
    background: var(--frosh-black);
    color: white;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0 0 8px 8px;
}

/* Data classification labels */
.data-public {
    border-left: 4px solid var(--report-success);
}

.data-internal {
    border-left: 4px solid var(--report-warning);
}

.data-confidential {
    border-left: 4px solid var(--report-danger);
}

.data-restricted {
    border-left: 4px solid var(--frosh-black);
}

/* ===== SECURITY ALERTS ===== */

/* Security alert banner */
.security-alert {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    background: linear-gradient(135deg, var(--report-danger), #dc2626);
    color: white;
    padding: 0.75rem 1rem;
    text-align: center;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    animation: slide-down 0.3s ease-out;
}

@keyframes slide-down {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

.security-alert .close-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background var(--transition-base);
}

.security-alert .close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== COMPLIANCE INDICATORS ===== */

/* GDPR compliance indicator */
.gdpr-compliant {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(16, 185, 129, 0.1);
    color: var(--report-success);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.gdpr-compliant::before {
    content: '✓';
    font-weight: bold;
}

/* Data retention indicator */
.data-retention {
    font-size: 0.75rem;
    color: var(--content-text-muted);
    font-style: italic;
}

.data-retention.expiring {
    color: var(--report-warning);
    font-weight: 600;
}

.data-retention.expired {
    color: var(--report-danger);
    font-weight: 600;
}

/* ===== MOBILE SECURITY ===== */

@media (max-width: 768px) {
    .secure-connection {
        top: 5px;
        right: 5px;
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .session-warning {
        width: 90%;
        padding: 1rem;
    }
    
    .security-alert {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
}

/* ===== DARK MODE SECURITY ===== */

@media (prefers-color-scheme: dark) {
    .secure-connection {
        background: linear-gradient(135deg, #059669, #047857);
    }
    
    .session-warning {
        background: linear-gradient(135deg, #d97706, #b45309);
    }
    
    .security-alert {
        background: linear-gradient(135deg, #dc2626, #b91c1c);
    }
}

/* ===== PRINT SECURITY ===== */

@media print {
    .sensitive-data {
        filter: blur(4px) !important;
    }
    
    .secure-connection,
    .session-warning,
    .security-alert,
    .activity-indicator::after {
        display: none !important;
    }
    
    .permission-denied::before {
        content: '[RESTRICTED]';
        font-size: 1rem;
        background: #000;
        color: #fff;
        padding: 0.5rem;
        border-radius: 4px;
    }
}

/* ===== ACCESSIBILITY SECURITY ===== */

/* Screen reader only content for security context */
.sr-only-security {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode security indicators */
@media (prefers-contrast: high) {
    .secure-connection,
    .session-warning,
    .security-alert {
        border: 2px solid currentColor;
    }
    
    .permission-denied::before {
        border: 2px solid #000;
    }
}