:root {
    --primary-color: #1e3a8a;
    --secondary-color: #3b82f6;
    --accent-color: #60a5fa;
    --danger-color: #dc2626;
    --success-color: #16a34a;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: fadeIn 0.5s ease-in;
}

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

.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.logos-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.logo {
    height: 60px;
    width: auto;
    object-fit: contain;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.logo-owasp {
    max-width: 200px;
}

.logo-kavacon {
    max-width: 250px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-align: center;
    margin: -0.5rem 0 2rem 0;
    font-style: italic;
}

.progress-bar {
    background: rgba(255, 255, 255, 0.2);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem auto;
    max-width: 600px;
}

.progress-fill {
    background: var(--success-color);
    height: 100%;
    width: 0%;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

.header-controls {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.btn-logout {
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-logout:hover {
    background: rgba(220, 38, 38, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn-logout:active {
    transform: translateY(0);
}

main {
    padding: 2rem;
    min-height: 500px;
}

.screen {
    display: none;
    animation: slideIn 0.3s ease-out;
}

.screen.active {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.welcome-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.welcome-card h2 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 1rem;
}

.intro-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.8;
}

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

.feature {
    padding: 1rem;
}

.feature-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.feature p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.dashboard-container {
    max-width: 1000px;
    margin: 0 auto;
}

.dashboard-container h2 {
    text-align: center;
    color: var(--primary-color);
    font-size: 2.25rem;
    margin-bottom: 1rem;
}

.dashboard-intro {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 3rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.quiz-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.quiz-selector-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    text-align: center;
}

.quiz-selector-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--secondary-color);
}

.quiz-selector-card:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

.quiz-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    display: block;
}

.quiz-selector-card h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.quiz-description {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.quiz-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.feature-tag {
    background: #eff6ff;
    color: var(--secondary-color);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-quiz-select {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-quiz-select:hover {
    background: var(--primary-color);
    transform: scale(1.02);
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    text-align: center;
    border-left: 4px solid var(--secondary-color);
}

.stat-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.badge.critical {
    background: var(--danger-color);
    color: white;
}

.risks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.risk-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
}

.risk-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--secondary-color);
}

.risk-card:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

.risk-card.completed::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--success-color);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.risk-number {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    text-align: center;
    line-height: 32px;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.risk-card h3 {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.risk-card .risk-title-en {
    color: var(--primary-color);
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.risk-card .risk-title-es {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-style: italic;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.risk-card .risk-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

.risk-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.detail-content {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
    max-width: 900px;
    margin: 0 auto;
}

.detail-header {
    border-bottom: 3px solid var(--secondary-color);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

.detail-header h2 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.badge.new {
    background: var(--warning-color);
    color: white;
}

.badge.updated {
    background: var(--secondary-color);
    color: white;
}

.detail-section {
    margin-bottom: 2rem;
}

.detail-section h3 {
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-section p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.8;
}

.detail-section ul {
    list-style: none;
    padding-left: 0;
}

.detail-section li {
    padding: 0.75rem 0;
    padding-left: 2rem;
    position: relative;
    color: var(--text-secondary);
    line-height: 1.6;
}

.detail-section li::before {
    content: '▸';
    position: absolute;
    left: 0.5rem;
    color: var(--secondary-color);
    font-weight: bold;
}

.example-box {
    background: #fef3c7;
    border-left: 4px solid var(--warning-color);
    padding: 1rem 1.5rem;
    border-radius: 6px;
    margin: 1rem 0;
    font-style: italic;
}

.btn-primary, .btn-secondary, .btn-success {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0.5rem;
}

.btn-primary {
    background: var(--secondary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--text-secondary);
    color: white;
}

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

.btn-success:hover {
    background: #15803d;
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: center;
}

.quiz-content {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
    max-width: 800px;
    margin: 0 auto;
}

.quiz-content h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
}

.quiz-question {
    background: #eff6ff;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid var(--secondary-color);
}

.quiz-question p {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.quiz-option {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.quiz-option:hover {
    border-color: var(--secondary-color);
    background: #f0f9ff;
}

.quiz-option.selected {
    border-color: var(--secondary-color);
    background: #dbeafe;
}

.quiz-option.correct {
    border-color: var(--success-color);
    background: #dcfce7;
}

.quiz-option.incorrect {
    border-color: var(--danger-color);
    background: #fee2e2;
}

.quiz-feedback {
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    animation: slideIn 0.3s ease-out;
}

.quiz-feedback.correct {
    background: #dcfce7;
    border-left: 4px solid var(--success-color);
}

.quiz-feedback.incorrect {
    background: #fee2e2;
    border-left: 4px solid var(--danger-color);
}

.quiz-feedback h3 {
    margin-bottom: 0.5rem;
}

.quiz-feedback.correct h3 {
    color: var(--success-color);
}

.quiz-feedback.incorrect h3 {
    color: var(--danger-color);
}

/* Completion Screen Styles */
.completion-card {
    background: white;
    border-radius: 12px;
    padding: 3rem 2rem;
    max-width: 700px;
    margin: 2rem auto;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.completion-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: bounce 1s ease-in-out;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.completion-card h2 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.completion-card h3 {
    color: var(--secondary-color);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.completion-message {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 2rem;
}

.completion-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin: 2rem 0;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
}

.completion-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
}

.completion-stat .stat-number {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.completion-stat .stat-label {
    font-size: 1rem;
    opacity: 0.9;
}

.completion-info {
    text-align: left;
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f0fdf4;
    border-radius: 8px;
    border-left: 4px solid var(--success-color);
}

.completion-info p {
    margin: 0.75rem 0;
    color: var(--text-color);
    font-size: 1rem;
}

.completion-note {
    margin-top: 2rem;
    padding: 1rem;
    background: #fef3c7;
    border-radius: 8px;
    border-left: 4px solid #f59e0b;
}

.completion-note p {
    margin: 0;
    color: #92400e;
}

.footer {
    background: var(--primary-color);
    color: white;
    padding: 1.5rem;
    text-align: center;
}

.footer a {
    color: var(--accent-color);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.footer-note {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

.footer-credits {
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--accent-color);
}

@media (max-width: 768px) {
    body {
        padding: 0.5rem;
    }

    .logos-container {
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .logo {
        height: 45px;
    }

    .logo-owasp {
        max-width: 150px;
    }

    .logo-kavacon {
        max-width: 180px;
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .dashboard-container h2 {
        font-size: 1.75rem;
    }

    .dashboard-intro {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .quiz-selector-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .quiz-selector-card {
        padding: 1.5rem;
    }

    .quiz-icon {
        font-size: 3rem;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    main {
        padding: 1rem;
    }

    .welcome-card {
        padding: 1.5rem;
    }

    .welcome-card h2 {
        font-size: 1.5rem;
    }

    .intro-text {
        font-size: 1rem;
    }

    .features {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .risks-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .detail-content, .quiz-content {
        padding: 1.5rem;
    }

    .detail-header h2 {
        font-size: 1.5rem;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn-primary, .btn-secondary, .btn-success {
        width: 100%;
    }
}

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

/* Modal de Registro */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s ease-in;
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px 12px 0 0;
    text-align: center;
}

.modal-header h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
}

.modal-subtitle {
    margin: 0;
    opacity: 0.9;
    font-size: 1rem;
}

.registration-form {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

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

.form-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input.error {
    border-color: var(--danger-color);
}

.form-error {
    display: block;
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    min-height: 1.25rem;
}

.form-privacy {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--secondary-color);
}

.form-privacy p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.form-actions .btn-primary,
.form-actions .btn-secondary {
    flex: 1;
}

.form-loading {
    text-align: center;
    padding: 2rem;
}

.form-loading p {
    margin-top: 1rem;
    color: var(--text-secondary);
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive para modal */
@media (max-width: 768px) {
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .modal-header {
        padding: 1.5rem;
    }
    
    .modal-header h2 {
        font-size: 1.5rem;
    }
    
    .registration-form {
        padding: 1.5rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn-primary,
    .form-actions .btn-secondary {
        width: 100%;
    }
}
