/* /css/member.css (v2.1 - Final, Complete, and Corrected) */

:root {
    --color-primary: #6F4E37; /* Coffee Brown */
    --color-primary-hover: #5a3f2d;
    --color-secondary: #D2B48C; /* Tan */
    --color-background: #F5F5DC; /* Beige */
    --color-surface: #FFFCF5; /* Creamy White for cards */
    --color-text: #3B2F2F;
    --color-text-light: #856d4d;
    --color-border: #EAE0D5;
    --color-error: #c75450;
    --color-error-bg: #f9e3e3;
    --font-family: 'Inter', 'Noto Sans TC', sans-serif;
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    --card-hover-shadow: 0 6px 25px rgba(0, 0, 0, 0.08);
    --card-border-radius: 16px;
}

/* --- General Page Structure --- */
body.member-page-body {
    background-color: var(--color-background);
    font-family: var(--font-family);
    color: var(--color-text);
}
.member-container {
    max-width: 1100px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}
.section-title {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}
.section-subtitle {
    font-size: 1.1rem;
    color: var(--color-text-light);
    margin-bottom: 2.5rem;
}

/* --- Logged-Out View: Authentication Card (Preserved from your original) --- */
.auth-wrapper { max-width: 850px; margin: 4rem auto; background-color: var(--color-surface); border-radius: var(--card-border-radius); box-shadow: var(--card-shadow); overflow: hidden; display: flex; }
.auth-benefits { background-color: var(--color-primary); color: var(--color-surface); padding: 3rem 2.5rem; width: 45%; display: flex; flex-direction: column; justify-content: center; }
.auth-benefits h3 { font-size: 1.5rem; font-weight: 600; margin-bottom: 2rem; }
.auth-benefits ul { list-style: none; padding: 0; }
.auth-benefits li { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.auth-benefits li svg { width: 24px; height: 24px; flex-shrink: 0; margin-top: 2px; }
.auth-form-section { padding: 3rem 2.5rem; width: 55%; }
.auth-form-section h2 { font-size: 1.75rem; margin-bottom: 2rem; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.5rem; font-size: 0.9rem; }
.form-group input { width: 100%; padding: 0.8rem 1rem; border: 1px solid var(--color-border); border-radius: 8px; font-size: 1rem; background-color: var(--color-background); transition: border-color 0.2s, box-shadow 0.2s; }
.form-group input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(111, 78, 55, 0.2); }
.btn { display: inline-block; width: 100%; padding: 0.9rem 1rem; border-radius: 8px; border: none; font-size: 1rem; font-weight: 600; cursor: pointer; text-align: center; transition: all 0.2s; }
.btn-primary { background-color: var(--color-primary); color: #fff; }
.btn-primary:hover { background-color: var(--color-primary-hover); transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.auth-divider { text-align: center; margin: 1.5rem 0; color: var(--color-text-light); font-size: 0.85rem; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 0.75rem; background-color: #fff; color: var(--color-text); border: 1px solid var(--color-border); }
.btn-google:hover { background-color: var(--color-background); }
.btn-google img { height: 22px; width: 22px; }
.auth-footer { text-align: center; margin-top: 2rem; font-size: 0.9rem; }
.auth-footer a { color: var(--color-primary-hover); text-decoration: underline; }
.error-message { background-color: var(--color-error-bg); color: var(--color-error); border: 1px solid var(--color-error); border-radius: 8px; padding: 0.8rem 1rem; margin-bottom: 1.5rem; font-size: 0.9rem; }

/* --- Favorites Section --- */
.favorites-section { margin-bottom: 4rem; }
.favorites-grid-container { overflow-x: auto; padding-bottom: 1.5rem; -webkit-overflow-scrolling: touch; }
.favorites-grid-container::-webkit-scrollbar { height: 8px; }
.favorites-grid-container::-webkit-scrollbar-track { background: var(--color-border); border-radius: 4px; }
.favorites-grid-container::-webkit-scrollbar-thumb { background: var(--color-secondary); border-radius: 4px; }
.favorites-grid-container::-webkit-scrollbar-thumb:hover { background: var(--color-primary-hover); }
.favorites-grid { display: flex; flex-wrap: nowrap; gap: 1.5rem; }
.favorite-card { flex: 0 0 220px; width: 220px; background-color: var(--color-surface); border-radius: var(--card-border-radius); box-shadow: var(--card-shadow); overflow: hidden; text-decoration: none; color: var(--color-text); transition: transform 0.2s ease, box-shadow 0.2s ease; cursor: pointer; }
.favorite-card:hover { transform: translateY(-5px); box-shadow: var(--card-hover-shadow); }
.favorite-card-thumbnail { width: 100%; height: 120px; background-size: cover; background-position: center; }
.favorite-card-content { padding: 1rem; }
.favorite-card-content h4 { font-size: 1rem; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Logged-In View: Test Records --- */
.records-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.75rem; }
.record-card { background-color: var(--color-surface); border-radius: var(--card-border-radius); box-shadow: var(--card-shadow); display: flex; flex-direction: column; transition: transform 0.2s, box-shadow 0.2s; overflow: hidden; }
.record-card:hover { transform: translateY(-5px); box-shadow: var(--card-hover-shadow); }

/* --- NEW (FIXED): Card Thumbnail & Overlay --- */
.card-thumbnail {
    width: 100%;
    height: 180px;
    background-size: cover;
    background-position: center;
    position: relative;
    color: #ffffff; /* White text for all overlay children */
    display: flex;
}
.card-thumbnail[data-clickable="true"] {
    cursor: pointer; /* Add pointer cursor for the whole image area if it's clickable */
}
.card-thumbnail .overlay-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%; /* Make overlay fill the entire thumbnail */
    padding: 1rem 1.5rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column; /* Stack content vertically */
    justify-content: center; /* Center the main content vertically */
    align-items: center; /* Center the main content horizontally */
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.5) 40%, rgba(0,0,0,0.1) 100%);
    text-shadow: 0 1px 5px rgba(0,0,0,0.7);
    text-align: center; /* Center all text */
}
.overlay-content .test-name {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.3;
    position: absolute;
    top: 1rem;
    left: 1.5rem;
    right: 1.5rem; /* Ensure it doesn't overflow */
    text-align: left;
    color: #ffffff; /* Explicit white color for test name */
}
.overlay-content .result-text {
    font-size: 1.5rem; /* Larger font size for elegance */
    font-weight: 600;
    margin: 0;
    color: #ffffff; /* Explicit white color for result text */
}
.overlay-content .test-time {
    font-size: 0.8rem;
    font-weight: 400;
    position: absolute;
    bottom: 1rem;
    right: 1.5rem;
    opacity: 0.8;
    color: #ffffff; /* Explicit white color for test time */
}

