/* 
 * Partner Portal SPA Styles
 * 
 * Reuses variables from main.css: 
 * --color-primary: #000a2e
 * --color-surface: #f8fafc
 * --font-family-headline, --font-family-body
 */

/* Layout Reset for Portal */
.portal-layout {
    display: flex;
    height: 100vh;
    background-color: var(--color-surface);
    overflow: hidden;
    font-family: var(--font-family-body);
}

/* Sidebar */
.portal-sidebar {
    width: 250px;
    background-color: #ffffff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

.portal-sidebar__header {
    padding: 24px;
    border-bottom: 1px solid #e2e8f0;
}

.portal-sidebar__title {
    font-family: var(--font-family-headline);
    font-size: 20px;
    color: var(--color-primary);
    margin: 0 0 4px 0;
}

.portal-sidebar__subtitle {
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.portal-sidebar__nav {
    flex: 1;
    padding: 24px 16px;
    overflow-y: auto;
}

.portal-nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #475569;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.portal-nav-link:hover {
    background-color: #f1f5f9;
    color: var(--color-primary);
}

.portal-nav-link.active {
    background-color: rgba(118, 198, 253, 0.2); /* Light blue from theme */
    color: var(--color-primary);
    font-weight: 600;
}

.portal-nav-link .material-symbols-outlined {
    margin-right: 12px;
    font-size: 20px;
}

.portal-sidebar__footer {
    padding: 24px 16px;
    border-top: 1px solid #e2e8f0;
}

/* Main Area */
.portal-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Topbar */
.portal-topbar {
    height: 72px;
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    flex-shrink: 0;
}

.portal-topbar__search {
    display: flex;
    align-items: center;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 16px;
    width: 300px;
}

.portal-topbar__search input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    margin-left: 8px;
    font-size: 14px;
    color: var(--color-primary);
}

.portal-topbar__search .material-symbols-outlined {
    color: #94a3b8;
    font-size: 20px;
}

.portal-topbar__actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.portal-action-btn {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background 0.2s;
}

.portal-action-btn:hover {
    background-color: #f1f5f9;
    color: var(--color-primary);
}

.portal-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Views Container */
.portal-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.portal-view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.portal-view.active {
    display: block;
}

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

.portal-view__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
}

.portal-view__title {
    font-family: var(--font-family-headline);
    font-size: 32px;
    color: var(--color-primary);
    margin: 0 0 8px 0;
}

.portal-view__description {
    color: #64748b;
    margin: 0;
}

.portal-view__filters {
    display: flex;
    gap: 16px;
}

.portal-select {
    padding: 8px 32px 8px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background-color: #ffffff;
    color: #475569;
    font-size: 14px;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23475569" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
    background-repeat: no-repeat;
    background-position: right 8px center;
    cursor: pointer;
}

/* Video Grid */
.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

/* Video Card Instance */
.p-video-card {
    background-color: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}

.p-video-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.p-video-card__thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    background-color: #f1f5f9;
    position: relative;
}

.p-video-card__thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.p-video-card__thumbnail--fallback img {
    object-fit: contain;
    padding: 32px;
}

.p-video-card__duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0,0,0,0.8);
    color: white;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.p-video-card__status-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 4px;
    color: white;
}
.status-published { background-color: #10b981; } /* Green */
.status-processing { background-color: #3b82f6; } /* Blue */
.status-draft { background-color: #64748b; } /* Gray */

.p-video-card__body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.p-video-card__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.p-video-card__title {
    font-family: var(--font-family-headline);
    font-size: 16px;
    font-weight: 600;
    color: var(--color-primary);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.p-video-card__options {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    margin-left: 8px;
}

.p-video-card__options:hover {
    color: var(--color-primary);
}

.p-video-card__footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #64748b;
}

.p-video-card__indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.p-video-card__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.dot-published { background-color: #10b981; }
.dot-processing { background-color: #3b82f6; }
.dot-draft { background-color: #cbd5e1; }

/* Upload Card (Dashed) */
.p-upload-card {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background-color: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 280px;
}

.p-upload-card:hover {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

.p-upload-card__icon {
    width: 64px;
    height: 64px;
    background-color: #dbeafe;
    color: #3b82f6;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.p-upload-card__icon span {
    font-size: 32px;
}

.p-upload-card__title {
    font-family: var(--font-family-headline);
    font-weight: 600;
    color: var(--color-primary);
    margin: 0 0 8px 0;
}

.p-upload-card__text {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

/* Modal */
.portal-modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 10, 46, 0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
}

.portal-modal.active {
    display: flex;
}

.portal-modal__content {
    background-color: #ffffff;
    width: 100%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
    overflow: hidden;
}

.portal-modal__header {
    padding: 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.portal-modal__header h3 {
    margin: 0;
    color: var(--color-primary);
    font-family: var(--font-family-headline);
}

.portal-modal__close {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
}

.portal-modal__close:hover {
    color: var(--color-primary);
}

.portal-modal__body {
    padding: 24px;
}

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

.portal-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-primary);
    margin-bottom: 8px;
}

.portal-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

.portal-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Loading State */
.portal-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px;
    color: #64748b;
    font-weight: 500;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
    .portal-layout {
        flex-direction: column;
    }
    
    .portal-sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }
    
    .portal-sidebar__nav {
        display: flex;
        overflow-x: auto;
        padding: 16px;
    }
    
    .portal-nav-link {
        white-space: nowrap;
        margin-right: 8px;
        margin-bottom: 0;
    }
    
    .portal-sidebar__footer {
        display: none; /* Hide footer actions on mobile for now, or move to hamburger */
    }
    
    .portal-topbar {
        padding: 0 16px;
    }
    
    .portal-topbar__search {
        width: auto;
        flex: 1;
        margin-right: 16px;
    }
    
    .portal-content {
        padding: 16px;
    }
    
    .portal-view__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}
