/* ================================
   CSS Variables & Base Styles
   ================================ */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success: #10b981;
    --success-dark: #059669;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
}

/* ================================
   App Container
   ================================ */
.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ================================
   Header
   ================================ */
.app-header {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon {
    font-size: 48px;
    animation: float 3s ease-in-out infinite;
}

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

.logo-text {
    font-size: 36px;
    font-weight: 700;
    color: var(--white);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.header-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 18px;
    font-weight: 400;
}

/* ================================
   Step Sections
   ================================ */
.step-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    margin-bottom: 24px;
    overflow: hidden;
    transition: var(--transition);
}

.step-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 30px -5px rgb(0 0 0 / 0.15);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 28px;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
    border-bottom: 1px solid var(--gray-100);
}

.step-number {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.step-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-800);
}

.step-content {
    padding: 28px;
}

/* ================================
   Input Group
   ================================ */
.input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.url-input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 16px;
    transition: var(--transition);
    outline: none;
}

.url-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.url-input::placeholder {
    color: var(--gray-400);
}

.input-hint {
    color: var(--gray-500);
    font-size: 14px;
}

/* ================================
   Buttons
   ================================ */
.btn {
    padding: 16px 28px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

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

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-download {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    font-size: 18px;
    padding: 18px 36px;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

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

/* ================================
   Spinner
   ================================ */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

/* ================================
   Progress Section
   ================================ */
.progress-section {
    background: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-900) 100%) !important;
    color: var(--white);
}

.progress-container {
    padding: 28px;
}

.progress-bar {
    height: 8px;
    background: var(--gray-700);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--success) 100%);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 14px;
    color: var(--gray-300);
}

.progress-log {
    max-height: 150px;
    overflow-y: auto;
    padding: 16px;
    background: var(--gray-900);
    border-radius: var(--radius-sm);
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    color: var(--gray-400);
    margin: 0 28px 28px;
}

.progress-log p {
    margin: 4px 0;
}

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

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

/* ================================
   Preview Section
   ================================ */
.preview-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
}

.preview-screenshot {
    background: var(--gray-100);
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-screenshot img {
    width: 100%;
    height: auto;
    display: block;
}

.screenshot-placeholder {
    text-align: center;
    color: var(--gray-400);
}

.screenshot-placeholder span {
    font-size: 48px;
    display: block;
    margin-bottom: 8px;
}

.structure-panel {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 20px;
}

.structure-panel h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.structure-list {
    margin-bottom: 24px;
}

.structure-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--white);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border: 1px solid var(--gray-200);
}

.structure-item.found {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.structure-item.not-found {
    opacity: 0.5;
}

.structure-icon {
    font-size: 20px;
}

.structure-name {
    font-weight: 500;
    font-size: 14px;
}

.structure-status {
    margin-left: auto;
    font-size: 12px;
    color: var(--gray-500);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.stat-item {
    background: var(--white);
    padding: 12px;
    border-radius: var(--radius-sm);
    text-align: center;
    border: 1px solid var(--gray-200);
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 12px;
    color: var(--gray-500);
}

/* ================================
   Theme Form
   ================================ */
.theme-form {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

.form-group {
    flex: 1;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.theme-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 16px;
    transition: var(--transition);
    outline: none;
}

.theme-input:focus {
    border-color: var(--success);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}

/* ================================
   Success Message
   ================================ */
.success-message {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.success-message h3 {
    font-size: 24px;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.success-message p {
    color: var(--gray-500);
    margin-bottom: 24px;
}

.success-message .btn {
    margin: 0 8px;
}

.usage-guide {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 32px;
    text-align: left;
}

.usage-guide h4 {
    font-size: 16px;
    color: var(--gray-700);
    margin-bottom: 16px;
}

.usage-guide ol {
    padding-left: 24px;
    color: var(--gray-600);
}

.usage-guide li {
    margin-bottom: 8px;
}

/* ================================
   Footer
   ================================ */
.app-footer {
    text-align: center;
    padding: 24px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: auto;
}

/* ================================
   Toast Notification
   ================================ */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--gray-800);
    color: var(--white);
    padding: 16px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
}

.toast.error {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
}

/* ================================
   Responsive
   ================================ */
@media (max-width: 768px) {
    .app-container {
        padding: 20px 16px;
    }
    
    .logo-text {
        font-size: 28px;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .preview-container {
        grid-template-columns: 1fr;
    }
    
    .theme-form {
        flex-direction: column;
    }
    
    .success-message .btn {
        display: block;
        width: 100%;
        margin: 8px 0;
    }
}
