/* Custom CSS for IPsec.guru */

:root {
    --primary-color: #dc3545;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --ipsec-accent: #e74c3c;
    --ipsec-secondary: #c0392b;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Sidebar Styling */
.sidebar {
    height: calc(100vh - 56px);
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.sidebar .accordion-button {
    font-weight: 500;
    color: #495057;
    background-color: #f8f9fa;
    border: none;
    padding: 0.75rem 1rem;
}

.sidebar .accordion-button:not(.collapsed) {
    background-color: var(--primary-color);
    color: white;
}

.sidebar .accordion-button:focus {
    box-shadow: none;
}

.sidebar .nav-pills .nav-link {
    color: #495057 !important;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sidebar .nav-pills .nav-link:hover {
    color: var(--primary-color) !important;
    background-color: #e9ecef !important;
    border-left-color: var(--primary-color);
}

.sidebar .nav-pills .nav-link.active {
    color: var(--primary-color) !important;
    background-color: #fdf2f2 !important;
    border-left-color: var(--primary-color);
    font-weight: 500;
}

/* Main Content Styling */
main {
    min-height: calc(100vh - 56px);
    padding-bottom: 2rem;
}

.content-section {
    margin-bottom: 3rem;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.content-section h1 {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.content-section h2 {
    color: var(--dark-color);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.content-section h3 {
    color: var(--secondary-color);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

/* Code blocks and syntax highlighting */
pre {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
}

code {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9rem;
}

pre code {
    background-color: transparent;
    padding: 0;
}

/* IPsec specific styling */
.crypto-block {
    background-color: #f8f9fa;
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 5px;
}

.crypto-block h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.sa-badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin: 0.2rem;
    background-color: var(--primary-color);
    color: white;
}

.tunnel-diagram {
    background-color: white;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 2rem;
    margin: 2rem 0;
    text-align: center;
    min-height: 300px;
}

.phase-indicator {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-weight: 600;
    text-align: center;
    margin: 0.5rem;
    color: white;
}

.phase-1 {
    background: linear-gradient(135deg, var(--primary-color), var(--ipsec-accent));
}

.phase-2 {
    background: linear-gradient(135deg, var(--ipsec-accent), var(--ipsec-secondary));
}

.cert-chain {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 2rem 0;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 10px;
}

.cert-item {
    padding: 1rem;
    border-radius: 50%;
    background-color: white;
    border: 3px solid var(--primary-color);
    color: var(--primary-color);
    font-weight: bold;
    min-width: 80px;
    text-align: center;
}

.cert-arrow {
    font-size: 1.5rem;
    color: var(--primary-color);
}

/* Configuration examples */
.config-block {
    background-color: #f8f9fa;
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    margin: 1rem 0;
}

.config-block h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.cisco-config {
    border-left-color: #1ba1e2;
}

.pfsense-config {
    border-left-color: #28a745;
}

.strongswan-config {
    border-left-color: #ff6b35;
}

/* Tables */
.table-responsive {
    margin: 1rem 0;
}

.table th {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

.table td {
    vertical-align: middle;
}

/* Alerts and callouts */
.alert {
    border-radius: 5px;
    margin: 1rem 0;
}

.alert-tip {
    background-color: #e3f2fd;
    border-color: var(--info-color);
    color: #0c5460;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: var(--warning-color);
    color: #664d03;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: var(--danger-color);
    color: #721c24;
}

.alert-security {
    background-color: #fdf2f2;
    border-color: var(--primary-color);
    color: #721c24;
}

/* Interactive elements */
.interactive-tool {
    background-color: #f8f9fa;
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    padding: 2rem;
    margin: 2rem 0;
}

.tool-input {
    margin-bottom: 1rem;
}

.tool-output {
    background-color: #000;
    color: #0f0;
    font-family: 'Courier New', monospace;
    padding: 1rem;
    border-radius: 5px;
    min-height: 200px;
    overflow-y: auto;
}

/* Network diagram container */
.network-diagram {
    background-color: white;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 2rem;
    margin: 2rem 0;
    text-align: center;
    min-height: 400px;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--ipsec-accent);
    border-color: var(--ipsec-accent);
}

/* Right sidebar for ads */
aside {
    min-height: calc(100vh - 56px);
    padding: 1rem;
}

.ad-container {
    position: sticky;
    top: 1rem;
}

.ad-placeholder {
    text-align: center;
    margin-bottom: 2rem;
}

.ad-space {
    border: 2px dashed #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 1.2rem;
    border-radius: 5px;
}

/* Progress bar */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: #f8f9fa;
    z-index: 1000;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
    width: 0%;
}

/* Responsive design */
@media (max-width: 768px) {
    .sidebar {
        height: auto;
        position: static;
    }
    
    .content-section {
        padding: 1rem;
    }
    
    .tunnel-diagram {
        min-height: 200px;
    }
    
    .cert-chain {
        flex-direction: column;
        gap: 1rem;
    }
    
    .cert-arrow {
        transform: rotate(90deg);
    }
}

/* Encryption algorithm visualization */
.encryption-comparison {
    display: flex;
    justify-content: space-around;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.algorithm-card {
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    padding: 1rem;
    margin: 0.5rem;
    text-align: center;
    min-width: 150px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.algorithm-card h5 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.algorithm-strength {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.strength-high {
    background-color: var(--success-color);
    color: white;
}

.strength-medium {
    background-color: var(--warning-color);
    color: #212529;
}

.strength-low {
    background-color: var(--danger-color);
    color: white;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Print styles */
@media print {
    .sidebar,
    aside,
    .navbar,
    .progress-container {
        display: none !important;
    }
    
    main {
        width: 100% !important;
        max-width: none !important;
    }
    
    .content-section {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}

/* Security level indicators */
.security-level {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin: 0.2rem;
}

.security-high {
    background-color: var(--success-color);
    color: white;
}

.security-medium {
    background-color: var(--warning-color);
    color: #212529;
}

.security-low {
    background-color: var(--danger-color);
    color: white;
}

.security-deprecated {
    background-color: var(--secondary-color);
    color: white;
    text-decoration: line-through;
}

/* VPN tunnel visualization */
.vpn-tunnel {
    position: relative;
    background: linear-gradient(90deg, #f8f9fa 0%, var(--primary-color) 20%, var(--primary-color) 80%, #f8f9fa 100%);
    height: 60px;
    border-radius: 30px;
    margin: 2rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.vpn-tunnel::before,
.vpn-tunnel::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    border-radius: 50%;
    border: 3px solid white;
}

.vpn-tunnel::before {
    left: 10px;
}

.vpn-tunnel::after {
    right: 10px;
}

/* Packet flow animation */
.packet-flow {
    position: relative;
    height: 100px;
    background-color: #f8f9fa;
    border-radius: 10px;
    margin: 2rem 0;
    overflow: hidden;
}

.packet {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: var(--primary-color);
    border-radius: 50%;
    top: 40px;
    animation: flow 3s linear infinite;
}

@keyframes flow {
    0% { left: -20px; }
    100% { left: 100%; }
}

/* Key exchange visualization */
.key-exchange {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 10px;
}

.peer {
    text-align: center;
    padding: 1rem;
    background-color: white;
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    min-width: 120px;
}

.key-arrow {
    font-size: 2rem;
    color: var(--primary-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}