/* General Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0077cc;
    --primary-dark: #005fa3;
    --secondary-color: #00a86b;
    --accent-color: #ff6b6b;
    --bg-light: #f4f4f9;
    --bg-white: #ffffff;
    --text-primary: #333;
    --text-secondary: #666;
    --border-color: #e0e0e0;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.7;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* Navigation Bar */
nav {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 15px 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-icon {
    font-size: 1.8rem;
}

nav h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 25px;
}

nav ul li a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    padding: 5px 0;
    border-bottom: 2px solid transparent;
}

nav ul li a:hover {
    border-bottom-color: white;
    opacity: 0.9;
}

/* Theme Toggle */
.theme-toggle {
    background-color: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 8px 14px;
    border-radius: 50px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.moon-icon {
    display: none;
}

body.dark-mode .sun-icon {
    display: none;
}

body.dark-mode .moon-icon {
    display: inline;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: white;
    padding: 60px 20px;
    text-align: center;
    box-shadow: var(--shadow-md);
}

header h2 {
    margin: 0 0 15px;
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -1px;
}

header p {
    margin: 0;
    font-size: 1.3rem;
    opacity: 0.95;
    font-weight: 400;
}

.header-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: #ffcc00;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 500;
}

/* Sections */
section {
    margin-top: 60px;
}

h2 {
    color: var(--primary-color);
    font-size: 2.2rem;
    margin-bottom: 20px;
    font-weight: 700;
}

h3 {
    color: var(--primary-dark);
    font-size: 1.6rem;
    margin: 30px 0 15px;
    font-weight: 600;
}

/* Content Cards */
.content-card {
    background-color: var(--bg-white);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 25px;
    transition: var(--transition);
}

.content-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

/* Application Grid */
.application-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.app-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-radius: var(--border-radius);
    text-align: center;
    transition: var(--transition);
    border: 2px solid transparent;
}

.app-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.app-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 15px;
}

.app-card h4 {
    margin: 0 0 8px;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.app-card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* PKI Hierarchy */
.pki-hierarchy {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    gap: 15px;
    flex-wrap: wrap;
}

.pki-level {
    background-color: var(--bg-white);
    padding: 30px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    flex: 1;
    min-width: 200px;
    text-align: center;
    transition: var(--transition);
    border: 3px solid transparent;
}

.pki-level:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: var(--shadow-lg);
}

.pki-level.root {
    border-color: #ff6b6b;
}

.pki-level.intermediate {
    border-color: #4ecdc4;
}

.pki-level.leaf {
    border-color: #95e1d3;
}

.pki-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 15px;
}

