/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 32px 0;
    text-align: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

.header-info {
    margin-top: 12px;
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.today-badge,
.region-badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    backdrop-filter: blur(4px);
}

.today-badge strong {
    font-weight: 700;
}

/* Filter Section */
.filter-section {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    margin-top: -20px;
    box-shadow: var(--shadow-lg);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    position: relative;
    z-index: 10;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input {
    padding: 10px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--gray-700);
    background: var(--gray-50);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Multi-Select Dropdown */
.multi-select {
    position: relative;
}

.multi-select-toggle {
    padding: 10px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--gray-700);
    background: var(--gray-50);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: border-color 0.2s;
}

.multi-select-toggle:hover {
    border-color: var(--primary);
}

.multi-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    min-width: 200px;
    max-height: 250px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    padding: 8px 0;
    margin-top: 4px;
}

.multi-select-dropdown.open {
    display: block;
}

.multi-select-dropdown label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 0.85rem;
    color: var(--gray-700);
    cursor: pointer;
    transition: background 0.15s;
    text-transform: none;
    font-weight: 400;
    letter-spacing: 0;
}

.multi-select-dropdown label:hover {
    background: var(--gray-50);
}

.multi-select-dropdown input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* Result Info */
.result-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 24px 0 16px;
    padding: 0 4px;
}

#result-count {
    font-size: 0.9rem;
    color: var(--gray-700);
    font-weight: 600;
}

.result-note {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* Days Left */
.days-left {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    white-space: nowrap;
}

.days-left.urgent {
    color: var(--danger);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.empty-sub {
    font-size: 0.9rem;
    color: var(--gray-500);
    margin-top: 8px;
}

/* Listing Grid */
.listing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* Card */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 20px 20px 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.card-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-lh {
    background: #dbeafe;
    color: #1e40af;
}

.badge-sh {
    background: #fce7f3;
    color: #9d174d;
}

.badge-applyhome {
    background: #d1fae5;
    color: #065f46;
}

.badge-status {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.status-active {
    background: #dcfce7;
    color: var(--success);
}

.status-upcoming {
    background: #fef3c7;
    color: #92400e;
}

.status-closed {
    background: #f3f4f6;
    color: var(--gray-500);
}

.card-body {
    padding: 0 20px 16px;
    flex: 1;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
    line-height: 1.4;
}

.card-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--gray-500);
}

.meta-item .icon {
    width: 16px;
    text-align: center;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-type {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 500;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: background 0.2s;
}

.card-link:hover {
    background: var(--primary-dark);
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px 20px;
    display: none;
}

.loading.active {
    display: block;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    color: var(--gray-500);
    font-size: 0.9rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
    font-size: 1.1rem;
}

/* Footer */
.footer {
    background: var(--gray-900);
    color: var(--gray-300);
    padding: 32px 0;
    text-align: center;
    margin-top: 60px;
}

.footer p {
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.footer-links {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--gray-300);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 24px 0;
    }

    .logo {
        font-size: 1.4rem;
    }

    .filter-section {
        grid-template-columns: 1fr 1fr;
        padding: 16px;
        gap: 12px;
    }

    .listing-grid {
        grid-template-columns: 1fr;
    }

    .result-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .filter-section {
        grid-template-columns: 1fr;
    }
}
