/* SFiT-BusiCard -- 스타일시트 */

:root {
    --primary: #b3283c;
    --primary-light: #c93d52;
    --primary-dark: #962234;
    --accent: #b3283c;
    --bg: #f4f6f8;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #dce1e6;
    --success: #27ae60;
    --danger: #c0392b;
    --blue: #1a5276;
    --blue-light: #2980b9;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────── */
header {
    background: var(--primary);
    color: white;
    padding: 18px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 14px;
}

header h1 { font-size: 22px; font-weight: 700; }
.subtitle { font-size: 13px; opacity: 0.85; }

.btn-admin {
    padding: 6px 16px;
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-admin:hover { background: rgba(255,255,255,0.3); }
.btn-admin.active {
    background: white;
    color: var(--primary);
    font-weight: 600;
}

/* ── Main ────────────────────────────────────────────── */
main {
    max-width: 900px;
    margin: 24px auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Card (section) ──────────────────────────────────── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.card h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
}

/* ── Search ──────────────────────────────────────────── */
.search-row { display: flex; gap: 8px; }

.search-row input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.search-row input:focus { border-color: var(--primary-light); }

.search-row button {
    padding: 10px 24px;
    background: var(--blue);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.search-row button:hover { background: var(--blue-light); }

.search-results {
    margin-top: 12px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.search-item {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.search-item:last-child { border-bottom: none; }
.search-item:hover { background: #fdf0f2; }
.search-item .name { font-weight: 600; }
.search-item .info { font-size: 13px; color: var(--text-light); }

.search-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-light);
}

/* ── Form ────────────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full-width { grid-column: 1 / -1; }

.form-group label { font-size: 13px; font-weight: 600; color: var(--text); }
.req { color: var(--accent); }

.form-group input,
.form-group select {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus { border-color: var(--primary-light); }

.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-primary {
    padding: 12px 28px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #ccc; cursor: not-allowed; }

.btn-preview {
    padding: 12px 24px;
    background: var(--blue);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-preview:hover { background: var(--blue-light); }
.btn-preview:disabled { background: #ccc; cursor: not-allowed; }

.btn-jpg {
    padding: 12px 24px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-jpg:hover { background: #219a52; }
.btn-jpg:disabled { background: #ccc; cursor: not-allowed; }

.btn-secondary {
    padding: 12px 24px;
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
}

.btn-secondary:hover { background: var(--bg); }

/* ── Preview ─────────────────────────────────────────── */
.preview-area {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.preview-area h3 {
    font-size: 14px;
    color: var(--primary);
    margin-bottom: 12px;
}

.preview-area img {
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ── Email / Log Tables ──────────────────────────────── */
.email-add-row, .pw-change-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.email-add-row input, .pw-change-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

.email-add-row input:focus, .pw-change-row input:focus {
    border-color: var(--primary-light);
}

.email-add-row button, .pw-change-row button {
    padding: 8px 20px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

.email-add-row button:hover, .pw-change-row button:hover { background: #219a52; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

thead th {
    text-align: left;
    padding: 10px 12px;
    background: var(--bg);
    font-size: 13px;
    color: var(--text-light);
    border-bottom: 1px solid var(--border);
}

tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
}

tbody tr:last-child td { border-bottom: none; }

.btn-delete {
    padding: 4px 10px;
    background: none;
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.btn-delete:hover { background: var(--danger); color: white; }

/* ── Modal ───────────────────────────────────────────── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 28px;
    border-radius: var(--radius);
    min-width: 340px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
    font-size: 17px;
    margin-bottom: 16px;
    color: var(--primary);
}

.modal-content input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    margin-bottom: 16px;
}

.modal-content input:focus { border-color: var(--primary-light); }

.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ── Loading Overlay ─────────────────────────────────── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: white;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

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

/* ── Toast ───────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1001;
    white-space: nowrap;
}

.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* ── Footer ──────────────────────────────────────────── */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
    font-size: 13px;
    margin-top: 20px;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 640px) {
    .header-inner { flex-direction: column; gap: 8px; }
    .header-left { flex-direction: column; gap: 2px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-actions { flex-direction: column; }
    .email-add-row, .pw-change-row { flex-direction: column; }
    .modal-content { min-width: auto; margin: 0 16px; }
}
