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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

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

/* ===== HEADER ===== */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
    max-width: 800px;
    margin: 0 auto;
}

.logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    background: white;
    padding: 10px;
    border-radius: 12px;
    flex-shrink: 0;
}

.header-text {
    text-align: left;
    flex: 1;
    min-width: 250px;
}

header h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: bold;
    white-space: nowrap;
}

header p {
    margin: 10px 0 0 0;
    font-size: 1.1rem;
    opacity: 0.95;
    line-height: 1.4;
}

/* ===== INPUT GUIDE SECTION ===== */
.input-guide-section {
    background: white;
    padding: 20px 25px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border-left: 5px solid #667eea;
}

.input-guide-section p {
    color: #333;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 8px 0;
}

.input-guide-section p:first-child {
    margin-top: 0;
    font-weight: 500;
    color: #667eea;
    font-size: 1rem;
}

.input-guide-section p:last-child {
    margin-bottom: 0;
    font-size: 0.9rem;
    color: #666;
}

/* ===== SEARCH SECTION ===== */
.search-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    margin: 30px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-label {
    display: block;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
    font-size: 16px;
}

.search-tip {
    margin: 0 0 16px 0;
    font-size: 13px;
    color: #999;
}

.search-input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

#searchInput {
    width: 100%;
    padding: 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
    font-family: inherit;
}

#searchInput:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ===== 버튼 그룹 (Search, Scan, Guide) ===== */
.button-group {
    display: flex;
    gap: 10px;
    width: 100%;
}

.button-group button {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Search 버튼 */
#searchBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#searchBtn:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a4298 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Scan 버튼 */
#scanToggleBtn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

#scanToggleBtn:hover {
    background: linear-gradient(135deg, #e082ea 0%, #e4465b 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(240, 147, 251, 0.4);
}

/* Guide 버튼 */
#helpBtn {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

#helpBtn:hover {
    background: linear-gradient(135deg, #e95f89 0%, #edd02f 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(250, 112, 154, 0.4);
}

/* 태블릿 이상 (768px+) */
@media (min-width: 768px) {
    .search-section {
        padding: 30px;
    }
    
    .search-input-group {
        flex-direction: row;
        align-items: center;
    }
    
    #searchInput {
        flex: 1;
        min-width: 0;
    }
    
    .button-group {
        width: auto;
        flex-shrink: 0;
    }
    
    .button-group button {
        flex: 0 0 auto;
        min-width: 120px;
    }
}

/* ===== LOADING ===== */
.loading {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* ===== ERROR MESSAGE ===== */
.error-message {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 16px;
    color: #856404;
    line-height: 1.6;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.15);
}

.error-message a {
    color: #0066cc !important;
    text-decoration: underline !important;
    font-weight: bold !important;
    cursor: pointer !important;
    transition: all 0.3s;
}

.error-message a:hover {
    color: #0047b3 !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ===== RESULTS ===== */
.results {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 30px;
}

.product-info {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.product-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 8px;
}

.product-source {
    font-size: 0.85rem;
    color: #999;
    margin-top: 3px;
    font-style: italic;
}

/* ===== INGREDIENTS SECTION ===== */
.ingredients-section {
    margin-bottom: 25px;
}

.ingredients-section h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.ingredients-list {
    display: grid;
    gap: 15px;
    margin-bottom: 15px;
}

.ingredient-card {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: #fff5f5;
    border-left: 4px solid #ff6b6b;
    border-radius: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ingredient-card:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.2);
}

.ingredient-icon {
    font-size: 2rem;
    flex-shrink: 0;
    line-height: 1;
}

.ingredient-info {
    flex: 1;
}

