/* PPT Master Web App - Enhanced Dark Theme */

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.3);
    --bg: #09090b;
    --surface: #18181b;
    --surface-hover: #27272a;
    --border: #27272a;
    --border-light: #3f3f46;
    --text: #fafafa;
    --text-muted: #a1a1aa;
    --text-dim: #71717a;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background Decoration */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
}

.bg-gradient-1 {
    position: absolute;
    top: -20%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    opacity: 0.5;
    animation: float 20s ease-in-out infinite;
}

.bg-gradient-2 {
    position: absolute;
    bottom: -20%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.15) 0%, transparent 70%);
    opacity: 0.5;
    animation: float 25s ease-in-out infinite reverse;
}

.bg-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 60px 60px;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, -30px); }
}

/* Header */
.header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: blur(20px);
}

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

.logo-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 12px;
    color: white;
    box-shadow: 0 4px 16px var(--primary-glow);
}

.logo-icon svg {
    width: 28px;
    height: 28px;
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text), var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 2px;
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.badge-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* Main */
.main {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

/* Views */
.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

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

/* Card */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
}

.card-header {
    margin-bottom: 32px;
}

.card-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.card-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Form Sections */
.form-section {
    margin-bottom: 28px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: none;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 20px;
}

.section-title svg {
    color: var(--primary);
}

.optional-badge {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-dim);
    background: var(--border);
    padding: 2px 8px;
    border-radius: 100px;
    margin-left: auto;
}

.required {
    color: var(--error);
    font-weight: 600;
}

/* Form Layout */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 8px;
}

.label-hint {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 400;
}

input[type="text"],
input[type="number"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s;
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--border-light);
}

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

textarea {
    resize: vertical;
    min-height: 80px;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg);
}

.drop-zone:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.01);
}

.drop-zone-content {
    color: var(--text-muted);
}

.drop-zone-content svg {
    margin-bottom: 12px;
    opacity: 0.5;
    color: var(--primary);
}

.drop-zone-content p {
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.browse-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.browse-link:hover {
    text-decoration: underline;
}

.drop-hint {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 8px;
}

/* File List */
.file-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.file-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border-radius: 8px;
    color: var(--primary);
    flex-shrink: 0;
}

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

.file-name {
    color: var(--text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    color: var(--text-dim);
    font-size: 0.8rem;
}

.file-remove {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.file-remove:hover {
    background: var(--error);
    color: white;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px var(--primary-glow);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--border-light);
}

.btn-large {
    padding: 16px 32px;
    font-size: 1rem;
}

.btn-create {
    width: 100%;
    padding: 16px;
    font-size: 1rem;
}

.btn-text, .btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Confirmations Grid */
.confirm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 32px;
}

.confirm-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.confirm-item label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.confirm-colors {
    grid-column: 1 / -1;
}

.color-grid {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.color-field {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.color-field label {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: none;
    letter-spacing: normal;
}

.color-field input[type="color"] {
    width: 56px;
    height: 44px;
    padding: 4px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.color-field input[type="color"]:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

.form-actions {
    display: flex;
    justify-content: center;
}

/* Progress */
.progress-container {
    margin-bottom: 24px;
}

.progress-bar {
    height: 12px;
    background: var(--bg);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 6px;
    width: 0%;
    transition: width 0.5s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.2) 50%,
        transparent 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-text {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.progress-percent {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
}

.progress-log {
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    font-family: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.8;
}

.progress-log::-webkit-scrollbar {
    width: 6px;
}

.progress-log::-webkit-scrollbar-track {
    background: transparent;
}

.progress-log::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.log-entry {
    color: var(--text-dim);
    padding: 2px 0;
}

.log-entry.success {
    color: var(--success);
}

.log-entry.error {
    color: var(--error);
}

.log-entry.info {
    color: var(--primary-light);
}

/* Download */
.download-content {
    text-align: center;
    padding: 40px 0;
}

.success-animation {
    margin-bottom: 32px;
}

.success-circle {
    width: 100px;
    height: 100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.05));
    border: 2px solid var(--success);
    border-radius: 50%;
    color: var(--success);
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.download-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.download-message {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 32px;
}

.download-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 320px;
    margin: 0 auto;
}

.download-actions .btn {
    width: 100%;
}

/* Loading */
.loading-state {
    text-align: center;
    padding: 60px 0;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-state p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Footer */
.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 24px;
    color: var(--text-dim);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 640px) {
    .header {
        flex-direction: column;
        gap: 16px;
        padding: 20px;
    }

    .main {
        padding: 24px 16px 60px;
    }

    .card {
        padding: 24px 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .confirm-grid {
        grid-template-columns: 1fr;
    }

    .color-grid {
        justify-content: center;
    }
}