.pki-level h4 {
    margin: 0 0 8px;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.pki-level p {
    margin: 0 0 15px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.level-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.badge {
    background-color: var(--primary-color);
    color: white;
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.hierarchy-arrow {
    font-size: 2.5rem;
    color: var(--primary-color);
    font-weight: bold;
}

/* Workflow Card */
.workflow-steps {
    list-style: none;
    padding: 0;
    margin: 25px 0 0;
}

.workflow-steps li {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    align-items: flex-start;
}

.step-number {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.step-content strong {
    display: block;
    color: var(--primary-color);
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.step-content p {
    margin: 0;
    color: var(--text-secondary);
}

/* Certificates */
.certificate {
    background-color: var(--bg-white);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 25px;
    transition: var(--transition);
    border-left: 5px solid var(--primary-color);
}

.certificate:hover {
    box-shadow: var(--shadow-lg);
    transform: translateX(5px);
}

.root-cert {
    border-left-color: #ff6b6b;
}

.intermediate-cert {
    border-left-color: #4ecdc4;
}

.leaf-cert {
    border-left-color: #95e1d3;
}

.cert-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.cert-icon {
    font-size: 2.5rem;
}

.cert-header h3 {
    margin: 0;
    flex: 1;
    font-size: 1.5rem;
}

.cert-badge {
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
}

.cert-badge.root {
    background-color: #ff6b6b;
}

.cert-badge.intermediate {
    background-color: #4ecdc4;
}

.cert-badge.leaf {
    background-color: #95e1d3;
}

pre {
    background-color: #f8f9fa;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.cert-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: #e9ecef;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: #dee2e6;
    transform: translateY(-2px);
}

.btn-large {
    padding: 15px 35px;
    font-size: 1.1rem;
}

/* Generator Card */
.generator-card {
    text-align: center;
}

.generator-card button {
    margin-top: 20px;
}

#cert-output {
    margin-top: 30px;
    text-align: left;
}

#cert-output h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

/* Quiz */
.quiz-container {
    background-color: var(--bg-white);
    padding: 35px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

.quiz-intro {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.quiz-question {
    background-color: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 25px;
    border-left: 4px solid var(--primary-color);
}

.quiz-question p {
    margin: 0 0 15px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.quiz-question ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.quiz-question ul li {
    margin-bottom: 12px;
}

.quiz-question label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px;
    border-radius: 6px;
    transition: var(--transition);
}

.quiz-question label:hover {
    background-color: white;
}

.quiz-question input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

#submit-quiz {
    display: block;
    margin: 30px auto 0;
}

#quiz-result {
    margin-top: 30px;
    padding: 30px;
    border-radius: var(--border-radius);
    text-align: center;
}

.result-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.result-icon {
    font-size: 4rem;
}

#result-title {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.8rem;
}

#result-message {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* FAQ */
.faq-item {
    background-color: var(--bg-white);
    padding: 0;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 15px;
    overflow: hidden;
    transition: var(--transition);
}

.faq-item:hover {
    box-shadow: var(--shadow-md);
}

.faq-header {
    padding: 25px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    transition: var(--transition);
}

.faq-header:hover {
    background-color: #f8f9fa;
}

.faq-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.faq-toggle {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
    transition: var(--transition);
    flex-shrink: 0;
}

.faq-item.active .faq-toggle {
    transform: rotate(45deg);
}

.faq-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.active .faq-content {
    max-height: 500px;
}

.faq-content p {
    padding: 0 25px 25px;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* Footer */
footer {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 40px 20px;
    text-align: center;
    margin-top: 80px;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
}

footer p {
    margin: 10px 0;
    font-size: 1rem;
}

.footer-links {
    margin: 20px 0;
}

.footer-links a {
    color: white;
    text-decoration: none;
    transition: var(--transition);
    opacity: 0.9;
    font-weight: 500;
}

.footer-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

.footer-copyright {
    opacity: 0.8;
    font-size: 0.9rem;
}

/* Utility Classes */
.hidden {
    display: none;
}

/* Dark Mode */
body.dark-mode {
    --bg-light: #1a1a1a;
    --bg-white: #2d2d2d;
    --text-primary: #f4f4f9;
    --text-secondary: #bbb;
    --border-color: #444;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.7);
}

body.dark-mode pre {
    background-color: #1a1a1a;
    border-color: #444;
}

body.dark-mode .app-card,
body.dark-mode .quiz-question {
    background: linear-gradient(135deg, #3d3d3d 0%, #2d2d2d 100%);
}

/* Responsive Design */
@media (max-width: 768px) {
    header h2 {
        font-size: 2.2rem;
    }

    header p {
        font-size: 1.1rem;
    }

    .header-stats {
        gap: 25px;
    }

    nav .container {
        flex-direction: column;
        gap: 15px;
    }

    nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    .pki-hierarchy {
        flex-direction: column;
    }

    .hierarchy-arrow {
        transform: rotate(90deg);
        margin: 10px 0;
    }

    .application-grid {
        grid-template-columns: 1fr;
    }

    h2 {
        font-size: 1.8rem;
    }

    .content-card {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    header h2 {
        font-size: 1.8rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    .quiz-container,
    .content-card {
        padding: 20px;
    }

    .cert-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}