/* Card content below the image */
.card-content {
    padding: 1rem 1.5rem;
}
.card-footer {
    display: flex;
    gap: 0.75rem;
}
.card-footer .btn-sm { flex-grow: 1; padding: 0.5rem 1rem; font-size: 0.9rem; border-radius: 6px; }
.btn-secondary { background-color: var(--color-background); color: var(--color-primary-hover); border: 1px solid var(--color-border); }
.btn-secondary:hover { background-color: var(--color-border); }
.btn-delete { background: transparent; color: var(--color-text-light); border: 1px solid transparent; }
.btn-delete:hover { background-color: var(--color-error-bg); color: var(--color-error); border-color: var(--color-error-bg); }

/* --- Other States & Modal (Preserved from your original) --- */
.empty-state { text-align: center; padding: 4rem 2rem; background-color: var(--color-surface); border-radius: var(--card-border-radius); box-shadow: var(--card-shadow); }
.empty-state h3 { font-size: 1.5rem; margin-bottom: 0.75rem; }
.empty-state p { color: var(--color-text-light); margin-bottom: 2rem; }
.empty-state .btn { width: auto; padding: 0.9rem 2rem; }
.modal { display: none; position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); justify-content: center; align-items: center; }
.modal.is-active { display: flex; }
.modal-content { background: #fff; border-radius: 10px; max-width: 520px; width: 95vw; box-shadow: 0 4px 24px rgba(0,0,0,0.18); overflow: hidden; transform: scale(0.95); opacity: 0; transition: transform 0.3s ease, opacity 0.3s ease; }
.modal.is-active .modal-content { transform: scale(1); opacity: 1; }
.modal-header { display: flex; align-items: center; justify-content: space-between; background: #f7f8fa; padding: 1rem 1.5rem; border-bottom: 1px solid var(--color-border); }
.modal-header .logo a { font-size: 1.1rem; color: var(--color-primary-hover); text-decoration: none; font-weight: 700; }
.modal-close { font-size: 2rem; color: #888; cursor: pointer; margin-left: 1rem; line-height: 1; }
.modal-body { padding: 0; }
.modal-body iframe { width: 100%; min-height: 450px; border: none; }

/* --- Responsive (Preserved from your original) --- */
@media (max-width: 800px) { .auth-wrapper { flex-direction: column; } .auth-benefits, .auth-form-section { width: 100%; } .auth-benefits { text-align: center; } }
@media (max-width: 600px) { .member-container { margin-top: 1.5rem; } .section-title { font-size: 1.8rem; } .section-subtitle { margin-bottom: 1.5rem; } .auth-wrapper { margin: 1.5rem 0; } .auth-benefits, .auth-form-section { padding: 2rem 1.5rem; } .records-grid { grid-template-columns: 1fr; } }

/* --- Search and Filter Controls --- */
.section-header-with-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.filter-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

/* 검색 입력창 스타일 */
.search-input {
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 2px solid var(--color-border);
    border-radius: 12px;
    background-color: var(--color-surface);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text);
    min-width: 250px;
    position: relative;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23999'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.75rem center;
    background-size: 1.25rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    background-color: #fff;
    box-shadow: 0 4px 12px rgba(111, 78, 55, 0.1), 0 0 0 3px rgba(111, 78, 55, 0.08);
    transform: translateY(-1px);
}

.search-input::placeholder {
    color: #999;
    font-weight: 400;
}

/* 선택 박스 스타일 */
.filter-select {
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 2px solid var(--color-border);
    border-radius: 12px;
    background-color: var(--color-surface);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text);
    min-width: 200px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    
    /* 커스텀 화살표 */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23666'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.filter-select:focus {
    outline: none;
    border-color: var(--color-primary);
    background-color: #fff;
    box-shadow: 0 4px 12px rgba(111, 78, 55, 0.1), 0 0 0 3px rgba(111, 78, 55, 0.08);
    transform: translateY(-1px);
}

.filter-select:hover {
    border-color: var(--color-primary);
    background-color: #fff;
}

.filter-select option {
    padding: 0.5rem;
    background-color: var(--color-surface);
    color: var(--color-text);
    font-weight: 500;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .section-header-with-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .filter-controls {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .search-input,
    .filter-select {
        min-width: 100%;
        width: 100%;
    }
}