/**
 * LOGHUB - Centralny portal logowania
 * Stylistyka zgodna z GrantOMat
 */

/* =============================================================================
   CSS VARIABLES
   ============================================================================= */

:root {
    --accent-700: #047857;
    --accent-600: #059669;
    --accent-500: #10b981;
    --accent-400: #34d399;
    --accent-300: #6ee7b7;
    --accent-200: #a7f3d0;
    --accent-100: #d1fae5;
    --accent-50:  #ecfdf5;

    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50:  #f9fafb;

    --danger-600: #dc2626;
    --danger-100: #fee2e2;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08);
    --accent-rgb: 16, 185, 129;
    --shadow-accent: 0 4px 14px rgba(var(--accent-rgb), 0.25);

    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.25rem;
}

/* =============================================================================
   RESET & BASE
   ============================================================================= */

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

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--gray-900);
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =============================================================================
   SCREEN MANAGEMENT
   ============================================================================= */

.hub-screen {
    display: none;
    min-height: 100vh;
}

.hub-screen.active {
    display: flex;
}

/* =============================================================================
   LAYOUT - Split Screen
   ============================================================================= */

.hub-left {
    flex: 1;
    background: var(--gray-50);
    padding: 40px;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hub-right {
    flex: 1;
    background: linear-gradient(135deg, var(--accent-500) 0%, var(--accent-700) 50%, color-mix(in srgb, var(--accent-700) 70%, #000) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
}

.hub-right::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.hub-right::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -30%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
    pointer-events: none;
}

.hub-right-content {
    text-align: center;
    color: #ffffff;
    max-width: 400px;
    position: relative;
    z-index: 1;
}

.hub-right-logo {
    height: 60px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    margin: 0 auto 24px;
    display: block;
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

.hub-right-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 2rem;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hub-right-content h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.025em;
}

.hub-right-content p {
    font-size: 1rem;
    opacity: 0.85;
    line-height: 1.7;
    margin-bottom: 32px;
}

.hub-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.hub-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    opacity: 0.9;
}

.hub-feature i {
    font-size: 1.1rem;
    color: var(--accent-300);
}

/* =============================================================================
   FORM CONTAINER
   ============================================================================= */

.hub-container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Logo Section */
.hub-logo-section {
    text-align: center;
    margin-bottom: 40px;
}

.hub-logo-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, var(--accent-500) 0%, var(--accent-600) 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.5rem;
    margin-bottom: 16px;
    box-shadow: var(--shadow-accent);
}

.hub-logo-img {
    height: 60px;
    width: auto;
    max-width: 240px;
    object-fit: contain;
    margin-bottom: 8px;
}

.hub-brand {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
    letter-spacing: -0.025em;
}

.hub-brand-sub {
    font-size: 0.95rem;
    color: var(--gray-500);
    margin: 0;
}

/* =============================================================================
   CARD
   ============================================================================= */

.hub-card {
    background: transparent;
}

.hub-card-header {
    padding: 0 0 24px 0;
}

.hub-card-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
    letter-spacing: -0.025em;
}

.hub-card-subtitle {
    font-size: 1rem;
    color: var(--gray-500);
    margin-bottom: 0;
}

.hub-card-body {
    padding: 0;
}

/* =============================================================================
   PORTAL SELECTION CARDS
   ============================================================================= */

.portal-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.portal-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    background: #ffffff;
    cursor: pointer;
    transition: all 200ms ease;
    user-select: none;
}

.portal-card:hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.portal-card.selected {
    border-color: var(--accent-500);
    background: var(--accent-50);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.portal-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--portal-color, var(--accent-500)) 12%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--portal-color, var(--accent-500));
    flex-shrink: 0;
}

.portal-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.portal-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--gray-900);
}

.portal-desc {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.portal-check {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: all 200ms ease;
    flex-shrink: 0;
}

.portal-card.selected .portal-check {
    background: var(--accent-500);
    border-color: var(--accent-500);
    color: #ffffff;
    font-size: 0.85rem;
}

/* =============================================================================
   FORM ELEMENTS
   ============================================================================= */

.form-label {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 0.9rem;
    margin-bottom: 8px;
    display: block;
}

.form-control {
    width: 100%;
    height: 52px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    font-size: 1rem;
    transition: all 200ms ease;
    color: var(--gray-900);
    background: #ffffff;
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control:focus {
    border-color: var(--accent-500);
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.form-control.is-invalid {
    border-color: var(--danger-600);
}

.input-group {
    position: relative;
    display: flex;
    align-items: stretch;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: var(--gray-100);
    border: 1.5px solid var(--gray-200);
    border-right: none;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    color: var(--gray-500);
}

.input-group .form-control {
    border-left: none;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.input-group:focus-within .input-group-text {
    border-color: var(--accent-500);
    background: var(--accent-50);
    color: var(--accent-600);
}

.input-group:focus-within .form-control {
    border-color: var(--accent-500);
}

.invalid-feedback {
    color: var(--danger-600);
    font-size: 0.85rem;
    margin-top: 6px;
    display: none;
}

.invalid-feedback.show {
    display: block;
}

/* =============================================================================
   BUTTONS
   ============================================================================= */

.btn {
    height: 52px;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 200ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-500) 0%, var(--accent-600) 100%);
    color: #ffffff;
    box-shadow: var(--shadow-accent);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--accent-600) 0%, var(--accent-700) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(var(--accent-rgb), 0.35);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-outline {
    background: #ffffff;
    color: var(--gray-700);
    border: 1.5px solid var(--gray-200);
}

.btn-outline:hover {
    border-color: var(--accent-500);
    color: var(--accent-600);
    background: var(--accent-50);
    transform: translateY(-1px);
}

/* =============================================================================
   STEP 2 - SENT CONFIRMATION
   ============================================================================= */

.sent-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--accent-50);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    color: var(--accent-500);
    border: 2px solid var(--accent-200);
}

