/* ==========================================================================
   BILFT Portal — Component Styles
   Uses design tokens from theme.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bilft-midnight) 0%, #111430 50%, var(--bilft-surface-alt) 100%);
    padding: 1rem;
}

.login-card {
    background: var(--bilft-surface);
    border: 1px solid var(--bilft-border);
    border-radius: var(--bilft-radius-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--bilft-shadow-lg);
    animation: fadeIn 0.4s ease forwards;
}

.login-card .form-label {
    color: var(--bilft-text-secondary);
    font-size: 0.825rem;
    font-weight: 500;
}

.login-card .input-group-text {
    background: var(--bilft-surface-alt);
    border-color: var(--bilft-border);
    color: var(--bilft-text-muted);
}

.divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--bilft-text-secondary);
    font-size: 0.8rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--bilft-border);
}

.divider span {
    padding: 0 1rem;
}

/* --------------------------------------------------------------------------
   Dashboard Layout
   -------------------------------------------------------------------------- */

.sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 260px;
    background: rgba(22, 24, 41, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--bilft-border);
    overflow-y: auto;
    flex-direction: column;
    z-index: 1030;
    transition: width var(--bilft-transition-slow);
}

.main-content {
    margin-left: 0;
    margin-top: 56px;
    height: calc(100vh - 56px);
    position: relative;
}

@media (min-width: 768px) {
    .main-content {
        margin-left: 260px;
    }
}

.content-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: var(--bilft-midnight);
}

/* Skeleton for iframe loading */
.iframe-skeleton {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 2rem;
    background: var(--bilft-midnight);
}

.iframe-skeleton .skeleton {
    height: 20px;
    border-radius: var(--bilft-radius-sm);
}

.iframe-skeleton .skeleton:first-child { width: 60%; height: 28px; }
.iframe-skeleton .skeleton:nth-child(2) { width: 80%; }
.iframe-skeleton .skeleton:nth-child(3) { width: 45%; }
.iframe-skeleton .skeleton:nth-child(4) { width: 100%; height: 200px; border-radius: var(--bilft-radius-md); }

/* --------------------------------------------------------------------------
   Sidebar Nav
   -------------------------------------------------------------------------- */

.sidebar-nav {
    padding: 0.5rem;
}

.sidebar-section-header {
    color: var(--bilft-text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 1.25rem 0.75rem 0.4rem;
    border-bottom: 1px solid var(--bilft-border);
    margin-bottom: 0.25rem;
}

.sidebar-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--bilft-border);
    cursor: pointer;
    text-align: left;
    transition: color 0.15s, background 0.15s;
}
.sidebar-section-toggle:hover {
    color: var(--bilft-text);
    background: rgba(255, 255, 255, 0.03);
}
.sidebar-section-title {
    display: inline-flex;
    align-items: center;
}
.sidebar-section-chevron {
    font-size: 0.85rem;
    transition: transform 0.2s ease;
}
.sidebar-section-toggle.open .sidebar-section-chevron {
    transform: rotate(180deg);
}

.sidebar-section-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}
.sidebar-section-body.open {
    max-height: 2000px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.55rem 0.75rem;
    margin: 1px 0;
    color: var(--bilft-text-secondary);
    text-decoration: none;
    border-radius: var(--bilft-radius-sm);
    font-size: 0.85rem;
    transition: all var(--bilft-transition);
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--bilft-text);
}

.sidebar-link.active {
    background: var(--bilft-blue);
    color: #fff;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

/* --------------------------------------------------------------------------
   Top Navbar Enhancements
   -------------------------------------------------------------------------- */

.navbar .btn {
    border-radius: var(--bilft-radius-sm);
}

.navbar .navbar-brand {
    font-weight: 600;
    letter-spacing: -0.01em;
}

.navbar .nav-user-link {
    color: var(--bilft-text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color var(--bilft-transition);
}

.navbar .nav-user-link:hover {
    color: var(--bilft-text);
}

/* --------------------------------------------------------------------------
   My Dashboards
   -------------------------------------------------------------------------- */

.my-dash-page {
    background: var(--bilft-midnight);
    min-height: 100vh;
}

.my-dash-header {
    background: linear-gradient(135deg, var(--bilft-surface) 0%, var(--bilft-surface-alt) 100%);
    border-bottom: 1px solid var(--bilft-border);
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.my-dash-header h2 {
    color: var(--bilft-text);
    font-weight: 700;
    margin: 0;
}

.my-dash-header p {
    color: var(--bilft-text-secondary);
    margin: 0.25rem 0 0;
}

/* Dashboard cards */
.dash-card {
    border: 1px solid var(--bilft-border);
    border-radius: var(--bilft-radius-lg);
    transition: transform var(--bilft-transition), border-color var(--bilft-transition);
    overflow: hidden;
    background: var(--bilft-surface);
}

.dash-card:hover {
    transform: translateY(-2px);
    border-color: var(--bilft-border-hover);
}

.dash-card .card-body {
    padding: 1.25rem;
}

.dash-card .card-footer {
    background: var(--bilft-surface-alt);
    border-top: 1px solid var(--bilft-border);
    padding: 0.75rem 1.25rem;
}

.dash-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--bilft-text);
    margin: 0;
    line-height: 1.3;
}

.dash-card-desc {
    color: var(--bilft-text-secondary);
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 0.5rem 0 0;
}

.dash-card-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--bilft-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.dash-card-icon.superset      { background: rgba(37, 99, 235, 0.15); color: var(--bilft-blue-light); }
.dash-card-icon.metabase      { background: rgba(16, 185, 129, 0.15); color: var(--bilft-green); }
.dash-card-icon.streamlit     { background: rgba(239, 68, 68, 0.15); color: var(--bilft-red); }
.dash-card-icon.powerbi       { background: rgba(245, 158, 11, 0.15); color: var(--bilft-amber); }
.dash-card-icon.grafana       { background: rgba(245, 158, 11, 0.15); color: var(--bilft-amber); }
.dash-card-icon.lookerstudio  { background: rgba(139, 92, 246, 0.15); color: var(--bilft-purple); }
.dash-card-icon.html          { background: rgba(96, 165, 250, 0.15); color: var(--bilft-blue-light); }

/* Type badge */
.type-badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.5rem;
    border-radius: var(--bilft-radius-sm);
    background: var(--bilft-surface-alt) !important;
    color: var(--bilft-text-muted) !important;
}

