/* HSM Attestation Wallet Demo Styles */

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #06b6d4;
    
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-accent: #f1f5f9;
    --bg-dark: #1e293b;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    --border-radius: 8px;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

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(--bg-primary);
    height: 100vh;
    overflow: hidden;
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
.navigation {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 0;
}

.nav-buttons {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    gap: 1rem;
    overflow-x: auto;
}

.nav-button {
    padding: 0.75rem 1.5rem;
    border: none;
    background: var(--bg-accent);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    transition: all 0.15s ease-in-out;
}

.nav-button:hover {
    background: var(--primary-color);
    color: white;
}

.nav-button.active {
    background: var(--primary-color);
    color: white;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo i {
    font-size: 2rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.status-indicators {
    display: flex;
    gap: 1.5rem;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.system-status .status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444; /* Red for offline */
    transition: background-color 0.3s ease;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.3);
}

.system-status.online .status-indicator {
    background: #10b981; /* Green for online */
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

.system-status.partial .status-indicator {
    background: #f59e0b; /* Orange for partial */
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3);
}

.system-status .status-text {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    overflow-y: auto;
    height: calc(100vh - 350px); /* Adjust based on header + navigation + logs height */
}

/* Demo Sections */
.demo-section {
    margin-bottom: 3rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.section-header {
    background: var(--bg-accent);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.section-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--warning-color);
    color: white;
}

.section-status.ready {
    background: var(--success-color);
}

.section-status.active {
    background: var(--primary-color);
}

/* Demo Panel */
.demo-panel {
    padding: 2rem;
}

.panel-content h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.result-area {
    background: var(--bg-accent);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
    min-height: 100px;
}

.demo-form {
    background: var(--bg-accent);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
}

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

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

/* Info Grids */
.info-grid, .config-grid, .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.info-item, .config-item, .form-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-item.full-width {
    grid-column: 1 / -1;
}

.info-item label, .config-item label, .form-item label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.info-item span {
    font-weight: 500;
}

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--success-color);
    color: white;
    display: inline-block;
    width: fit-content;
}

/* Form Controls */
input, select, textarea {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--secondary-color) !important;
    color: #cbd5e1 !important;
    border: 1px solid #94a3b8;
}

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

.btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
}

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

.btn-secondary:hover:not(:disabled) {
    background: #475569;
}

.btn-tertiary {
    background: #6366f1;
    color: white;
}

.btn-tertiary:hover:not(:disabled) {
    background: #4f46e5;
}

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

.btn-success:hover:not(:disabled) {
    background: #059669;
}

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

.btn-warning:hover:not(:disabled) {
    background: #d97706;
}

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

.btn-info:hover:not(:disabled) {
    background: #0891b2;
}

.btn-copy {
    background: var(--bg-accent);
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 4px;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

/* Biometric Setup */
.biometric-setup {
    margin-bottom: 1.5rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-accent);
    border-radius: var(--border-radius);
}

.profile-avatar i {
    font-size: 2.5rem;
    color: var(--primary-color);
}

.profile-info h4 {
    margin: 0;
    color: var(--text-primary);
}

.profile-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.biometric-types {
    display: flex;
    gap: 1rem;
}

.bio-type {
    flex: 1;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    text-align: center;
    transition: border-color 0.15s ease-in-out;
}

.bio-type i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.bio-type span {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.bio-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.bio-type.enrolled {
    border-color: var(--success-color);
    background: rgb(16 185 129 / 0.05);
}

.bio-type.enrolled .bio-status {
    color: var(--success-color);
    font-weight: 500;
}

/* Token Display */
.token-display {
    margin-top: 1.5rem;
}

.token-container {
    position: relative;
    margin-top: 0.5rem;
}

.token-container textarea {
    width: 100%;
    height: 120px;
    resize: vertical;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.75rem;
    padding-right: 3rem;
}

/* Result Tabs */
.result-tabs {
    display: flex;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease-in-out;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-content pre {
    background: var(--bg-accent);
    padding: 1rem;
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    overflow-x: auto;
    white-space: pre-wrap;
}

/* Signature Details */
.signature-details {
    background: var(--bg-accent);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-top: 0.5rem;
}

/* Fixed Activity Logs Panel */
.logs-panel {
    background: var(--bg-dark);
    color: white;
    border-top: 1px solid var(--border-color);
    height: 250px;
    display: flex;
    flex-direction: column;
}

.logs-header {
    padding: 1rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: between;
    align-items: center;
    min-height: 60px;
}

.logs-header h3 {
    color: white;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.logs-controls {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.logs-container {
    flex: 1;
    padding: 1rem 2rem;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.75rem;
    line-height: 1.4;
    background: rgba(0, 0, 0, 0.2);
}

.log-entry {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0;
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.log-time {
    color: #94a3b8;
    min-width: 80px;
    font-weight: 500;
}

.log-message {
    color: #e2e8f0;
    flex: 1;
}

.log-entry.success .log-message {
    color: #10b981;
}

.log-entry.error .log-message {
    color: #ef4444;
}

.log-entry.warning .log-message {
    color: #f59e0b;
}

.log-entry.info .log-message {
    color: #06b6d4;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    max-width: 800px;
    width: 90%;
    max-height: 80%;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
}

.jwt-parts {
    display: grid;
    gap: 1.5rem;
}

.jwt-part h4 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.jwt-part pre {
    background: var(--bg-accent);
    padding: 1rem;
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    overflow-x: auto;
    white-space: pre-wrap;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .status-indicators {
        flex-direction: column;
        gap: 0.5rem;
    }

    .main-content {
        padding: 1rem;
        height: calc(100vh - 400px);
    }

    .logs-panel {
        height: 200px;
    }

    .nav-buttons {
        padding: 0 1rem;
    }

    .nav-button {
        min-width: 120px;
    }

    .action-buttons,
    .button-group {
        justify-content: center;
    }

    .biometric-types {
        flex-direction: column;
    }

    .info-grid,
    .config-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .result-tabs {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .tab-btn {
        flex: 1;
        min-width: 120px;
    }

    .logs-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        min-height: auto;
        padding: 0.75rem 1rem;
    }

    .logs-controls {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s infinite;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-success {
    color: var(--success-color);
}

.text-error {
    color: var(--error-color);
}

.text-warning {
    color: var(--warning-color);
}

.hidden {
    display: none;
}

.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

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

/* HSM Display Styles */
.status-info {
    margin-bottom: 1.5rem;
}

.status-info h4,
.keys-info h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.keys-info {
    margin-top: 1.5rem;
}

.keys-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.key-item {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.key-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

.key-header {
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.key-header strong {
    color: var(--primary-color);
}

.key-details {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row .label {
    font-weight: 600;
    color: var(--text-muted);
    min-width: 100px;
}

.detail-row .value {
    color: var(--text-dark);
    text-align: right;
    flex: 1;
}

.monospace {
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.text-success {
    color: #28a745;
    font-weight: 600;
}

.text-warning {
    color: #ffc107;
    font-weight: 600;
}

.text-error {
    color: #dc3545;
    font-weight: 600;
}

/* OAuth Info */
.oauth-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.oauth-info p {
    margin: 0.5rem 0;
    color: var(--text-muted);
}

.oauth-info strong {
    color: var(--primary-color);
}