/* Reset y Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #00a09d;
    --secondary-color: #714b67;
    --accent-color: #f26522;
    --dark-bg: #1a1a2e;
    --light-bg: #f5f7fa;
    --card-bg: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border-color: #e2e8f0;
    --success-color: #48bb78;
    --warning-color: #ecc94b;
    --sidebar-width: 280px;
    --header-height: 70px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--light-bg);
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--dark-bg) 0%, #16213e 100%);
    color: white;
    padding: 2rem 0;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.logo {
    padding: 0 2rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 2rem;
}

.logo h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-menu {
    list-style: none;
}

.nav-link {
    display: block;
    padding: 0.875rem 2rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    font-weight: 500;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
    border-left-color: var(--primary-color);
}

.nav-link.active {
    background-color: rgba(0, 160, 157, 0.15);
    color: white;
    border-left-color: var(--primary-color);
}

/* Main Content */
.content {
    margin-left: var(--sidebar-width);
    padding: 2rem 3rem;
    max-width: 1400px;
}

/* Header */
.page-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #008c89 100%);
    color: white;
    padding: 3rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 160, 157, 0.2);
}

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

.subtitle {
    font-size: 1.125rem;
    opacity: 0.95;
}

/* Sections */
.section {
    margin-bottom: 3rem;
    animation: fadeIn 0.6s ease-in;
}

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

.section h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--dark-bg);
    position: relative;
    padding-bottom: 0.5rem;
}

.section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

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

.card p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.card ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.card li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

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

.feature-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--dark-bg);
}

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

/* Stats List */
.stats-list {
    list-style: none;
    margin: 1rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, #e0f7f6 0%, #d4edec 100%);
    border-radius: 8px;
}

.stats-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0, 160, 157, 0.1);
}

.stats-list li:last-child {
    border-bottom: none;
}

/* Diagram Container */
.diagram-container {
    margin: 2rem 0;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid var(--border-color);
}

.diagram-container pre {
    margin: 0;
}

/* Module Grid */
.module-category {
    margin: 2rem 0;
}

.module-category h3 {
    color: var(--dark-bg);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.module-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
}

.module-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 6px 16px rgba(0, 160, 157, 0.15);
    transform: translateY(-3px);
}

