/*
================================================================================
File: gaiax.css
Location: ubec_platform/static/css/gaiax.css
================================================================================

UBEC Platform - Gaia-X Module Stylesheet

Styles specific to Gaia-X compliance functionality:
  - Participant registration forms
  - Service offering cards
  - Compliance dashboard
  - Policy evaluation interface
  - Credential displays
  - DID badges

Color Scheme:
  - Gaia-X Blue: #003399 (official)
  - Trust Green: #28a745
  - Warning Orange: #fd7e14
  - Error Red: #dc3545

Copyright (C) 2024-2025 UBEC DAO
License: GNU Affero General Public License v3.0 (AGPL-3.0)

This project uses the services of Claude and Anthropic PBC to inform our
decisions and recommendations.
================================================================================
*/

/* =============================================================================
   CSS Variables - Gaia-X Theme
   ============================================================================= */

:root {
    /* Gaia-X Brand Colors */
    --gx-blue: #003399;
    --gx-blue-light: #0044cc;
    --gx-blue-dark: #002266;
    --gx-blue-bg: #e6ecf5;
    
    /* Compliance Levels */
    --gx-l1: #6c757d;
    --gx-l2: #17a2b8;
    --gx-l3: #28a745;
    
    /* Status Colors */
    --gx-verified: #28a745;
    --gx-pending: #fd7e14;
    --gx-failed: #dc3545;
    --gx-inactive: #6c757d;
    
    /* Component Colors */
    --gx-card-bg: #ffffff;
    --gx-card-border: #dee2e6;
    --gx-card-shadow: 0 2px 8px rgba(0, 51, 153, 0.1);
    
    /* Typography */
    --gx-font-mono: 'Fira Code', 'Monaco', 'Consolas', monospace;
}

/* =============================================================================
   Header & Navigation
   ============================================================================= */

.gaiax-header {
    background: linear-gradient(135deg, var(--gx-blue) 0%, var(--gx-blue-dark) 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 51, 153, 0.3);
}

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

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

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: white;
}

.logo-img {
    height: 32px;
    width: auto;
}

.logo-text {
    font-weight: 700;
    font-size: 1.25rem;
}

.module-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.header-nav {
    display: flex;
    gap: 0.5rem;
}

.nav-link {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    font-weight: 600;
}

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

/* Language Switcher */
.lang-switcher {
    display: flex;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem;
    border-radius: 6px;
}

.lang-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
}

.lang-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

