/* TL;DW Web — Mobile-first dark theme */

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

body {
    background: #0a0a0a;
    color: #e8e8e8;
    font-family: 'Inter', 'Noto Sans KR', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

.container {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Brand pill */
.brand {
    display: inline-flex;
    align-items: center;
    background: #fff;
    color: #0a0a0a;
    padding: 6px 16px;
    border-radius: 100px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
}

/* App header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 0;
    border-bottom: 1px solid #1a1a1a;
}

.app-header-left {
    text-decoration: none;
}

.logout-link {
    font-size: 14px;
    color: #888;
    text-decoration: none;
    transition: color 0.2s;
}

.logout-link:hover {
    color: #fff;
}

/* Submit form */
.submit-section {
    padding: 32px 0 24px;
}

.submit-form {
    display: flex;
    gap: 10px;
}

.submit-form input {
    flex: 1;
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 16px;
    color: #e8e8e8;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.submit-form input:focus {
    border-color: #555;
}

.submit-form input::placeholder {
    color: #555;
}

.submit-form button {
    background: #ff0033;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.submit-form button:hover {
    background: #cc0029;
}

.submit-form button:disabled {
    background: #333;
    cursor: not-allowed;
}

/* Section title */
.section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #666;
    margin-bottom: 16px;
}

/* Active jobs */
.active-jobs {
    padding-bottom: 24px;
}

.job-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #111;
    border: 1px solid #1e1e1e;
    border-radius: 12px;
    padding: 16px 20px;
    text-decoration: none;
    color: inherit;
    margin-bottom: 8px;
    transition: border-color 0.2s;
}

.job-card:hover {
    border-color: #333;
}

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

.job-card-url {
    font-size: 14px;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-card-step {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}

.job-status-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 12px;
    border-radius: 100px;
    white-space: nowrap;
}

.status-pending {
    background: #2a2a00;
    color: #cccc00;
}

.status-processing {
    background: #001a2a;
    color: #4da6ff;
}

.status-completed {
    background: #002a00;
    color: #4dff4d;
}

.status-failed {
    background: #2a0000;
    color: #ff4d4d;
}

/* Gallery grid */
.gallery {
    padding-bottom: 40px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.gallery-card {
    background: #111;
    border: 1px solid #1e1e1e;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, transform 0.2s;
}

.gallery-card:hover {
    border-color: #333;
    transform: translateY(-2px);
}

.gallery-thumb {
    aspect-ratio: 1200 / 630;
    overflow: hidden;
    background: #1a1a1a;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-info {
    padding: 14px 16px;
}

.gallery-title {
    font-size: 14px;
    font-weight: 600;
    color: #e8e8e8;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #555;
    font-size: 16px;
}

/* Error message */
.error-msg {
    background: #2a0000;
    border: 1px solid #440000;
    color: #ff6666;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    margin-top: 12px;
}

/* Login page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 360px;
    text-align: center;
}

.login-card .brand {
    margin-bottom: 24px;
}

.login-subtitle {
    font-size: 15px;
    color: #888;
    margin-bottom: 24px;
}

.login-card form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-card input {
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 16px;
    color: #e8e8e8;
    font-family: inherit;
    outline: none;
    text-align: center;
    transition: border-color 0.2s;
}

.login-card input:focus {
    border-color: #555;
}

.login-card button {
    background: #ff0033;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

.login-card button:hover {
    background: #cc0029;
}

/* Job status page */
.status-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 40px 0;
}

.status-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.status-icon {
    margin-bottom: 8px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid #222;
    border-top-color: #ff0033;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.status-label {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
}

.status-step {
    font-size: 15px;
    color: #888;
    min-height: 24px;
}

.status-url {
    font-size: 13px;
    color: #555;
    margin-top: 24px;
    word-break: break-all;
}

.back-link {
    color: #888;
    font-size: 14px;
    text-decoration: none;
    margin-top: 8px;
    transition: color 0.2s;
}

.back-link:hover {
    color: #fff;
}

/* Submit button loading state */
.submit-form button.loading {
    color: transparent;
    position: relative;
    pointer-events: none;
}

.submit-form button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Job progress steps */
.progress-steps {
    display: flex;
    gap: 4px;
    width: 100%;
    max-width: 320px;
    margin-top: 24px;
}

.progress-step {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: #222;
    transition: background 0.3s;
}

.progress-step.completed {
    background: #ff0033;
}

.progress-step.active {
    background: #ff0033;
    animation: pulse-step 1.5s ease-in-out infinite;
}

@keyframes pulse-step {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.progress-label {
    font-size: 12px;
    color: #555;
    margin-top: 8px;
}

.time-estimate {
    display: flex;
    gap: 16px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    margin-top: 12px;
}

.elapsed-time {
    color: #888;
}

.estimate-text {
    color: #555;
}

/* Mobile */
@media (max-width: 640px) {
    .submit-form {
        flex-direction: column;
    }

    .submit-form button {
        width: 100%;
    }

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

    .gallery-title {
        font-size: 16px;
    }

    .gallery-info {
        padding: 16px;
    }
}
