:root {
    --blue-1: #190482;
    --blue-2: #7752FE;
    --blue-3: #8E8FFA;
    --blue-4: #C2D9FF;
    --accent-teal: #00BCD4;
    --accent-teal-light: #4DD0E1;
    --accent-teal-dark: #00ACC1;
    --gradient-main: linear-gradient(135deg, var(--blue-1) 0%, var(--blue-2) 100%);
    --gradient-accent: linear-gradient(135deg, var(--accent-teal) 0%, var(--accent-teal-light) 100%);
    --gradient-soft: linear-gradient(135deg, rgba(25, 4, 130, 0.95) 0%, rgba(119, 82, 254, 0.85) 50%, rgba(142, 143, 250, 0.75) 100%);
    --gradient-subtle: linear-gradient(145deg, rgba(194, 217, 255, 0.03) 0%, rgba(119, 82, 254, 0.02) 100%);
    --gradient-analytics: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
    --text-primary: #ffffff;
    --text-secondary: #C2D9FF;
    --text-muted: #8E8FFA;
    --bg-primary: #0a0340;
    --bg-secondary: rgba(25, 4, 130, 0.4);
    --bg-card: rgba(194, 217, 255, 0.02);
    --bg-header: rgba(15, 3, 50, 0.95);
    --border-primary: rgba(194, 217, 255, 0.15);
    --border-soft: rgba(142, 143, 250, 0.1);
    --shadow: 0 4px 6px -1px rgba(10, 3, 64, 0.3);
    --shadow-lg: 0 20px 25px -5px rgba(10, 3, 64, 0.4);
    --shadow-glow: 0 0 20px rgba(119, 82, 254, 0.3);
    --shadow-teal: 0 0 20px rgba(0, 188, 212, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    width: 100%;
    max-width: 320px;
    height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    margin: 0 auto;
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.header {
    background: var(--bg-header);
    padding: 2px 2px 2px;
    position: relative;
}

.brand {
    position: relative;
    z-index: 2;
    text-align: center;
}

.brand h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.025em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.logo-image {
    width: 100px;
    height: auto;
    max-height: 32px;
    object-fit: contain;
    display: none;
}

.nav {
    background: rgba(25, 4, 130, 0.15);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-soft);
    padding: 8px 4px;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    position: relative;
    justify-content: center;
}

.nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(194, 217, 255, 0.2) 20%, 
        rgba(194, 217, 255, 0.4) 50%, 
        rgba(194, 217, 255, 0.2) 80%, 
        transparent 100%);
    opacity: 0.6;
}

.nav::-webkit-scrollbar {
    display: none;
}

.nav-item {
    flex: 1;
    padding: 10px 6px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    min-width: 60px;
    position: relative;
    backdrop-filter: blur(10px);
}

.nav-item.active {
    background: rgba(194, 217, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid rgba(194, 217, 255, 0.2);
    box-shadow: 0 4px 12px rgba(119, 82, 254, 0.15);
    transform: translateY(-1px);
}

.nav-item:hover:not(.active) {
    background: rgba(142, 143, 250, 0.05);
    color: var(--text-secondary);
    transform: translateY(-1px);
}

.nav-item svg {
    width: 16px;
    height: 16px;
    margin: 0 auto 4px;
    display: block;
    fill: currentColor;
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-primary) transparent;
}

.agent-panel {
    display: none;
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.agent-panel.active {
    display: block;
}

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

.agent-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    backdrop-filter: blur(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.agent-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-subtle);
    border-radius: 16px;
    opacity: 0.5;
    transition: opacity 0.4s ease;
}

.agent-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    border-color: rgba(194, 217, 255, 0.25);
}

.agent-card:hover::before {
    opacity: 0.8;
}

.agent-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
}

.agent-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--blue-2);
}

.agent-avatar svg {
    width: 18px;
    height: 18px;
}

.agent-info {
    position: relative;
    z-index: 2;
}

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

.agent-info p {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.form-group {
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
}

.label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.025em;
}

.input, .textarea, .select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.input:focus, .textarea:focus, .select:focus {
    outline: none;
    border-color: var(--accent-teal);
    background: rgba(25, 4, 130, 0.6);
    box-shadow: 0 0 0 3px rgba(0, 188, 212, 0.1);
    transform: translateY(-1px);
}

.input::placeholder, .textarea::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

.select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238E8FFA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    cursor: pointer;
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    transition: all 0.3s ease;
    accent-color: var(--blue-2);
    position: relative;
    appearance: none;
    cursor: pointer;
}

input[type="checkbox"]:checked {
    background: var(--blue-2);
    border-color: var(--blue-2);
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: var(--blue-3);
    border-radius: 50%;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 12px 0;
}