.sent-info {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    background: var(--gray-100);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}

.sent-info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--gray-600);
}

.sent-info-item i {
    color: var(--accent-500);
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sent-divider {
    height: 1px;
    background: var(--gray-200);
    margin-bottom: 24px;
}

/* =============================================================================
   LOADING OVERLAY
   ============================================================================= */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    text-align: center;
}

.loading-spinner .spinner-border {
    width: 40px;
    height: 40px;
    border-width: 3px;
    color: var(--accent-500);
    margin-bottom: 12px;
}

.loading-spinner p {
    color: var(--gray-600);
    font-size: 0.95rem;
    font-weight: 500;
}

/* =============================================================================
   FOOTER
   ============================================================================= */

.hub-footer {
    text-align: center;
    margin-top: 40px;
}

.hub-footer p {
    font-size: 0.8rem;
    color: var(--gray-400);
    margin: 0;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 1200px) {
    .hub-left {
        padding: 30px;
    }
    .hub-right {
        padding: 40px;
    }
    .hub-container {
        max-width: 420px;
    }
    .hub-card-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 992px) {
    .hub-screen {
        flex-direction: column;
    }
    .hub-screen.active {
        display: flex;
    }
    .hub-right {
        display: none;
    }
    .hub-left {
        flex: 1;
        min-height: 100vh;
        padding: 40px 20px;
    }
    .hub-container {
        max-width: 480px;
    }
}

@media (max-width: 768px) {
    .hub-left {
        padding: 30px 20px;
    }
    .hub-container {
        max-width: 100%;
        padding: 0 10px;
    }
    .hub-card-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .hub-left {
        padding: 24px 16px;
        align-items: flex-start;
    }
    .hub-container {
        max-width: 100%;
        padding: 0;
    }
    .hub-brand {
        font-size: 1.5rem;
    }
    .hub-logo-section {
        margin-bottom: 28px;
    }
    .hub-card-title {
        font-size: 1.35rem;
    }
    .form-control, .btn {
        height: 48px;
        font-size: 0.95rem;
    }
    .portal-card {
        padding: 12px 14px;
    }
    .portal-icon {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
}

/* =============================================================================
   ACCESSIBILITY
   ============================================================================= */

.btn:focus,
.form-control:focus,
.portal-card:focus-visible {
    outline: 2px solid var(--accent-500);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* =============================================================================
   ANIMATIONS
   ============================================================================= */

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

.hub-screen.active .hub-card {
    animation: fadeIn 400ms ease;
}

.hub-screen.active .hub-right-content {
    animation: fadeIn 600ms ease;
}

/* =============================================================================
   PORTAL SECTION LABEL
   ============================================================================= */

.portal-section-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 6px;
    padding-left: 2px;
}

/* =============================================================================
   THEME SWITCHER
   ============================================================================= */

.theme-switcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
}

.theme-toggle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent-500);
    color: #ffffff;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.35);
    transition: all 200ms ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(var(--accent-rgb), 0.45);
}

.theme-panel {
    position: absolute;
    bottom: 60px;
    right: 0;
    background: #ffffff;
    border-radius: var(--radius-xl);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--gray-200);
    padding: 16px;
    min-width: 200px;
    display: none;
    animation: fadeIn 200ms ease;
}

.theme-panel.open {
    display: block;
}

.theme-panel-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-100);
}

.theme-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 150ms ease;
    width: 100%;
    text-align: left;
}

.theme-option:hover {
    background: var(--gray-100);
}

.theme-option.active {
    background: var(--accent-50);
    font-weight: 600;
}

.theme-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(0, 0, 0, 0.08);
}

.theme-option.active .theme-swatch {
    border-color: var(--gray-900);
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--gray-900);
}

.theme-label {
    font-size: 0.9rem;
    color: var(--gray-700);
}

@media (max-width: 576px) {
    .theme-switcher {
        bottom: 16px;
        right: 16px;
    }
    .theme-toggle {
        width: 42px;
        height: 42px;
        font-size: 1rem;
    }
    .theme-panel {
        right: 0;
        min-width: 180px;
    }
}
