/* Main Layout and Header Styles */

#script-writer-view {
    display: none;
}

#script-writer-view.active {
    display: block;
}

/* Skeletons */
.skeleton {
    background: var(--color-bg-tertiary);
    border-radius: 4px;
}

.skeleton.circle {
    border-radius: 50%;
}

.skeleton.pulse {
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 0.3;
    }

    100% {
        opacity: 0.6;
    }
}

.profile-channel-loading {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0 var(--space-1);
}

/* Header */
#script-writer-view .content-header {
    padding: var(--space-4) 0 var(--space-4);
    margin-bottom: var(--space-4);
    padding-top: 0;
}

/* Profile Selector Header */
.profile-header-selector {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    margin-right: var(--space-4);
}

.profile-channel-thumb {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    border: 2.5px solid var(--color-bg-secondary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-tertiary);
    flex-shrink: 0;
}

.profile-channel-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info-column {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-channel-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text-primary);
    line-height: 1.2;
}

.profile-selector-wrapper {
    position: relative;
}

.profile-compact-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 2px 4px;
    border-radius: 6px;
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: -4px;
}

.profile-compact-selector:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--color-text-primary);
}

[data-theme='dark'] .profile-compact-selector:hover {
    background: rgba(255, 255, 255, 0.08);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.profile-compact-selector #profile-display {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-compact-selector .chevron-icon {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

/* Profile Dropdown Refinement */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 280px;
    background: var(--color-white);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    overflow: hidden;
    transform-origin: top right;
    animation: dropdownPop 0.2s ease-out;
}

@keyframes dropdownPop {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-8px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

[data-theme='dark'] .profile-dropdown {
    background: var(--color-surface-elevated);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.profile-dropdown-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 8px;
}

.profile-dropdown-empty {
    padding: 30px 10px;
    text-align: center;
    color: var(--color-text-tertiary);
}

.profile-dropdown-empty p {
    font-size: 13px;
    font-weight: 500;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 2px;
}

.profile-dropdown-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme='dark'] .profile-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.profile-dropdown-item.active {
    background: var(--color-primary-50);
}

[data-theme='dark'] .profile-dropdown-item.active {
    background: rgba(255, 1, 51, 0.15);
}

.profile-item-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}


.profile-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme='dark'] .profile-item-name {
    color: #ffffff;
}

.profile-item-actions {
    display: flex;
    gap: 4px;
}

.profile-action-icon {
    background: none;
    border: none;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--color-text-tertiary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-action-icon:hover:not(:disabled) {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

[data-theme='dark'] .profile-action-icon:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.profile-action-icon i {
    width: 16px;
    height: 16px;
}

.profile-dropdown-actions {
    padding: 10px;
    background: rgba(0, 0, 0, 0.02);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme='dark'] .profile-dropdown-actions {
    background: rgba(255, 255, 255, 0.02);
    border-top-color: rgba(255, 255, 255, 0.05);
}

.profile-action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: none;
    border: 1px dashed var(--color-border-medium);
    border-radius: 10px;
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.default-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border-medium);
    border-radius: 6px;
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 600;
    user-select: none;
}

[data-theme='dark'] .default-badge {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--color-text-tertiary);
}

.profile-action-btn:hover:not(:disabled) {
    background: var(--color-bg-tertiary);
    border-color: var(--color-text-secondary);
    color: var(--color-text-primary);
    border-style: solid;
}

[data-theme='dark'] .profile-action-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--color-text-primary);
    color: #ffffff;
}

/* Main Chat Container */
.script-chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: var(--color-bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.chat-main-area {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-primary);
    overflow: hidden;
}

/* Responsive Layout */
@media (max-width: 1024px) {
    .profile-header-selector {
        gap: var(--space-2);
    }
}

@media (max-width: 768px) {
    .profile-header-selector {
        gap: var(--space-2);
    }

    .profile-compact-selector {
        font-size: 11px;
    }

    .profile-channel-thumb {
        width: 36px;
        height: 36px;
    }
}