.template-option {
    aspect-ratio: 1.1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.template-option::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(119, 82, 254, 0.1) 0%, rgba(194, 217, 255, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.template-option.selected {
    border-color: var(--accent-teal);
    background: rgba(0, 188, 212, 0.08);
    transform: scale(1.02);
}

.template-option.selected::before {
    background: linear-gradient(135deg, rgba(0, 188, 212, 0.1) 0%, rgba(77, 208, 225, 0.05) 100%);
    opacity: 0.3;
}

.template-option:hover:not(.selected) {
    border-color: var(--blue-3);
    transform: translateY(-1px);
}

.template-content {
    position: relative;
    z-index: 2;
}

.template-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 8px;
    fill: var(--blue-2);
}

.template-option.selected .template-icon {
    fill: var(--accent-teal);
}

.template-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.upload-zone {
    border: 2px dashed var(--border-primary);
    border-radius: 16px;
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.upload-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(142, 143, 250, 0.1) 0%, rgba(194, 217, 255, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent-teal);
    background: rgba(0, 188, 212, 0.05);
    transform: translateY(-1px);
}

.upload-zone:hover::before, .upload-zone.dragover::before {
    background: linear-gradient(135deg, rgba(0, 188, 212, 0.1) 0%, rgba(77, 208, 225, 0.05) 100%);
    opacity: 0.3;
}

.upload-content {
    position: relative;
    z-index: 2;
}

.upload-icon {
    width: 32px;
    height: 32px;
    margin: 0 auto 12px;
    fill: var(--blue-2);
    opacity: 0.8;
}

.upload-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upload-subtext {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
}

.btn {
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    letter-spacing: -0.025em;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--gradient-main);
    color: white;
    border: 1px solid rgba(119, 82, 254, 0.3);
    border-left: 3px solid var(--blue-2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(119, 82, 254, 0.08);
    border-color: var(--blue-2);
    transform: translateY(-1px);
}

.btn-block {
    width: 100%;
}

.btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    position: relative;
    z-index: 2;
}

.btn span {
    position: relative;
    z-index: 2;
}

.platform-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 12px 0;
}

.platform-option {
    aspect-ratio: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    font-size: 9px;
    color: var(--text-muted);
    font-weight: 500;
    padding: 8px;
}

.platform-option:hover {
    border-color: var(--blue-3);
    background: rgba(142, 143, 250, 0.05);
    transform: translateY(-1px);
}

.platform-option.selected {
    border-color: var(--accent-teal);
    background: rgba(0, 188, 212, 0.1);
    color: var(--text-primary);
}

.platform-icon {
    width: 18px;
    height: 18px;
    margin-bottom: 4px;
    fill: currentColor;
}

.progress-container {
    margin: 16px 0;
    display: none;
}

.progress-container.show {
    display: block;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.progress-bar {
    height: 8px;
    background: rgba(194, 217, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-primary);
}

.progress-fill {
    height: 100%;
    background: var(--gradient-accent);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 12px 0;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    backdrop-filter: blur(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--blue-2);
    box-shadow: var(--shadow-lg);
}

.stat-number {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--blue-4) 0%, var(--blue-2) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
    line-height: 1.2;
}

.stat-label {
    font-size: 9px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.success-toast {
    position: fixed;
    top: 16px;
    right: 16px;
    background: var(--gradient-accent);
    color: white;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    display: none;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    box-shadow: var(--shadow-teal);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.success-toast.show {
    display: flex;
    transform: translateX(0);
}

.success-toast svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.chat-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    height: 200px;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    margin-bottom: 16px;
}

.chat-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-primary) transparent;
}

.chat-message {
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.4;
    font-weight: 500;
    animation: messageSlide 0.3s ease-out;
}

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

.chat-message.ai {
    background: rgba(119, 82, 254, 0.1);
    color: var(--text-secondary);
    margin-right: 16px;
    border: 1px solid rgba(119, 82, 254, 0.2);
}

.chat-message.user {
    background: rgba(0, 188, 212, 0.1);
    color: var(--text-primary);
    margin-left: 16px;
    text-align: right;
    border: 1px solid rgba(0, 188, 212, 0.2);
}

.chat-input-container {
    padding: 12px;
    border-top: 1px solid var(--border-primary);
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 500;
    padding: 8px 0;
}

.chat-input:focus {
    outline: none;
}

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

.chat-send {
    background: var(--gradient-main);
    border: none;
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.chat-send svg {
    width: 12px;
    height: 12px;
    fill: white;
}

.quick-action-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    backdrop-filter: blur(10px);
    padding: 12px 16px;
    text-align: left;
    justify-content: flex-start;
}

.quick-action-btn:hover {
    background: rgba(119, 82, 254, 0.08);
    border-color: var(--blue-2);
    transform: translateY(-1px);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (max-width: 300px) {
    .template-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .platform-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .nav-item {
        font-size: 9px;
        padding: 8px 4px;
    }
    
    .nav-item svg {
        width: 14px;
        height: 14px;
    }
}