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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
}

/* ── Login ── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.login-box {
    background: #fff;
    border-radius: 12px;
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-size: 1.6rem; color: #1a1a2e; margin-bottom: 4px; }
.login-logo p { color: #888; font-size: 0.85rem; }

/* ── Layout ── */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: #1a1a2e;
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}
.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-brand h2 { font-size: 1rem; font-weight: 700; color: #fff; }
.sidebar-brand p { font-size: 0.75rem; color: rgba(255,255,255,0.5); margin-top: 2px; }
.sidebar-viewsite {
    display: block;
    margin-top: 14px;
    padding: 9px 12px;
    background: #4e9af1;
    color: #fff;
    text-align: center;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 8px;
    transition: background 0.2s;
}
.sidebar-viewsite:hover { background: #2d7dd2; }

.sidebar-nav { padding: 16px 0; flex: 1; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.88rem;
    transition: all 0.2s;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.sidebar-nav a.active { border-left: 3px solid #4e9af1; }
.sidebar-nav .nav-icon { width: 18px; text-align: center; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-footer a {
    display: block;
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    font-size: 0.82rem;
    padding: 6px 0;
    transition: color 0.2s;
}
.sidebar-footer a:hover { color: #ff6b6b; }

.main-content {
    margin-left: 240px;
    flex: 1;
    min-height: 100vh;
}
.topbar {
    background: #fff;
    border-bottom: 1px solid #e8ecef;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar h1 { font-size: 1.1rem; font-weight: 600; color: #1a1a2e; }
.topbar-actions { display: flex; gap: 12px; align-items: center; }

.content-area { padding: 32px; }

/* ── Cards ── */
.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
}
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h3 { font-size: 0.95rem; font-weight: 600; color: #1a1a2e; }
.card-body { padding: 24px; }

/* ── Dashboard grid ── */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
.page-card {
    background: #fff;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 2px solid transparent;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.page-card:hover {
    border-color: #4e9af1;
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(78,154,241,0.18);
}
/* 대표사진: 카드 가운데 영역 */
.page-card__img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    background: #eef1f5;
}
.page-card__body { padding: 18px 18px 20px; text-align: center; }
.page-card h3 { font-size: 0.98rem; font-weight: 700; margin-bottom: 5px; color: #1a1a2e; }
.page-card p { font-size: 0.8rem; color: #888; line-height: 1.5; }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #dde1e7;
    border-radius: 7px;
    font-size: 0.9rem;
    font-family: inherit;
    color: #333;
    background: #fff;
    transition: border-color 0.2s;
    outline: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: #4e9af1; }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.75rem; color: #999; margin-top: 4px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Repeatable blocks ── */
.repeat-block {
    border: 1.5px solid #e8ecef;
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 14px;
    background: #fafbfc;
    position: relative;
}
.repeat-block .block-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 14px;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 7px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-primary { background: #4e9af1; color: #fff; }
.btn-primary:hover { background: #2d7dd2; }
.btn-secondary { background: #f0f2f5; color: #555; }
.btn-secondary:hover { background: #e2e6ea; }
.btn-danger { background: #ff6b6b; color: #fff; }
.btn-danger:hover { background: #e05555; }
.btn-success { background: #51cf66; color: #fff; }
.btn-success:hover { background: #3aae52; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Alert ── */
.alert {
    padding: 13px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.88rem;
}
.alert-success { background: #d3f9d8; color: #2b8a3e; border: 1px solid #b2f2bb; }
.alert-error   { background: #ffe3e3; color: #c92a2a; border: 1px solid #ffa8a8; }

/* ── Section divider ── */
.section-divider {
    margin: 28px 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f2f5;
    font-size: 0.9rem;
    font-weight: 700;
    color: #1a1a2e;
}

/* ── Image uploader ── */
.img-field {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.img-field__preview {
    flex-shrink: 0;
    width: 120px;
    height: 90px;
    border-radius: 8px;
    border: 1.5px dashed #cdd3db;
    background: #f4f6f8;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aeb4bd;
    font-size: 0.72rem;
}
.img-field__preview img { width: 100%; height: 100%; object-fit: cover; }
.img-field__controls { flex: 1; }
.img-field__controls input[type="file"] { font-size: 0.82rem; }

/* ── Repeatable header w/ remove ── */
.repeat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.repeat-head .block-title { margin-bottom: 0; }

/* ── Gallery admin item ── */
.gal-item .gal-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 16px;
    align-items: start;
}
.gal-item .img-field { flex-direction: column; }
.gal-item .img-field__preview { width: 140px; height: 105px; }

.add-row-btn { margin-top: 6px; }

/* ── Partner admin row ── */
.partner-item .partner-grid {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 14px;
    align-items: start;
}
.partner-item .img-field { flex-direction: column; }
.partner-item .img-field__preview { width: 110px; height: 64px; }
.partner-fields { display: grid; grid-template-columns: 1.4fr 1fr 1.6fr; gap: 10px; }
.partner-fields input { width: 100%; padding: 9px 12px; border: 1.5px solid #dde1e7; border-radius: 7px; font-size: 0.88rem; }
.partner-fields input:focus { border-color: #4e9af1; outline: none; }
@media (max-width: 768px) {
    .partner-item .partner-grid { grid-template-columns: 1fr; }
    .partner-item .img-field__preview { width: 100%; height: 90px; }
    .partner-fields { grid-template-columns: 1fr; }
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { width: 100%; height: auto; position: relative; }
    .main-content { margin-left: 0; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .content-area { padding: 20px 16px; }
    .gal-item .gal-grid { grid-template-columns: 1fr; }
    .gal-item .img-field__preview { width: 100%; height: 160px; }
}
