* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #0066FF;
    --primary-dark: #0052CC;
    --success: #00C853;
    --error: #FF3D00;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --border: #E0E0E0;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F5F7FA;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
}


header {
    margin-bottom: 48px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}


.section-header {
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.section-header p {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}


.loading-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.3s ease;
}

.shimmer-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.shimmer-line {
    height: 16px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}


.auth-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.3s ease;
}

.auth-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: all 0.2s ease;
}

.auth-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.auth-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.auth-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.status-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    padding: 2px 8px;
    background: var(--bg-primary);
    color: var(--text-tertiary);
    border-radius: 4px;
}

.status-badge.connected {
    background: #E8F5E9;
    color: var(--success);
}


.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-connect {
    width: 100%;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-connect:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-connect:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    width: 100%;
    background: var(--primary);
    color: white;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


.form-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.3s ease;
}

.form-group {
    margin-bottom: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

input[type="text"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.helper-text {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 6px;
}


.file-upload {
    position: relative;
}

input[type="file"] {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
}

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px;
    background: var(--bg-secondary);
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-size: 14px;
}

.file-label:hover {
    border-color: var(--primary);
    background: rgba(0, 102, 255, 0.02);
    color: var(--primary);
}

.file-label svg {
    stroke: currentColor;
}

.image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.image-preview img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}


.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


.results-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    margin-top: 24px;
    animation: fadeIn 0.3s ease;
}

#resultsGrid {
    display: grid;
    gap: 16px;
}

.result-card {
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.result-card.success {
    background: #E8F5E9;
    border-color: var(--success);
}

.result-card.error {
    background: #FFEBEE;
    border-color: var(--error);
}

.result-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.result-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.result-card a {
    display: inline-block;
    font-size: 14px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    margin-top: 8px;
}

.result-card a:hover {
    text-decoration: underline;
}


.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 20px;
    background: var(--text-primary);
    color: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    font-weight: 500;
    animation: slideUp 0.3s ease;
    z-index: 1000;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--error);
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    header {
        margin-bottom: 32px;
    }

    .logo h1 {
        font-size: 20px;
    }

    .auth-section,
    .form-section,
    .results-section {
        padding: 24px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .auth-grid {
        grid-template-columns: 1fr;
    }
}
