:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --card-bg: rgba(255, 255, 255, 0.8);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Pretendard', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #4f46e5, #9333ea);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.sync-indicator {
    display: inline-flex;
    align-items: center;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: white;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    box-shadow: var(--shadow);
}

.sync-indicator .dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    margin-right: 8px;
    position: relative;
}

.sync-indicator .dot::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.last-updated {
    margin-left: 10px;
    padding-left: 10px;
    border-left: 1px solid #e2e8f0;
}

/* Search Section */
.search-section {
    margin-bottom: 2rem;
}

.search-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 24px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    animation: fadeInUp 0.8s ease-out;
}

.input-group {
    flex: 1;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.input-group input {
    width: 100%;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.search-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    height: 48px;
}

.search-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

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

/* Result Section */
.result-section {
    animation: fadeIn 0.5s ease-out;
}

.result-header {
    margin-bottom: 1.5rem;
}

.result-header h2 {
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.badge {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    background: #e0e7ff;
    color: #4338ca;
    border-radius: 6px;
    font-weight: 600;
}

.badge.bonus {
    background: #0369a1;
    color: white;
    margin-left: 8px;
    font-size: 0.75rem;
    padding: 0.1rem 0.5rem;
    box-shadow: 0 2px 4px rgba(3, 105, 161, 0.2);
}

.doc-note {
    font-size: 0.75rem;
    color: var(--error);
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.doc-card.bonus {
    background: #fafafa;
    border-left: 4px solid #0369a1;
}

.rep-name-display {
    color: var(--text-muted);
    font-size: 1rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.2rem;
    margin-bottom: 2rem;
}

.doc-card {
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    border: 1px solid #f1f5f9;
}

.doc-card:hover {
    transform: translateY(-5px);
}

.doc-icon {
    width: 48px;
    height: 48px;
    background: #f1f5f9;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.status-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    background: #f1f5f9;
    color: var(--primary);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-1px);
}

.upload-btn i {
    width: 14px;
    height: 14px;
}

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

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

.doc-info h3 {
    font-size: 1rem;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    white-space: normal; /* Allow text wrap for long doc names */
}

.status-badge {
    font-size: 0.8rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

.status-submitted {
    background: #dcfce7;
    color: #166534;
}

.status-missing {
    background: #fee2e2;
    color: #991b1b;
}

/* Summary Cards */
.summary-card {
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    border-left: 6px solid var(--warning);
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.summary-card.success {
    border-left-color: var(--success);
}

.summary-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.summary-header i {
    width: 24px;
    height: 24px;
}

.summary-card ul {
    list-style: none;
    padding-left: 2rem;
}

.summary-card ul li {
    position: relative;
    margin-bottom: 0.5rem;
}

.summary-card ul li::before {
    content: '•';
    position: absolute;
    left: -1.2rem;
    color: var(--error);
    font-weight: bold;
}

/* UI States */
.hidden {
    display: none !important;
}

.welcome-section, .not-found-section {
    text-align: center;
    padding: 4rem 2rem;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 24px;
    border: 1px dashed #cbd5e1;
}

.hero-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

footer {
    text-align: center;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #cbd5e1;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Farm List Section */
.farm-list-section {
    margin-bottom: 2rem;
    animation: fadeIn 0.5s ease-out;
}

.list-container {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.list-header {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 1rem;
}

.list-header h3 {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.farm-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.farm-item {
    background: white;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-weight: 600;
    color: var(--text-main);
}

.farm-item:hover {
    border-color: var(--primary);
    background: #f8faff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    width: 90%;
    max-width: 450px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: modalScaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalScaleUp {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--error);
}

.modal-body {
    padding: 2rem;
}

.modal-body p {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.modal-body strong {
    color: var(--primary);
}

.modal-footer {
    padding: 1.5rem;
    background: #f8fafc;
    text-align: right;
}

.auth-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.auth-btn:hover {
    background: var(--primary-hover);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    70% { transform: scale(2.5); opacity: 0; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* Responsive */
@media (max-width: 768px) {
    .search-card {
        flex-direction: column;
        align-items: stretch;
    }
    header h1 {
        font-size: 2rem;
    }
    .farm-list {
        grid-template-columns: 1fr 1fr;
    }
}
