/* ========================================
   관리자 — 로그인 페이지
   ======================================== */
.admin-login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f0f2f5;
}

.login-wrap {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 400px;
}

.login-wrap-wide {
    max-width: 440px;
}

.login-title {
    font-size: 1.3rem;
    color: var(--color-primary);
    text-align: center;
}

.login-subtitle {
    text-align: center;
    color: #888;
    margin: 8px 0 24px;
    font-size: 0.9rem;
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-form label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: #555;
}

.login-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: var(--color-primary);
    color: #fff;
    border-radius: 6px;
    font-size: 1rem;
    margin-top: 8px;
}

.btn-login:hover {
    background: var(--color-primary-dark);
}

.login-links {
    text-align: center;
    margin-top: 20px;
    font-size: 0.875rem;
}

.login-links a {
    color: var(--color-primary);
    text-decoration: underline;
}

.required {
    color: #e74c3c;
    font-size: 0.8rem;
}

.alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.alert-error {
    background: #fdecea;
    color: #c0392b;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #e8f8f0;
    color: #27ae60;
    border: 1px solid #b8e0cc;
}

/* ========================================
   관리자 — 레이아웃 (로그인 후)
   ======================================== */
:root {
    --admin-sidebar-width: 240px;
    --admin-sidebar-bg: #1a2234;
    --admin-sidebar-active: #2b5a83;
    --admin-accent: #e67e22;
    --admin-content-bg: #f0f2f5;
    --admin-topbar-height: 56px;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
    background: var(--admin-content-bg);
}

/* 사이드바 */
.admin-sidebar {
    width: var(--admin-sidebar-width);
    min-height: 100vh;
    background: var(--admin-sidebar-bg);
    color: #c8d0dc;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    transition: transform 0.3s;
}

.sidebar-brand {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
    display: block;
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin-bottom: 8px;
}