/* Visibility badge */
.vis-badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.6rem;
    border-radius: var(--bilft-radius-xl);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.vis-badge.private  { background: rgba(148, 163, 184, 0.1); color: var(--bilft-text-muted); }
.vis-badge.users    { background: rgba(139, 92, 246, 0.15); color: var(--bilft-purple); }
.vis-badge.link     { background: rgba(96, 165, 250, 0.15); color: var(--bilft-blue-light); }
.vis-badge.public   { background: rgba(16, 185, 129, 0.15); color: var(--bilft-green); }

/* Action buttons in cards */
.dash-actions .btn {
    border-radius: var(--bilft-radius-sm);
    font-size: 0.8rem;
    padding: 0.35rem 0.65rem;
    font-weight: 500;
}

/* Shared with me cards */
.shared-card {
    border-left: 3px solid var(--bilft-blue-light);
}

/* Empty state */
.empty-state {
    padding: 4rem 1rem;
    text-align: center;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--bilft-radius-xl);
    background: rgba(37, 99, 235, 0.15);
    color: var(--bilft-blue-light);
    font-size: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.empty-state h5 {
    font-weight: 600;
    color: var(--bilft-text);
}

.empty-state p {
    color: var(--bilft-text-secondary);
    max-width: 360px;
    margin: 0 auto 1.5rem;
}

/* Section divider */
.section-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 2.5rem 0 1.25rem;
}

.section-divider h5 {
    margin: 0;
    font-weight: 600;
    color: var(--bilft-text);
    white-space: nowrap;
}

.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--bilft-border);
}

/* --------------------------------------------------------------------------
   Form Styles
   -------------------------------------------------------------------------- */

.my-dash-form .card {
    border: 1px solid var(--bilft-border);
    border-radius: var(--bilft-radius-lg);
}

.my-dash-form .card-body {
    padding: 1.75rem;
}

.my-dash-form .card-footer {
    background: var(--bilft-surface-alt);
    border-top: 1px solid var(--bilft-border);
}

.my-dash-form .form-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--bilft-text-secondary);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* User picker */
.user-picker {
    border: 1px solid var(--bilft-border);
    border-radius: var(--bilft-radius-md);
    overflow: hidden;
}

.user-picker-search {
    border-bottom: 1px solid var(--bilft-border);
    padding: 0.6rem 0.75rem;
    background: var(--bilft-surface-alt);
    display: flex;
    align-items: center;
}

.user-picker-search input {
    border: none;
    background: transparent;
    width: 100%;
    outline: none;
    font-size: 0.85rem;
    color: var(--bilft-text);
}

.user-picker-search input::placeholder {
    color: var(--bilft-text-muted);
}

.user-picker-list {
    max-height: 220px;
    overflow-y: auto;
    padding: 0.35rem;
}

.user-picker-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.65rem;
    border-radius: var(--bilft-radius-sm);
    cursor: pointer;
    transition: background var(--bilft-transition);
}

.user-picker-item:hover {
    background: var(--bilft-surface-hover);
}

.user-picker-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
    cursor: pointer;
}

.user-picker-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.15);
    color: var(--bilft-blue-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.user-picker-info {
    flex: 1;
    min-width: 0;
}

.user-picker-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--bilft-text);
    line-height: 1.2;
}

.user-picker-email {
    font-size: 0.75rem;
    color: var(--bilft-text-muted);
    line-height: 1.2;
}

/* Share link banner */
.share-link-banner {
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: var(--bilft-radius-md);
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.share-link-banner code {
    background: var(--bilft-surface-alt);
    padding: 0.3rem 0.6rem;
    border-radius: var(--bilft-radius-sm);
    font-size: 0.8rem;
    border: 1px solid var(--bilft-border);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--bilft-blue-light);
}

/* View page navbar */
.view-navbar {
    background: linear-gradient(135deg, var(--bilft-surface) 0%, var(--bilft-surface-alt) 100%);
    height: 56px;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Stats counter */
.dash-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--bilft-text-muted);
}

/* --------------------------------------------------------------------------
   Admin Pages
   -------------------------------------------------------------------------- */

.admin-page {
    background: var(--bilft-midnight);
    min-height: 100vh;
}

.admin-page .card-header.bg-primary {
    background: var(--bilft-blue) !important;
}

.admin-page h4 {
    color: var(--bilft-text);
}

/* Admin nav tabs */
.admin-nav .btn.active,
.admin-nav .btn-warning {
    background: var(--bilft-blue) !important;
    border-color: var(--bilft-blue) !important;
    color: #fff !important;
}

/* --------------------------------------------------------------------------
   Profile Page
   -------------------------------------------------------------------------- */

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.15);
    color: var(--bilft-blue-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}
