/**
 * MuseSecure Pro Frontend - Claude.ai Inspired Design
 * Professional, clean, modern interface
 */

/* ============================================
   CSS Variables - Claude.ai Color System
   ============================================ */
:root {
    /* Primary Colors */
    --musepro-primary: #2B6CB0;
    --musepro-primary-hover: #2C5282;
    --musepro-primary-light: #EBF8FF;

    /* Neutral Colors */
    --musepro-bg: #FFFFFF;
    --musepro-bg-secondary: #F7FAFC;
    --musepro-bg-tertiary: #EDF2F7;
    --musepro-border: #E2E8F0;
    --musepro-border-light: #F0F4F8;

    /* Text Colors */
    --musepro-text-primary: #1A202C;
    --musepro-text-secondary: #4A5568;
    --musepro-text-tertiary: #718096;
    --musepro-text-placeholder: #A0AEC0;

    /* Semantic Colors */
    --musepro-success: #38A169;
    --musepro-success-light: #C6F6D5;
    --musepro-warning: #DD6B20;
    --musepro-warning-light: #FEEBC8;
    --musepro-error: #E53E3E;
    --musepro-error-light: #FED7D7;
    --musepro-info: #3182CE;
    --musepro-info-light: #BEE3F8;

    /* Spacing */
    --musepro-radius: 12px;
    --musepro-radius-sm: 8px;
    --musepro-radius-lg: 16px;

    /* Shadows */
    --musepro-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --musepro-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --musepro-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.05);
    --musepro-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);

    /* Typography */
    --musepro-font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    --musepro-font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', 'Courier New', monospace;
}

/* ============================================
   Reset & Base Styles
   ============================================ */
.musepro-app,
.musepro-app * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.musepro-app {
    font-family: var(--musepro-font-sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--musepro-text-primary);
    background: var(--musepro-bg-secondary);
    min-height: 100vh;
    display: flex;
}

/* ============================================
   Sidebar Navigation (Claude.ai style)
   ============================================ */
.musepro-sidebar {
    width: 260px;
    background: var(--musepro-bg);
    border-right: 1px solid var(--musepro-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
}

.musepro-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    border-bottom: 1px solid var(--musepro-border);
}

.musepro-logo-icon {
    font-size: 28px;
    line-height: 1;
}

.musepro-logo-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--musepro-text-primary);
}

.musepro-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.musepro-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--musepro-radius-sm);
    color: var(--musepro-text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.musepro-nav-item:hover {
    background: var(--musepro-bg-secondary);
    color: var(--musepro-text-primary);
}

.musepro-nav-item.active {
    background: var(--musepro-primary-light);
    color: var(--musepro-primary);
}

.musepro-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.musepro-sidebar-footer {
    border-top: 1px solid var(--musepro-border);
    padding: 16px;
}

.musepro-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.musepro-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--musepro-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

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

.musepro-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--musepro-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.musepro-user-email {
    font-size: 12px;
    color: var(--musepro-text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   Main Content Area
   ============================================ */
.musepro-main {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}

.musepro-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 32px;
}

/* ============================================
   Headers
   ============================================ */
.musepro-header {
    margin-bottom: 40px;
}

.musepro-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--musepro-text-primary);
    margin-bottom: 8px;
}

.musepro-subtitle {
    font-size: 16px;
    color: var(--musepro-text-secondary);
    margin: 0;
}

/* ============================================
   Cards
   ============================================ */
.musepro-card {
    background: var(--musepro-bg);
    border: 1px solid var(--musepro-border);
    border-radius: var(--musepro-radius);
    box-shadow: var(--musepro-shadow-sm);
    margin-bottom: 24px;
}

.musepro-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--musepro-border);
}

.musepro-card-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--musepro-text-primary);
    margin: 0;
}

.musepro-card-body {
    padding: 24px;
}

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

.musepro-screenplay-card {
    background: var(--musepro-bg);
    border: 1px solid var(--musepro-border);
    border-radius: var(--musepro-radius);
    padding: 24px;
    transition: all 0.2s;
    cursor: pointer;
}

.musepro-screenplay-card:hover {
    box-shadow: var(--musepro-shadow-md);
    transform: translateY(-2px);
}

.musepro-screenplay-card.disabled {
    opacity: 0.6;
    cursor: default;
}

.musepro-screenplay-card.disabled:hover {
    box-shadow: var(--musepro-shadow-sm);
    transform: none;
}

.musepro-card-icon {
    font-size: 40px;
    margin-bottom: 16px;
}

.musepro-card-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--musepro-text-primary);
    margin-bottom: 8px;
}

.musepro-card-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--musepro-text-tertiary);
}

/* ============================================
   Buttons
   ============================================ */
.musepro-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--musepro-radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--musepro-font-sans);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

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

.musepro-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.musepro-btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.musepro-btn-text {
    background: transparent;
    color: var(--musepro-primary);
    border: 1px solid transparent;
    padding: 6px 12px;
}

.musepro-btn-text:hover {
    background: var(--musepro-primary-light);
}

