/* 당근 검색기 - 모바일 퍼스트 CSS */

:root {
    --orange: #FF6F0F;
    --orange-light: #FFF3EB;
    --orange-dark: #E55A00;
    --bg: #F7F8FA;
    --card-bg: #FFFFFF;
    --text: #212529;
    --text-muted: #868E96;
    --border: #DEE2E6;
    --success: #20C997;
    --danger: #FA5252;
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}

/* 헤더 */
header {
    text-align: center;
    padding: 20px 0 16px;
}

header h1 {
    font-size: 24px;
    font-weight: 700;
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.back-link {
    display: inline-block;
    color: var(--orange);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 8px;
    min-height: 44px;
    line-height: 44px;
}

/* 폼 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 8px;
}

input[type="text"],
select {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    appearance: none;
    -webkit-appearance: none;
    min-height: 48px;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(255, 111, 15, 0.15);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23868E96' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* 지역 그리드 */
.region-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    cursor: pointer;
    min-height: 36px;
}

.btn-small:active {
    background: var(--bg);
}

.region-count {
    font-size: 13px;
    color: var(--text-muted);
    margin-left: auto;
}

.region-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.region-item {
    position: relative;
}

.region-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.region-item label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 4px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    cursor: pointer;
    text-align: center;
    min-height: 56px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    user-select: none;
    -webkit-user-select: none;
}

.region-item label .count {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.region-item input:checked + label {
    background: var(--orange-light);
    border-color: var(--orange);
    color: var(--orange-dark);
}

.region-item input:checked + label .count {
    color: var(--orange);
}

/* 버튼 */
.btn-primary {
    display: block;
    width: 100%;
    padding: 16px;
    font-size: 17px;
    font-weight: 700;
    color: white;
    background: var(--orange);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    min-height: 54px;
    transition: background 0.15s;
}

.btn-primary:active {
    background: var(--orange-dark);
}

.btn-primary:disabled {
    background: #CED4DA;
    cursor: not-allowed;
}

.btn-cancel {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    color: var(--danger);
    background: white;
    border: 1.5px solid var(--danger);
    border-radius: var(--radius);
    cursor: pointer;
    min-height: 48px;
    margin-bottom: 16px;
}

.btn-cancel:active {
    background: #FFF5F5;
}

/* 상태 바 */
.status-bar {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.status-text {
    font-weight: 600;
    font-size: 15px;
}

.status-text.running {
    color: var(--orange);
}

.status-text.completed {
    color: var(--success);
}

.status-text.failed {
    color: var(--danger);
}

.result-count {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 600;
}

.progress-wrap {
    height: 8px;
    background: #E9ECEF;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--orange);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: right;
}

/* 결과 카드 */
.results {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-card {
    display: block;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 14px 16px;
    text-decoration: none;
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: box-shadow 0.15s;
    min-height: 44px;
}

.result-card:active {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.result-card .title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-card .meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.result-card .price {
    color: var(--orange);
    font-weight: 700;
    font-size: 15px;
}

/* 에러 */
.error {
    background: #FFF5F5;
    color: var(--danger);
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-top: 12px;
}

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-muted);
}

/* 로딩 */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}

/* 반응형 */
@media (min-width: 480px) {
    .region-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 768px) {
    .container {
        padding: 24px;
    }

    header h1 {
        font-size: 28px;
    }
}