.lang-btn.active {
    background: white;
    color: var(--gx-blue);
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.user-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.user-avatar {
    font-size: 1.1rem;
}

.dropdown-arrow {
    font-size: 0.7rem;
    opacity: 0.8;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.user-name {
    font-weight: 600;
    color: #333;
}

.user-email {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.25rem;
}

.dropdown-divider {
    height: 1px;
    background: #eee;
    margin: 0.5rem 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: #f5f5f5;
}

.dropdown-item.danger {
    color: var(--gx-failed);
}

.dropdown-item.danger:hover {
    background: #fff5f5;
}

/* Login Button */
.login-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    color: var(--gx-blue);
    padding: 0.4rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.login-btn:hover {
    background: #f0f4ff;
    transform: translateY(-1px);
}

/* =============================================================================
   Main Content Area
   ============================================================================= */

.gaiax-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: calc(100vh - 200px);
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    color: var(--gx-blue);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: #666;
    font-size: 1.1rem;
}

.breadcrumb {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.breadcrumb a {
    color: var(--gx-blue);
    text-decoration: none;
}

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

/* =============================================================================
   Cards
   ============================================================================= */

.gx-card {
    background: var(--gx-card-bg);
    border: 1px solid var(--gx-card-border);
    border-radius: 12px;
    box-shadow: var(--gx-card-shadow);
    overflow: hidden;
}

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

.gx-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gx-blue);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gx-card-body {
    padding: 1.5rem;
}

.gx-card-footer {
    background: #f8f9fa;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gx-card-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* =============================================================================
   Forms
   ============================================================================= */

.gx-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.form-group .hint {
    font-size: 0.85rem;
    color: #666;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.form-input,
.form-select,
.form-textarea {
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--gx-blue);
    box-shadow: 0 0 0 3px rgba(0, 51, 153, 0.1);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: var(--gx-failed);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.form-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    accent-color: var(--gx-blue);
}

.form-error {
    color: var(--gx-failed);
    font-size: 0.85rem;
}

/* =============================================================================
   Buttons
   ============================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

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

.btn-primary:hover {
    background: var(--gx-blue-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 51, 153, 0.3);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e5e5e5;
}

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

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: var(--gx-failed);
    color: white;
}

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

.btn-outline {
    background: transparent;
    border: 2px solid var(--gx-blue);
    color: var(--gx-blue);
}

.btn-outline:hover {
    background: var(--gx-blue);
    color: white;
}

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

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* =============================================================================
   Status Badges
   ============================================================================= */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-verified {
    background: #d4edda;
    color: var(--gx-verified);
}

.badge-pending {
    background: #fff3cd;
    color: #856404;
}

.badge-failed {
    background: #f8d7da;
    color: var(--gx-failed);
}

.badge-inactive {
    background: #e9ecef;
    color: var(--gx-inactive);
}

.badge-l1 {
    background: #e9ecef;
    color: var(--gx-l1);
}

.badge-l2 {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-l3 {
    background: #d4edda;
    color: #155724;
}

/* =============================================================================
   DID Display
   ============================================================================= */

.did-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8f9fa;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-family: var(--gx-font-mono);
    font-size: 0.85rem;
}

.did-method {
    background: var(--gx-blue);
    color: white;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.did-value {
    color: #333;
    word-break: break-all;
}

.did-copy {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: #666;
    transition: color 0.2s;
}

.did-copy:hover {
    color: var(--gx-blue);
}

/* =============================================================================
   Compliance Dashboard
   ============================================================================= */

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

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--gx-card-shadow);
    border-left: 4px solid var(--gx-blue);
}

.stat-card.success {
    border-left-color: var(--gx-verified);
}

.stat-card.warning {
    border-left-color: var(--gx-pending);
}

.stat-card.danger {
    border-left-color: var(--gx-failed);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #333;
    line-height: 1;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
}

.stat-trend.up {
    color: var(--gx-verified);
}

.stat-trend.down {
    color: var(--gx-failed);
}

/* Compliance Level Meter */
.compliance-meter {
    background: #f0f0f0;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.meter-track {
    height: 12px;
    background: #ddd;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.meter-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease;
}

.meter-fill.l1 {
    background: linear-gradient(90deg, var(--gx-l1), #858c94);
    width: 33%;
}

.meter-fill.l2 {
    background: linear-gradient(90deg, var(--gx-l1), var(--gx-l2));
    width: 66%;
}

.meter-fill.l3 {
    background: linear-gradient(90deg, var(--gx-l1), var(--gx-l2), var(--gx-l3));
    width: 100%;
}

.meter-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #666;
}

/* =============================================================================
   Data Tables
   ============================================================================= */

.gx-table {
    width: 100%;
    border-collapse: collapse;
}

.gx-table th,
.gx-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.gx-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.gx-table tr:hover {
    background: #f8f9fa;
}

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

/* =============================================================================
   Policy Cards
   ============================================================================= */

.policy-card {
    border: 1px solid #ddd;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.policy-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    cursor: pointer;
    transition: background 0.2s;
}

.policy-header:hover {
    background: #eee;
}

.policy-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.policy-type {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: var(--gx-blue-bg);
    color: var(--gx-blue);
}

.policy-body {
    padding: 1.5rem;
    display: none;
}

.policy-body.expanded {
    display: block;
}

.policy-section {
    margin-bottom: 1.5rem;
}

.policy-section h4 {
    color: #333;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.policy-rule {
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.policy-rule .action {
    font-weight: 600;
    color: var(--gx-blue);
}

.policy-rule .constraint {
    color: #666;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* =============================================================================
   Evaluation Result
   ============================================================================= */

.eval-result {
    padding: 1.5rem;
    border-radius: 12px;
    margin: 1rem 0;
}

.eval-result.allowed {
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.eval-result.denied {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

.eval-result-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.eval-result-icon {
    font-size: 2rem;
}

.eval-result-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.eval-result.allowed .eval-result-title {
    color: #155724;
}

.eval-result.denied .eval-result-title {
    color: #721c24;
}

.eval-duties {
    background: rgba(255, 255, 255, 0.5);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.eval-duties h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: #856404;
}

/* =============================================================================
   Toast Notifications
   ============================================================================= */

.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast-success {
    border-left: 4px solid var(--gx-verified);
}

.toast-error {
    border-left: 4px solid var(--gx-failed);
}

.toast-info {
    border-left: 4px solid var(--gx-blue);
}

/* =============================================================================
   Footer
   ============================================================================= */

.gaiax-footer {
    background: #f8f9fa;
    border-top: 1px solid #eee;
    padding: 1rem 1.5rem;
    margin-top: auto;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
    font-size: 0.9rem;
}

.footer-left a {
    color: var(--gx-blue);
    text-decoration: none;
}

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

.separator {
    color: #ccc;
}

.gaiax-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #666;
}

.gaiax-logo {
    height: 20px;
    width: auto;
}

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 1024px) {
    .header-container {
        flex-wrap: wrap;
    }
    
    .header-nav {
        order: 3;
        width: 100%;
        margin-top: 0.75rem;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .gaiax-header {
        padding: 0.5rem 1rem;
    }
    
    .header-nav {
        display: none;
    }
    
    .gaiax-main {
        padding: 1rem;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .footer-container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* =============================================================================
   Animations
   ============================================================================= */

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

.animate-fade-in {
    animation: fadeIn 0.3s ease forwards;
}

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

.loading {
    animation: pulse 1.5s infinite;
}

/* =============================================================================
   JSON/Code Display
   ============================================================================= */

.json-display {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1rem;
    border-radius: 8px;
    font-family: var(--gx-font-mono);
    font-size: 0.85rem;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.json-key {
    color: #9cdcfe;
}

.json-string {
    color: #ce9178;
}

.json-number {
    color: #b5cea8;
}

.json-boolean {
    color: #569cd6;
}