.ingredient-english {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.ingredient-korean {
    font-size: 1rem;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.ingredient-detected {
    font-size: 0.85rem;
    color: #999;
    margin-top: 5px;
    font-style: italic;
}

.no-ingredients {
    padding: 20px;
    background: #f0f9ff;
    border-left: 4px solid #4caf50;
    border-radius: 10px;
    color: #2e7d32;
    font-weight: 500;
    margin-bottom: 15px;
}

/* ===== RAW MATERIALS ===== */
.raw-materials {
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.raw-materials h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.raw-materials-text {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    line-height: 1.8;
    color: #555;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid #e0e0e0;
    font-size: 0.95rem;
}

/* ===== DISCLAIMER SECTION ===== */
.disclaimer-section {
    background: #fff9e6;
    padding: 30px;
    border-radius: 15px;
    border-left: 5px solid #ffc107;
    box-shadow: 0 5px 15px rgba(255, 193, 7, 0.15);
    margin-bottom: 50px;
}

.disclaimer-section h3 {
    color: #f57f17;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.disclaimer-item {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ffe082;
}

.disclaimer-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.disclaimer-item h4 {
    color: #e65100;
    font-size: 1rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.disclaimer-item p {
    color: #424242;
    line-height: 1.6;
    font-size: 0.95rem;
}

.disclaimer-item strong {
    color: #d84315;
    font-weight: 600;
}

.disclaimer-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #ffe082;
    color: #d84315;
    font-weight: 500;
    text-align: center;
    font-style: italic;
}

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

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
    cursor: pointer;
}

.modal-content {
    position: relative;
    z-index: 2;
    background: white;
    padding: 40px;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

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

.modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 36px;
    font-weight: bold;
    color: #667eea;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 3;
    padding: 5px 15px;
    transition: all 0.3s ease;
    line-height: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #764ba2;
    transform: scale(1.2);
}

.guide-content {
    position: relative;
    padding-top: 20px;
}

.guide-content h2 {
    color: #333;
    margin-top: 0;
    margin-bottom: 30px;
    font-size: 1.5rem;
    text-align: center;
    padding-right: 50px;
}

.guide-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.guide-section:last-of-type {
    border-bottom: none;
}

.guide-section h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.guide-section p {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.guide-section img {
    max-width: 100%;
    border-radius: 8px;
    margin: 15px 0;
}

.guide-tips {
    background: #f0f9ff;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #3b82f6;
}

.guide-tips p {
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.guide-tips strong {
    color: #667eea;
}

.guide-tips ul {
    list-style-position: inside;
    color: #666;
    font-size: 0.95rem;
    margin: 10px 0 0 20px;
    padding: 0;
}

.guide-tips li {
    margin-bottom: 8px;
    color: #555;
}

/* ===== UTILITY ===== */
.hidden {
    display: none !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    header {
        padding: 30px 15px;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .header-text {
        text-align: center;
    }

    header h1 {
        font-size: 2rem;
    }

    header p {
        font-size: 1rem;
    }

    .logo {
        width: 80px;
        height: 80px;
    }

    .search-section {
        padding: 20px;
        margin: 20px 0;
    }

    .button-group button {
        padding: 12px 20px;
        font-size: 15px;
    }

    .results {
        padding: 20px;
    }

    .disclaimer-section {
        padding: 20px;
        margin-bottom: 40px;
    }

    footer {
        padding: 25px 15px !important;
    }
    
    footer p {
        font-size: 0.85rem !important;
    }
    
    .footer-links a {
        font-size: 0.85rem !important;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    header {
        padding: 20px 10px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    header p {
        font-size: 0.9rem;
    }

    .logo {
        width: 70px;
        height: 70px;
    }

    .search-section input {
        min-width: 100%;
    }

    .button-group {
        flex-direction: column;
    }
    
    .button-group button {
        width: 100%;
    }

    .modal-content {
        padding: 30px 20px;
        max-width: 95%;
    }

    .guide-content h2 {
        font-size: 1.3rem;
    }

    .disclaimer-section {
        padding: 20px 15px;
        margin-bottom: 35px;
    }

    footer {
        padding: 20px 10px !important;
    }
    
    footer p {
        font-size: 0.8rem !important;
    }
    
    .footer-links a {
        font-size: 0.8rem !important;
    }
}

/* ===== FOOTER ===== */
footer {
    background: transparent !important;
    color: white !important;
    padding: 30px 20px !important;
    text-align: center !important;
    margin-top: 0 !important;
    border-top: 2px solid rgba(255, 255, 255, 0.4) !important;
    width: 100% !important;
}

footer p {
    margin: 0 auto 12px auto !important;
    font-size: 0.9rem !important;
    color: white !important;
    text-align: center !important;
    max-width: 100% !important;
}

.footer-links {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 12px !important;
    margin: 8px auto 0 auto !important;
    text-align: center !important;
}

.footer-links a {
    color: white !important;
    text-decoration: none !important;
    font-weight: 400 !important;
    font-size: 0.9rem !important;
    transition: all 0.3s !important;
}

.footer-links a:hover {
    color: #ffffff !important;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.8) !important;
    text-decoration: underline !important;
}

.footer-divider {
    color: rgba(255, 255, 255, 0.7) !important;
    margin: 0 !important;
}
.scanner-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    display: none;
    scroll-margin-top: 20px; /* 스크롤 시 상단 여백 */
}

.scanner-section.active {
    display: block;
}