/* ============================================
   Forms
   ============================================ */
.musepro-form-group {
    margin-bottom: 24px;
}

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

.musepro-input,
.musepro-textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: var(--musepro-font-sans);
    color: var(--musepro-text-primary);
    background: var(--musepro-bg);
    border: 1px solid var(--musepro-border);
    border-radius: var(--musepro-radius-sm);
    transition: all 0.2s;
}

.musepro-input:focus,
.musepro-textarea:focus {
    outline: none;
    border-color: var(--musepro-primary);
    box-shadow: 0 0 0 3px var(--musepro-primary-light);
}

.musepro-textarea {
    resize: vertical;
}

.musepro-help {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--musepro-text-tertiary);
}

.musepro-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.musepro-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ============================================
   Upload Zone
   ============================================ */
.musepro-upload-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.musepro-upload-zone {
    border: 2px dashed var(--musepro-border);
    border-radius: var(--musepro-radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 24px;
}

.musepro-upload-zone:hover {
    border-color: var(--musepro-primary);
    background: var(--musepro-primary-light);
}

.musepro-upload-zone.dragging {
    border-color: var(--musepro-primary);
    background: var(--musepro-primary-light);
}

.musepro-upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: var(--musepro-text-tertiary);
}

.musepro-upload-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--musepro-text-primary);
    margin-bottom: 8px;
}

.musepro-upload-content p {
    color: var(--musepro-text-secondary);
    margin: 0;
}

.musepro-upload-progress {
    padding: 24px;
}

.musepro-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--musepro-bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.musepro-progress-fill {
    height: 100%;
    background: var(--musepro-primary);
    transition: width 0.3s;
}

.musepro-upload-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ============================================
   Info Card
   ============================================ */
.musepro-info-card {
    background: var(--musepro-bg-secondary);
    border: 1px solid var(--musepro-border);
    border-radius: var(--musepro-radius);
    padding: 24px;
}

.musepro-info-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--musepro-text-primary);
    margin-bottom: 16px;
}

.musepro-info-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.musepro-info-card li {
    padding: 8px 0;
    color: var(--musepro-text-secondary);
    font-size: 14px;
}

.musepro-info-card li::before {
    content: '•';
    color: var(--musepro-primary);
    font-weight: bold;
    margin-right: 8px;
}

/* ============================================
   Messages
   ============================================ */
.musepro-message {
    padding: 14px 18px;
    border-radius: var(--musepro-radius-sm);
    margin-top: 16px;
    font-size: 14px;
}

.musepro-message.success {
    background: var(--musepro-success-light);
    color: var(--musepro-success);
    border: 1px solid var(--musepro-success);
}

.musepro-message.error {
    background: var(--musepro-error-light);
    color: var(--musepro-error);
    border: 1px solid var(--musepro-error);
}

.musepro-message.info {
    background: var(--musepro-info-light);
    color: var(--musepro-info);
    border: 1px solid var(--musepro-info);
}

/* ============================================
   Badges
   ============================================ */
.musepro-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.musepro-badge-warning {
    background: var(--musepro-warning-light);
    color: var(--musepro-warning);
}

/* ============================================
   Empty States
   ============================================ */
.musepro-empty {
    text-align: center;
    padding: 80px 24px;
}

.musepro-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    color: var(--musepro-text-tertiary);
}

.musepro-empty-icon svg {
    width: 100%;
    height: 100%;
}

.musepro-empty h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--musepro-text-primary);
    margin-bottom: 12px;
}

.musepro-empty p {
    font-size: 16px;
    color: var(--musepro-text-secondary);
    margin-bottom: 24px;
}

/* ============================================
   Analysis Workspace (Claude.ai Chat Style)
   ============================================ */
.musepro-analysis-workspace {
    display: grid;
    grid-template-columns: 1fr 500px;
    gap: 0;
    height: calc(100vh - 0px);
    position: fixed;
    left: 260px;
    right: 0;
    top: 0;
    bottom: 0;
}

.musepro-chat-container {
    display: flex;
    flex-direction: column;
    background: var(--musepro-bg);
    border-right: 1px solid var(--musepro-border);
}

.musepro-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--musepro-border);
}

.musepro-chat-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--musepro-text-primary);
    margin: 0;
}

.musepro-chat-subtitle {
    font-size: 13px;
    color: var(--musepro-text-tertiary);
    margin: 4px 0 0 0;
}

.musepro-zdr-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--musepro-success-light);
    color: var(--musepro-success);
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
}

.musepro-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.musepro-chat-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.musepro-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--musepro-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.musepro-chat-message-user .musepro-message-avatar {
    background: var(--musepro-text-tertiary);
}

.musepro-message-content {
    flex: 1;
    font-size: 15px;
    line-height: 1.6;
    color: var(--musepro-text-primary);
}

.musepro-message-content p {
    margin: 0 0 12px 0;
}

.musepro-message-content p:last-child {
    margin-bottom: 0;
}

