/**
 * Team Portal Theme + Styles
 * Overrides accent colors and adds portal-specific styles
 */

/* Team beta badge */
.team-beta-badge {
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
    background: rgba(46, 91, 138, 0.15);
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    vertical-align: super;
}

/* Override accent colors for team portal */
:root {
    --accent-primary: #2E5B8A;
    --accent-primary-hover: #3A6FA3;
    --color-success: #2E5B8A;
    --color-maroon: #2E5B8A;
    --color-maroon-hover: #3A6FA3;
    --accent-secondary: #2E5B8A;
    --accent-secondary-hover: #3A6FA3;
}

/* Override hardcoded maroon rgba values */
.badge-success {
    background-color: rgba(46, 91, 138, 0.3) !important;
}

.role-badge.instructor {
    background-color: rgba(46, 91, 138, 0.3) !important;
}

.subscription-badge {
    background-color: rgba(46, 91, 138, 0.3) !important;
}

.preview-badge {
    background: rgba(46, 91, 138, 0.2) !important;
}

.item-type-badge.type-clip {
    background: rgba(46, 91, 138, 0.15) !important;
}

/* Portal Layout */
.portal-container {
    display: flex;
    min-height: 100vh;
}

.portal-main {
    flex: 1;
    padding: 32px;
    max-width: 1000px;
}

/* Library layout: sidebar + content */
.library-layout {
    display: flex;
    gap: 0;
    min-height: calc(100vh - 160px);
}

.library-sidebar {
    width: 200px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    padding-right: 24px;
}

.library-sidebar-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0 12px 8px;
}

.library-filter-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.library-filter-item:hover {
    background: var(--bg-highlight);
    color: var(--text-primary);
}

.library-filter-item.active {
    background: var(--bg-highlight);
    color: var(--text-primary);
    font-weight: 600;
}

.library-filter-item .filter-count {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.library-content {
    flex: 1;
    padding-left: 24px;
}

/* Page Header */
.portal-header {
    margin-bottom: 32px;
}

.portal-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.portal-header p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.95rem;
}

/* Cards */
.portal-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
}

.portal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.portal-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Tables */
.portal-table {
    width: 100%;
    border-collapse: collapse;
}

.portal-table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

.portal-table td {
    padding: 12px 16px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--divider-color);
}

.portal-table tr:hover td {
    background: var(--bg-highlight);
}

/* Buttons */
.portal-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

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

.portal-btn-primary:hover {
    background: var(--accent-primary-hover);
}

.portal-btn-secondary {
    background: var(--bg-highlight);
    color: var(--text-primary);
}

.portal-btn-secondary:hover {
    background: var(--bg-press);
}

.portal-btn-danger {
    background: transparent;
    color: var(--color-danger);
    border: 1px solid var(--color-danger);
}

.portal-btn-danger:hover {
    background: rgba(233, 20, 41, 0.1);
}

.portal-btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Badge */
.portal-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.portal-badge-active {
    background: rgba(46, 91, 138, 0.2);
    color: #5a9fd4;
}

.portal-badge-pending {
    background: rgba(255, 164, 43, 0.2);
    color: var(--color-warning);
}

.portal-badge-inactive {
    background: var(--bg-highlight);
    color: var(--text-muted);
}

/* Form elements */
.portal-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-highlight);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.portal-input:focus {
    border-color: var(--accent-primary);
}

.portal-input::placeholder {
    color: var(--text-muted);
}

.portal-label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.portal-form-group {
    margin-bottom: 20px;
}

/* Invite Code Display */
.invite-code-display {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-highlight);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: 0.1em;
}

.invite-code-display button {
    padding: 6px 12px;
    background: var(--bg-press);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
}

/* Empty State */
.portal-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.portal-empty h3 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Login Page */
.portal-login {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-base);
}

.portal-login-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    padding: 48px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.portal-login-card h1 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.portal-login-card p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.google-signin-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    background: white;
    color: #333;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: box-shadow 0.2s;
}

.google-signin-btn:hover {
    box-shadow: var(--shadow-md);
}

.google-signin-btn img {
    width: 20px;
    height: 20px;
}

/* Library Actions */
.library-actions {
    position: relative;
}

.create-menu-item {
    display: block;
    padding: 8px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.15s;
}

.create-menu-item:hover {
    background: var(--bg-highlight);
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.content-item {
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: background 0.2s;
}

.content-item:hover {
    background: var(--bg-highlight);
}

.content-item-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg-highlight);
    object-fit: cover;
}

.content-item-info {
    padding: 12px;
}

.content-item-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.content-item-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .portal-main {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .library-layout {
        flex-direction: column;
    }

    .library-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-right: 0;
        padding-bottom: 16px;
        margin-bottom: 16px;
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    .library-sidebar-title {
        width: 100%;
    }

    .library-content {
        padding-left: 0;
    }
}

/* User avatar */
.portal-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.portal-avatar-lg {
    width: 64px;
    height: 64px;
}

/* Member/Instructor Row */
.member-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--divider-color);
}

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

.member-info {
    flex: 1;
}

.member-name {
    font-weight: 500;
    color: var(--text-primary);
}

.member-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Onboarding */
.onboarding-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 48px 24px;
}

.onboarding-step {
    margin-bottom: 32px;
}

.onboarding-step h2 {
    font-size: 1.3rem;
    margin-bottom: 16px;
}

/* Toast/Notification */
.portal-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

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

/* Scope Dropdown (Team / Public) on create buttons */
.scope-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.scope-dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-width: 220px;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    overflow: hidden;
}

.scope-dropdown-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.15s;
    cursor: pointer;
}

.scope-dropdown-item:hover {
    background: var(--bg-highlight);
}

.scope-dropdown-item strong {
    font-size: 0.9rem;
}

.scope-dropdown-item span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}
