/* ============================================
   Main portal styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Arial', sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
}

.portal {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: #0f172a;
}

.portal-header nav {
    display: flex;
    gap: 24px;
}

.portal-header nav a {
    color: #475569;
    text-decoration: none;
    font-weight: 500;
}

.portal-header nav a:hover {
    color: #0f172a;
}

.user {
    font-weight: 500;
    color: #475569;
}

.portal-content {
    background: #ffffff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.cards {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.card {
    flex: 1;
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-weight: 500;
}

/* ============================================
   BITB WINDOW (Windows 11 style)
   ============================================ */
.bitb-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99999;
}

.bitb-container.active {
    pointer-events: auto;
}

.bitb-window {
    position: absolute;
    top: 60px;
    left: 60px;
    width: 880px;
    height: 660px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 12px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25), 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.96) translateY(10px);
    transition: opacity 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
        transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.bitb-window.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.bitb-window.minimized {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
}

.bitb-window.maximized {
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
}

/* Title bar */
.bitb-titlebar {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    background: rgba(240, 240, 240, 0.5);
    border-radius: 12px 12px 0 0;
    cursor: default;
    user-select: none;
    flex-shrink: 0;
    min-height: 36px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.bitb-titlebar .icon {
    font-size: 1rem;
    margin-right: 6px;
}

.bitb-titlebar .title {
    flex: 1;
    font-size: 0.78rem;
    font-weight: 500;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bitb-titlebar .controls {
    display: flex;
    gap: 4px;
}

.bitb-titlebar .controls button {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #333;
    transition: background 0.1s;
}

.bitb-titlebar .controls button:hover {
    background: rgba(0, 0, 0, 0.06);
}

.bitb-titlebar .controls .btn-close:hover {
    background: #e81123;
    color: white;
}

.bitb-titlebar .controls svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

/* Address bar */
.bitb-address {
    display: flex;
    align-items: center;
    padding: 2px 10px;
    background: rgba(245, 245, 245, 0.6);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    flex-shrink: 0;
    height: 32px;
    gap: 6px;
}

.bitb-address .nav {
    display: flex;
    gap: 2px;
    color: #666;
}

.bitb-address .nav span {
    padding: 2px 4px;
    cursor: default;
    opacity: 0.5;
    font-size: 0.9rem;
}

.bitb-address .url {
    flex: 1;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    padding: 2px 12px;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 24px;
}

.bitb-address .url .lock {
    font-size: 0.7rem;
    opacity: 0.6;
}

.bitb-address .url .domain {
    font-weight: 500;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bitb-address .url .path {
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bitb-address .actions {
    display: flex;
    gap: 2px;
    color: #666;
}

.bitb-address .actions span {
    padding: 2px 4px;
    cursor: default;
    opacity: 0.5;
    font-size: 0.9rem;
}

/* Content */
.bitb-content {
    flex: 1;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    position: relative;
}

.bitb-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.bitb-content .loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #666;
    font-size: 0.85rem;
}

.bitb-content .loading .spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e8e8e8;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Resize handle */
.bitb-resize {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 16px;
    height: 16px;
    cursor: se-resize;
}

.bitb-resize::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(0, 0, 0, 0.2);
    border-bottom: 2px solid rgba(0, 0, 0, 0.2);
}

/* Responsive */
@media (max-width: 768px) {
    .bitb-window {
        width: 94vw;
        height: 80vh;
        top: 10vh;
        left: 3vw;
    }
}