.module-card h4 {
    color: var(--dark-bg);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.module-card p {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Component List */
.component-list {
    display: grid;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.component {
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
}

.component h4 {
    color: var(--dark-bg);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.component p {
    margin: 0;
}

/* Deployment Steps */
.deployment-steps {
    margin: 2rem 0;
}

.step {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.step-number {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), #008c89);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.step-content {
    flex: 1;
}

.step-content h4 {
    color: var(--dark-bg);
    margin-bottom: 0.75rem;
    font-size: 1.2rem;
}

.step-content ul {
    margin-left: 1.5rem;
}

.step-content pre {
    background: var(--dark-bg);
    color: #00ff00;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1rem 0;
}

.step-content code {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

/* Resources */
.resources {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.resource-card {
    padding: 1.5rem;
    background: linear-gradient(135deg, #e0f7f6 0%, #d4edec 100%);
    border-radius: 8px;
    border: 2px solid var(--primary-color);
}

.resource-card h4 {
    color: var(--dark-bg);
    margin-bottom: 0.5rem;
}

.resource-card p {
    margin-bottom: 0.5rem;
}

.resource-card strong {
    color: var(--primary-color);
}

.resource-card ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

/* Footer */
.page-footer {
    margin-top: 4rem;
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

.page-footer p {
    margin: 0.25rem 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .content {
        margin-left: 0;
        padding: 1.5rem;
    }
    
    .page-header h1 {
        font-size: 1.75rem;
    }
    
    .feature-grid,
    .module-grid {
        grid-template-columns: 1fr;
    }
    
    .step {
        flex-direction: column;
    }
}

/* Print Styles */
@media print {
    .sidebar {
        display: none;
    }
    
    .content {
        margin-left: 0;
    }
    
    .card {
        page-break-inside: avoid;
    }
}

/* Mermaid Diagram Styling */
.mermaid {
    background: transparent;
}

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

/* Selection */
::selection {
    background: var(--primary-color);
    color: white;
}

/* Links */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #008c89;
    text-decoration: underline;
}

/* Code Blocks */
code {
    background: var(--light-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--accent-color);
}

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

/* ========================================
   ACCESS MANAGEMENT STYLES
   ======================================== */

/* Login Box */
.login-box {
    max-width: 400px;
    margin: 0 auto;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.login-box h3 {
    margin-top: 0;
    color: var(--primary-color);
    text-align: center;
}

.login-box p {
    text-align: center;
    color: #666;
    margin-bottom: 2rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #008c89);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 160, 157, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-danger-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-danger-small:hover {
    background: #c82333;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: transform 0.2s ease;
}

.btn-icon:hover {
    transform: scale(1.1);
}

.btn-copy {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    transition: transform 0.2s ease;
}

.btn-copy:hover {
    transform: scale(1.2);
}

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

.form-actions button {
    flex: 1;
}

/* Error Message */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    border: 1px solid #f5c6cb;
}

/* Access Header */
.access-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.access-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.access-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Platforms Container */
.platforms-container {
    margin-top: 2rem;
}

.platform-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.platform-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(0, 160, 157, 0.1);
}

.platform-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.platform-header h4 {
    margin: 0;
    color: var(--secondary-color);
}

.platform-actions {
    display: flex;
    gap: 0.5rem;
}

.platform-info p {
    margin: 0.5rem 0;
    color: #555;
}

.platform-info strong {
    color: #333;
    min-width: 100px;
    display: inline-block;
}

.platform-info a {
    color: var(--primary-color);
    text-decoration: none;
}

.platform-info a:hover {
    text-decoration: underline;
}

.copyable {
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.password-field {
    filter: blur(4px);
    transition: filter 0.3s ease;
}

.password-field:hover {
    filter: blur(0);
}

.platform-meta {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.platform-meta small {
    color: #999;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #999;
}

.empty-state p:first-child {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.close-modal {
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

/* User Management */
.add-user-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #f0f0f0;
}

.add-user-section h4 {
    color: var(--secondary-color);
    margin-top: 0;
}

.users-list-section h4 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-username {
    color: #666;
    font-size: 0.9rem;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .access-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .access-actions {
        width: 100%;
    }

    .access-actions button {
        flex: 1;
    }

    .platform-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .modal-content {
        max-width: 100%;
        margin: 0;
    }
}

/* ========================================
   2FA / TOTP Styles
   ======================================== */

.form-help {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.status-indicator {
    padding: 1rem;
    background: var(--light-bg);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: center;
}

#2fa-status-text {
    font-weight: 600;
    font-size: 1.1rem;
}

.info-box {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
}

.info-box p {
    margin-bottom: 0.5rem;
    color: #1565c0;
    font-weight: 500;
}

.info-box ul {
    margin-left: 1.5rem;
    color: #424242;
}

.info-box li {
    margin: 0.25rem 0;
}

.warning-box {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
}

.warning-box p {
    color: #856404;
    margin-bottom: 0.5rem;
}

.qr-section {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.qr-section p {
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

#qrcode-container {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
    padding: 1rem;
    background: white;
    border-radius: 8px;
}

.secret-key {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.secret-key code {
    display: inline-block;
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    letter-spacing: 0.1em;
    margin: 0.5rem 0;
    word-break: break-all;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.verify-section {
    background: var(--light-bg);
    border-radius: 8px;
    padding: 1.5rem;
}

.verify-section p {
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.verify-section input {
    text-align: center;
    font-size: 1.5rem;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.3em;
    padding: 1rem;
}

#enable-2fa-section,
#disable-2fa-section {
    animation: fadeIn 0.3s ease-in;
}

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