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

:root {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #050505;
    --purple-primary: #7c3aed;
    --purple-secondary: #8b5cf6;
    --purple-dark: #4c1d95;
    --purple-darker: #2e1065;
    --purple-light: #a78bfa;
    --purple-lighter: #c4b5fd;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #2e1065;
    --error-color: #dc2626;
    --success-color: #10b981;
    --warning-color: #f59e0b;
}

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: flex;
}

/* Login Screen */
.login-container {
    margin: auto;
    padding: 3rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
}

.logo-container {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    width: 120px;
    height: 120px;
    margin-bottom: 1rem;
}

.logo-small {
    width: 120px;
    height: 120px;
}

.login-container h1 {
    font-size: 1.75rem;
    color: var(--purple-light);
    margin-bottom: 0.5rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-group input {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--purple-primary);
}

.btn-primary {
    padding: 0.875rem 1.5rem;
    background: var(--purple-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

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

.btn-primary:disabled {
    background: var(--purple-darker);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    padding: 0.75rem 1.25rem;
    background: var(--bg-primary);
    color: var(--purple-light);
    border: 1px solid var(--purple-dark);
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--purple-darker);
}

.btn-danger {
    padding: 0.75rem 1.25rem;
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.error-message {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: none;
}

.error-message.show {
    display: block;
}

.success-message {
    color: #10b981;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: none;
    padding: 0.75rem;
    background-color: rgba(16, 185, 129, 0.1);
    border-radius: 0.375rem;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.success-message.show {
    display: block;
}

.form-title {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.form-switch {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.form-switch a {
    color: var(--purple-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.form-switch a:hover {
    color: var(--purple-light);
    text-decoration: underline;
}

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

.sidebar {
    width: 320px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sidebar-header {
    text-align: center;
}

.sidebar-header h2 {
    color: var(--purple-light);
    font-size: 1.25rem;
    margin-top: 1rem;
}

.stats-panel {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.stats-panel h3 {
    color: var(--purple-light);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.stats-panel p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.stats-panel span {
    color: var(--text-primary);
    font-weight: 600;
}

/* Dev Notes Panel */
.dev-notes-panel {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-top: 1rem;
    max-height: 450px;
    overflow-y: auto;
}

.dev-notes-panel h3 {
    color: var(--purple-light);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.dev-section {
    margin-bottom: 0;
    padding-bottom: 1rem;
}

.dev-section:first-child {
    border-bottom: 2px solid var(--purple-dark);
    margin-bottom: 1rem;
}

.dev-section:last-child {
    padding-bottom: 0;
}

.dev-section h4 {
    color: var(--purple-lighter);
    font-size: 0.7rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.dev-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dev-list li {
    color: var(--text-secondary);
    font-size: 0.7rem;
    line-height: 1.5;
    margin-bottom: 0.4rem;
    padding-left: 0.9rem;
    position: relative;
}

.dev-list li::before {
    content: "•";
    color: var(--purple);
    font-weight: bold;
    position: absolute;
    left: 0;
    font-size: 0.8rem;
}

.dev-section:first-child .dev-list li::before {
    content: "✓";
    color: var(--success-color);
    font-size: 0.7rem;
}

.dev-section:last-child .dev-list li::before {
    content: "⋯";
    color: var(--warning-color);
    font-size: 0.9rem;
}

.how-to-list {
    counter-reset: item;
}

.how-to-list li::before {
    content: counter(item) ".";
    counter-increment: item;
    color: var(--purple-primary);
    font-size: 0.75rem;
}

.user-info {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.user-info p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 4rem 3rem;
    overflow-y: auto;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.content-header h1 {
    font-size: 2rem;
    color: var(--text-primary);
}

.api-config {
    display: flex;
    gap: 1rem;
}

.input-field {
    padding: 0.625rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.input-field:focus {
    outline: none;
    border-color: var(--purple-primary);
}

/* Input Section */
.input-section {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.input-section h2 {
    color: var(--purple-light);
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.url-textarea {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    resize: vertical;
    margin-bottom: 1rem;
}

.url-textarea:focus {
    outline: none;
    border-color: var(--purple-primary);
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

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

#progressText {
    color: var(--text-secondary);
    font-size: 0.875rem;
    min-width: 40px;
}


/* Stats Container */
.stats-container {
    display: flex;
    gap: 3rem;
    margin-bottom: 1.5rem;
    background: var(--bg-tertiary);
    padding: 1.25rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--purple-primary);
    line-height: 1.1;
}

/* Results Section */
.results-section {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.results-section h2 {
    color: var(--purple-light);
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.results-container {
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.result-item {
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.result-item:hover {
    border-color: var(--purple-primary);
    background: var(--bg-primary);
}

.result-item.has-video {
    border-left: 3px solid var(--purple-primary);
}

.result-item.no-video {
    opacity: 0.6;
}

.result-url {
    color: var(--purple-lighter);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    word-break: break-all;
}

.result-meta {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 1200px;
    width: 95%;
    max-height: 95vh;
}

.close {
    color: var(--text-secondary);
    float: right;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: var(--text-primary);
}

#modalTitle {
    color: var(--purple-light);
    margin-bottom: 1.5rem;
}

#modalBody {
    margin-bottom: 2rem;
}

.video-source {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    word-break: break-all;
    font-size: 0.875rem;
    color: var(--purple-lighter);
}

/* Feedback Section */
.feedback-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.feedback-section h3 {
    color: var(--purple-light);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.star-rating {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.star {
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.star:hover,
.star.active {
    color: var(--purple-primary);
}

.feedback-textarea {
    width: 100%;
    min-height: 100px;
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    margin-bottom: 1rem;
}

.feedback-textarea:focus {
    outline: none;
    border-color: var(--purple-primary);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--purple-darker);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--purple-dark);
}

/* Asset Tabs */
.asset-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 1.5rem 0 1rem 0;
    border-bottom: 2px solid var(--border-color);
}

.asset-tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

.asset-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(139, 92, 246, 0.1);
}

.asset-tab-btn.active {
    color: var(--purple);
    border-bottom-color: var(--purple);
}

.asset-content {
    margin-top: 1rem;
}

.asset-tab-content {
    display: none;
}

.asset-tab-content.active {
    display: block;
}

.code-header,
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px 8px 0 0;
    border: 1px solid var(--border-color);
    border-bottom: none;
}

.code-header span,
.preview-header span {
    font-weight: 600;
    color: var(--text-primary);
}

.copy-btn {
    padding: 0.4rem 1rem;
    background: var(--purple);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: var(--purple-dark);
}

.copy-btn:active {
    transform: scale(0.95);
}

.code-block {
    display: block;
    padding: 1.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0 0 8px 8px;
    color: var(--text-primary);
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 500px;
    overflow-y: auto;
}

.preview-iframe {
    width: 100%;
    height: 600px;
    border: 1px solid var(--border-color);
    border-radius: 0 0 8px 8px;
    background: white;
}

/* Home Screen Styles */
.home-container {
    min-height: 100vh;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
}

.home-header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 2rem 3rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.home-header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.home-logo-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.home-logo-section h1 {
    font-size: 1.75rem;
    color: var(--purple-light);
    margin: 0;
    font-weight: 700;
    background: linear-gradient(135deg, var(--purple-light) 0%, var(--purple-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.home-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0.25rem 0 0 0;
}

.home-user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.home-user-email {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Main Tools Section */
.home-main {
    flex: 1;
    padding: 3rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.tools-header {
    text-align: center;
    margin-bottom: 3rem;
}

.tools-header h2 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-weight: 700;
}

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

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    align-items: start;
    max-width: 1400px;
    margin: 0 auto;
}

@media (max-width: 1400px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }
}

/* Tool Card */
.tool-card {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(10, 10, 10, 0.8) 100%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 380px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.05) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tool-card:hover::before {
    opacity: 1;
}

.tool-card:hover {
    border-color: var(--purple-primary);
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(124, 58, 237, 0.2);
}

.tool-card-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tool-card-disabled:hover {
    transform: none;
    border-color: var(--border-color);
    box-shadow: none;
}

.tool-card-disabled:hover::before {
    opacity: 0;
}

/* Tool Card Header */
.tool-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tool-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--purple-primary) 0%, var(--purple-secondary) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
}

.tool-card:hover .tool-icon {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
}

.disabled-icon {
    background: linear-gradient(135deg, var(--purple-darker) 0%, var(--bg-tertiary) 100%);
}

.tool-card-disabled:hover .disabled-icon {
    transform: none;
    box-shadow: none;
}

.tool-status-badge {
    padding: 0.4rem 0.875rem;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.coming-soon {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-color);
    border-color: rgba(245, 158, 11, 0.3);
}

/* Tool Card Content */
.tool-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tool-card-content h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0;
    font-weight: 700;
}

.tool-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.tool-features {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tool-features li {
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding-left: 1.5rem;
    position: relative;
}

.tool-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--purple-primary);
    font-weight: bold;
    font-size: 0.875rem;
}

/* Tool Card Footer */
.tool-card-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.tool-launch-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--purple-primary) 0%, var(--purple-secondary) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tool-launch-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
}

.tool-launch-btn:active {
    transform: scale(0.98);
}

.tool-launch-btn:disabled {
    background: var(--purple-darker);
    cursor: not-allowed;
    opacity: 0.5;
}

.tool-launch-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

.tool-launch-btn svg {
    transition: transform 0.3s ease;
}

.tool-launch-btn:hover svg {
    transform: translateX(4px);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

@media (max-width: 768px) {
    .home-header {
        padding: 1.5rem;
    }

    .home-header-content {
        flex-direction: column;
        gap: 1.5rem;
        align-items: flex-start;
    }

    .home-logo-section h1 {
        font-size: 1.5rem;
    }

    .home-main {
        padding: 2rem 1.5rem;
    }

    .tools-header h2 {
        font-size: 2rem;
    }

    .tools-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .tool-card {
        padding: 1.5rem;
    }
}