.sidebar-badge {
    display: inline-block;
    background: var(--admin-accent);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-link {
    display: block;
    padding: 11px 14px;
    color: #b0bac9;
    font-size: 0.9rem;
    border-radius: 6px;
    margin-bottom: 4px;
    transition: background 0.2s, color 0.2s;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.sidebar-link.active {
    background: var(--admin-sidebar-active);
    color: #fff;
    font-weight: 500;
}

.sidebar-bottom {
    padding: 16px 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-bottom-link {
    font-size: 0.85rem;
    color: #8a95a5;
    transition: color 0.2s;
}

.sidebar-bottom-link:hover {
    color: #fff;
}

.sidebar-bottom-link.logout {
    color: var(--admin-accent);
}

.sidebar-bottom-link.logout:hover {
    color: #f39c12;
}

/* 우측 영역 */
.admin-wrapper {
    flex: 1;
    margin-left: var(--admin-sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 상단바 */
.admin-topbar {
    height: var(--admin-topbar-height);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.btn-sidebar-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    width: 32px;
    height: 32px;
    padding: 6px;
    justify-content: center;
}

.btn-sidebar-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: #333;
    border-radius: 1px;
}

.topbar-title {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.btn-site-view {
    padding: 7px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #555;
    background: #fff;
    transition: border-color 0.2s, color 0.2s;
}

.btn-site-view:hover {
    border-color: #9ca3af;
    color: #333;
}

/* 콘텐츠 */
.admin-content {
    flex: 1;
    padding: 28px 28px 20px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a2234;
    letter-spacing: -0.5px;
}

.page-greeting {
    font-size: 0.9rem;
    color: #666;
}

/* 통계 카드 */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px 18px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-label {
    font-size: 0.85rem;
    color: #888;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a2234;
    line-height: 1;
}

/* 빠른 실행 버튼 */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-action {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 6px;
    font-size: 0.875rem;
    background: #e8ecf1;
    color: #444;
    border: 1px solid #dde2e8;
    transition: background 0.2s, color 0.2s;
}

.btn-action:hover {
    background: #dde3ea;
    color: #222;
}

.btn-action.primary {
    background: var(--admin-accent);
    color: #fff;
    border-color: var(--admin-accent);
}

.btn-action.primary:hover {
    background: #d35400;
    border-color: #d35400;
}

/* 콘텐츠 박스 (서브 페이지) */
.content-box {
    background: #fff;
    border-radius: 10px;
    padding: 28px 24px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.placeholder-text {
    color: #888;
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.table-empty {
    padding: 20px 24px;
    margin-bottom: 0;
}

.content-box-flush {
    padding: 0;
    overflow: hidden;
}

/* 테이블 */
.table-responsive {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    table-layout: auto;
}

.admin-table th,
.admin-table td {
    padding: 14px 12px;
    text-align: center;
    border-bottom: 1px solid #eef0f3;
    vertical-align: middle;
}

.admin-table thead th {
    background: #1a2234;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    border-bottom: none;
}

.admin-table tbody tr:hover {
    background: #fafbfc;
}

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

.admin-table .col-sort {
    width: 100px;
}

.admin-table .col-status {
    width: 100px;
}

.admin-table .col-action {
    width: 150px;
}

.table-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.code-tag {
    font-family: Consolas, Monaco, monospace;
    font-size: 0.85rem;
    background: #f0f2f5;
    padding: 4px 10px;
    border-radius: 4px;
    color: #2b5a83;
    white-space: nowrap;
}

.badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
}

.badge-active {
    background: #e8f8f0;
    color: #27ae60;
}

.badge-inactive {
    background: #f0f0f0;
    color: #888;
}

.btn-toggle-active {
    cursor: pointer;
    border: none;
    transition: opacity 0.2s, transform 0.15s;
    min-width: 72px;
}

.btn-toggle-active:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

.btn-toggle-active:disabled {
    opacity: 0.5;
    cursor: wait;
}

.btn-table-edit {
    display: inline-block;
    padding: 6px 12px;
    font-size: 0.8rem;
    line-height: 1.2;
    white-space: nowrap;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #555;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-table-edit:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #333;
}

.btn-table-delete {
    display: inline-block;
    padding: 6px 12px;
    font-size: 0.8rem;
    line-height: 1.2;
    white-space: nowrap;
    border: 1px solid #e8b4b4;
    border-radius: 6px;
    background: #fff;
    color: #c0392b;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-table-delete:hover {
    background: #fdecea;
    border-color: #c0392b;
    color: #a93226;
}

/* 모달 */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    animation: modalIn 0.2s ease;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid #eef0f3;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a2234;
}

.modal-close {
    font-size: 1.5rem;
    line-height: 1;
    color: #999;
    padding: 0 4px;
    cursor: pointer;
}

.modal-close:hover {
    color: #333;
}

.modal-form {
    padding: 22px;
}

.modal-form .form-group {
    margin-bottom: 16px;
}

.modal-form label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: #555;
    font-weight: 500;
}

.modal-form input,
.modal-form select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
}

.modal-form input:focus,
.modal-form select:focus {
    outline: none;
    border-color: var(--admin-sidebar-active);
}

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

.form-hint {
    font-size: 0.75rem;
    color: #999;
    margin-top: 4px;
}

.form-readonly {
    margin: 0;
}

.form-readonly code {
    font-family: Consolas, Monaco, monospace;
    font-size: 0.9rem;
    background: #f0f2f5;
    padding: 6px 10px;
    border-radius: 4px;
    color: #2b5a83;
}

.modal-alert {
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
}

/* 푸터 */
.admin-footer {
    padding: 16px 28px;
    text-align: center;
}

.admin-footer p {
    font-size: 0.8rem;
    color: #aaa;
}

/* ========================================
   반응형
   ======================================== */
@media (max-width: 1200px) {
    .stat-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .admin-wrapper {
        margin-left: 0;
    }

    .btn-sidebar-toggle {
        display: flex;
    }

    .stat-cards {
        grid-template-columns: 1fr 1fr;
    }

    .admin-content {
        padding: 20px 16px;
    }
}

@media (max-width: 480px) {
    .stat-cards {
        grid-template-columns: 1fr;
    }
}
