:root {
    /* Color Palette */
    --primary-color: #1A365D; /* Deep Blue - Trust and Reliability */
    --primary-light: #2B6CB0;
    --primary-hover: #152B4A;
    --background-color: #F7FAFC; /* Light Gray/Blue */
    --surface-color: #FFFFFF;
    --text-main: #2D3748;
    --text-muted: #718096;
    --border-color: #E2E8F0;
    --focus-ring: rgba(43, 108, 176, 0.4);
    --success-color: #38A169;

    /* Typography */
    --font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    
    /* Effects */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 0.15s ease-in-out;
    --transition-normal: 0.25s ease-in-out;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-main);
    line-height: 1.5;
    /* For popup layout, restrict max-width and center */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 1rem;
}

.app-container {
    width: 100%;
    max-width: 450px;
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 500px;
    max-height: 800px;
}

/* Header */
.app-header {
    background-color: var(--primary-color);
    color: white;
    padding: 1.5rem;
    text-align: center;
}

.app-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

.app-subtitle {
    font-size: 0.875rem;
    color: rgba(255,255,255,0.8);
}

/* Search Section */
.search-section {
    padding: 1.5rem 1.5rem 0.5rem 1.5rem;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-size: 1.25rem;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 2.75rem;
    font-size: 1rem;
    font-family: inherit;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
    outline: none;
    color: var(--text-main);
}

.search-box input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.clear-btn {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.clear-btn:hover {
    background-color: var(--border-color);
    color: var(--text-main);
}

.hidden {
    display: none !important;
}

/* Result Section */
.result-section {
    flex: 1;
    overflow-y: auto;
    padding: 0 1.5rem 1.5rem 1.5rem;
    position: relative;
}

/* Custom Scrollbar */
.result-section::-webkit-scrollbar {
    width: 6px;
}
.result-section::-webkit-scrollbar-track {
    background: transparent;
}
.result-section::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
.result-section::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 0;
    color: var(--primary-light);
}

.spin {
    animation: spin 1s linear infinite;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

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

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 0;
    color: var(--text-muted);
    text-align: center;
}

.empty-state .material-symbols-outlined {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.result-list {
    list-style: none;
    margin-top: 1rem;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    transition: var(--transition-fast);
    background-color: var(--surface-color);
    cursor: pointer;
}

.result-item:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.result-item:active {
    transform: translateY(0);
}

.result-info {
    flex: 1;
    padding-right: 1rem;
    min-width: 0;
}

.church-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.church-address {
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.check-btn {
    background-color: var(--primary-light);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.result-item:hover .check-btn {
    background-color: var(--primary-color);
}

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

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s ease-out forwards;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 400px;
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    text-align: center;
    z-index: 1001;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.close-modal-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    transition: var(--transition-fast);
    border-radius: 50%;
}

.close-modal-btn:hover {
    background-color: var(--border-color);
    color: var(--text-main);
}

.modal-church-name {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.modal-church-address {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.account-box {
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem 1rem;
    margin-bottom: 1rem;
}

.account-label {
    font-size: 1.25rem;
    letter-spacing: 0.02em;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.account-number-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.account-number-wrapper:hover {
    background-color: rgba(43, 108, 176, 0.1);
}

.modal-account-number {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.5px;
    word-break: keep-all;
}

.copy-btn {
    background: none;
    border: none;
    color: var(--primary-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.account-number-wrapper:hover .copy-btn {
    background-color: var(--primary-light);
    color: white;
}

.copy-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background-color: var(--text-main);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-md);
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast .material-symbols-outlined {
    color: var(--success-color);
    font-size: 1.25rem;
}

.toast-message {
    font-size: 0.875rem;
    font-weight: 500;
}

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

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