.musepro-message-content ol,
.musepro-message-content ul {
    margin: 12px 0;
    padding-left: 24px;
}

.musepro-message-content li {
    margin: 6px 0;
}

.musepro-chat-input-container {
    border-top: 1px solid var(--musepro-border);
    padding: 16px 24px;
    background: var(--musepro-bg);
}

.musepro-selection-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: var(--musepro-primary-light);
    border-radius: var(--musepro-radius-sm);
}

.musepro-selection-badge {
    font-size: 13px;
    font-weight: 600;
    color: var(--musepro-primary);
}

.musepro-analysis-types {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.musepro-analysis-type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--musepro-bg-secondary);
    border: 1px solid var(--musepro-border);
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--musepro-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.musepro-analysis-type:hover {
    background: var(--musepro-primary-light);
    border-color: var(--musepro-primary);
    color: var(--musepro-primary);
}

.musepro-type-icon {
    font-size: 14px;
}

.musepro-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.musepro-chat-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
    font-family: var(--musepro-font-sans);
    color: var(--musepro-text-primary);
    background: var(--musepro-bg);
    border: 1px solid var(--musepro-border);
    border-radius: var(--musepro-radius-sm);
    resize: none;
    transition: all 0.2s;
    max-height: 200px;
}

.musepro-chat-input:focus {
    outline: none;
    border-color: var(--musepro-primary);
    box-shadow: 0 0 0 3px var(--musepro-primary-light);
}

.musepro-send-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--musepro-primary);
    color: white;
    border: none;
    border-radius: var(--musepro-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.musepro-send-btn:hover {
    background: var(--musepro-primary-hover);
}

.musepro-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   Screenplay Viewer
   ============================================ */
.musepro-screenplay-viewer {
    display: flex;
    flex-direction: column;
    background: var(--musepro-bg-secondary);
}

.musepro-viewer-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--musepro-border);
    background: var(--musepro-bg);
}

.musepro-viewer-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--musepro-text-primary);
    margin: 0 0 4px 0;
}

.musepro-viewer-header p {
    font-size: 13px;
    color: var(--musepro-text-tertiary);
    margin: 0;
}

.musepro-viewer-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.musepro-screenplay-text {
    font-family: var(--musepro-font-mono);
    font-size: 13px;
    line-height: 1.8;
    color: var(--musepro-text-primary);
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.musepro-screenplay-text::selection {
    background: #FEF08A;
    color: #000;
}

/* ============================================
   List View
   ============================================ */
.musepro-screenplay-list {
    max-width: 800px;
}

.musepro-list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--musepro-bg);
    border: 1px solid var(--musepro-border);
    border-radius: var(--musepro-radius);
    margin-bottom: 12px;
    text-decoration: none;
    transition: all 0.2s;
}

.musepro-list-item:hover {
    box-shadow: var(--musepro-shadow-md);
    transform: translateY(-2px);
}

.musepro-list-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.musepro-list-content {
    flex: 1;
    min-width: 0;
}

.musepro-list-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--musepro-text-primary);
    margin: 0 0 4px 0;
}

.musepro-list-content p {
    font-size: 14px;
    color: var(--musepro-text-secondary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.musepro-list-arrow {
    width: 20px;
    height: 20px;
    color: var(--musepro-text-tertiary);
    flex-shrink: 0;
}

/* ============================================
   Auth Container
   ============================================ */
.musepro-auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--musepro-bg-secondary);
}

.musepro-auth-card {
    width: 100%;
    max-width: 400px;
    padding: 48px;
    background: var(--musepro-bg);
    border: 1px solid var(--musepro-border);
    border-radius: var(--musepro-radius-lg);
    box-shadow: var(--musepro-shadow-lg);
    text-align: center;
}

.musepro-logo-large {
    margin-bottom: 32px;
}

.musepro-logo-large .musepro-logo-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.musepro-logo-large h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--musepro-text-primary);
    margin: 0;
}

.musepro-auth-card p {
    color: var(--musepro-text-secondary);
    margin-bottom: 24px;
}

/* ============================================
   Settings Layout
   ============================================ */
.musepro-settings-container {
    max-width: 800px;
}

.musepro-settings-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ============================================
   Loading States
   ============================================ */
.musepro-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--musepro-text-secondary);
}

.musepro-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--musepro-border);
    border-top-color: var(--musepro-primary);
    border-radius: 50%;
    animation: musepro-spin 0.8s linear infinite;
}

@keyframes musepro-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
    .musepro-analysis-workspace {
        grid-template-columns: 1fr;
    }

    .musepro-screenplay-viewer {
        display: none;
    }

    .musepro-upload-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .musepro-sidebar {
        transform: translateX(-100%);
    }

    .musepro-main {
        margin-left: 0;
    }

    .musepro-content {
        padding: 24px 16px;
    }

    .musepro-header h1 {
        font-size: 24px;
    }

    .musepro-screenplay-grid {
        grid-template-columns: 1fr;
    }

    .musepro-analysis-workspace {
        left: 0;
    }
}
