* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Arial, "Noto Sans KR", sans-serif;
    background: #f4f6f8;
    color: #222;
}

a {
    color: inherit;
}

.admin-shell {
    min-height: 100vh;
}

.global-header {
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 62px;
    background: #1f2937;
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 22px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.brand-area {
    flex: 0 0 auto;
    margin-right: 26px;
}

.brand {
    display: inline-flex;
    align-items: center;
    height: 62px;
    font-size: 20px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.top-menu {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.top-menu > a {
    display: inline-flex;
    align-items: center;
    height: 62px;
    padding: 0 10px;
    border: 0;
    background: transparent;
    color: #d1d5db;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.top-menu > a:hover {
    background: #374151;
    color: #fff;
}


.header-actions {
    flex: 0 0 auto;
    margin-left: 18px;
}

.logout-btn,
.search-box button,
.login-box button {
    border: 0;
    background: #2563eb;
    color: #fff;
    padding: 9px 14px;
    border-radius: 4px;
    cursor: pointer;
}

.logout-btn {
    background: #4b5563;
}

.logout-btn:hover {
    background: #6b7280;
}

.content {
    padding: 24px 28px 44px;
}

.page-title {
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 20px;
    margin-bottom: 16px;
}

.page-title h2 {
    margin: 0 0 6px;
}

.page-title p {
    margin: 0;
    color: #6b7280;
}

.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 24px;
    min-height: 100px;
}

.search-box {
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 14px;
    margin-bottom: 12px;
}

.search-box input,
.login-box input {
    border: 1px solid #d1d5db;
    padding: 9px;
    border-radius: 4px;
}

.list-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.list-table th,
.list-table td {
    border: 1px solid #e5e7eb;
    padding: 10px;
    font-size: 14px;
    text-align: left;
}

.list-table th {
    background: #f9fafb;
}

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-box {
    width: 360px;
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 30px;
}

.login-box input,
.login-box button {
    width: 100%;
    margin-top: 10px;
}

.error {
    color: #dc2626;
}

.msg {
    color: #2563eb;
}

@media (max-width: 1100px) {
    .global-header {
        align-items: flex-start;
        flex-wrap: wrap;
        padding: 0 16px 10px;
    }

    .brand {
        height: 54px;
    }

    .top-menu {
        order: 3;
        width: 100%;
        overflow-x: auto;
    }

    .top-menu > a {
        height: 44px;
    }


    .content {
        padding: 18px 16px 36px;
    }

    .cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

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


/* Legacy admin style helpers */
#contents { max-width: 2300px; margin: 0 auto; }
.breadcrumb {
    list-style: none;
    margin: 0 0 12px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #d8dde3;
    font-size: 13px;
}
.breadcrumb li { display: inline-block; color: #666; }
.breadcrumb .divider { padding: 0 6px; color: #aaa; }
.well {
    min-height: 20px;
    padding: 14px;
    margin-bottom: 14px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
}
.well-large { padding: 18px; }
.form-inline select,
.form-inline input[type=text],
.form-inline input[type=password],
.form-inline input[type=email] {
    height: 32px;
    padding: 5px 7px;
    border: 1px solid #bbb;
    border-radius: 2px;
    vertical-align: middle;
}
.form-inline textarea {
    padding: 7px;
    border: 1px solid #bbb;
    border-radius: 2px;
}
.search_tle {
    display: inline-block;
    margin-right: 8px;
    text-transform: uppercase;
}
.item_space { margin-right: 6px; }
.w90 { width: 90px; }
.w120 { width: 120px; }
.w150 { width: 150px; }
.w200 { width: 200px; }
.w300 { width: 300px; }
.w500 { width: 500px; }
.btn_area { margin: 14px 0; text-align: right; }
.btn {
    display: inline-block;
    padding: 7px 13px;
    margin-left: 4px;
    border: 1px solid #aaa;
    border-radius: 3px;
    background: #fff;
    color: #222;
    text-decoration: none;
    cursor: pointer;
    font-size: 13px;
}
.btn:hover { background: #f2f2f2; }
.btn-primary { background: #2563eb; border-color: #1d4ed8; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #dc2626; border-color: #b91c1c; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: #4b5563; border-color: #374151; color: #fff; }
.btn-secondary:hover { background: #374151; }
.tbl_details {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-top: 2px solid #4b5563;
}
.tbl_details th,
.tbl_details td {
    border: 1px solid #d8dde3;
    padding: 9px 10px;
    font-size: 13px;
}
.tbl_details th {
    background: #f3f4f6;
    text-align: left;
    font-weight: 700;
}
.tbl_details .tbl_tit {
    background: #4b5563;
    color: #fff;
    font-weight: 700;
    text-align: left;
}
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.required { color: #dc2626; font-weight: 700; }
.help_txt { color: #777; font-size: 12px; margin-left: 6px; }
.dataTables_wrapper {
    background: #fff;
    border: 1px solid #ddd;
    padding: 10px;
}
#listT tbody tr { cursor: pointer; }
#listT tbody tr:hover { background: #f3f6fb; }


/* DataTables footer / pagination fix */
.dataTables_wrapper {
    position: relative;
    clear: both;
    background: #fff;
    border: 1px solid #ddd;
    padding: 10px;
    overflow-x: auto;
}

.dataTables_wrapper:after {
    content: "";
    display: block;
    clear: both;
}

.dataTables_wrapper .dataTables_length {
    float: left;
    font-size: 13px;
    margin: 0 0 8px 0;
}

.dataTables_wrapper .dataTables_length label {
    font-weight: normal;
}

.dataTables_wrapper .dataTables_length select {
    height: 26px;
    border: 1px solid #aaa;
    padding: 2px 4px;
    vertical-align: middle;
}

.dataTables_wrapper .dataTables_info {
    clear: left;
    float: left;
    padding-top: 10px;
    font-size: 13px;
    color: #333;
}

.dataTables_wrapper .dataTables_paginate {
    float: right;
    text-align: right;
    padding-top: 7px;
    font-size: 0;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    display: inline-block;
    min-width: 28px;
    height: 28px;
    line-height: 26px;
    margin-left: 3px;
    padding: 0 8px;
    border: 1px solid #c7c7c7;
    background: #fff;
    color: #333 !important;
    text-decoration: none !important;
    cursor: pointer;
    font-size: 12px;
    text-align: center;
    vertical-align: middle;
    border-radius: 2px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    border-color: #6b7280;
    background: #f3f4f6;
    color: #111 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    border-color: #1f2937;
    background: #1f2937;
    color: #fff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    border-color: #ddd;
    background: #f7f7f7;
    color: #aaa !important;
    cursor: default;
}

.dataTables_wrapper .dataTables_processing {
    position: absolute;
    top: 54px;
    left: 50%;
    width: 160px;
    margin-left: -80px;
    padding: 8px 0;
    border: 1px solid #ddd;
    background: #fff;
    text-align: center;
    font-size: 13px;
    z-index: 10;
}

#listT {
    clear: both;
}

@media (max-width: 900px) {
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        float: none;
        clear: both;
        text-align: left;
    }

    .dataTables_wrapper .dataTables_paginate {
        padding-top: 8px;
    }
}

/* Common code manager */
.common-code-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 390px;
    gap: 16px;
    align-items: start;
}

.common-code-list,
.common-code-editor {
    min-width: 0;
}

.common-code-editor {
    display: none;
    position: sticky;
    top: 82px;
    background: #fff;
    border: 1px solid #d8dde3;
    padding: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.common-code-editor.open {
    display: block;
}

.editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.editor-head h3 {
    margin: 0;
    font-size: 17px;
}

.badge {
    display: inline-block;
    min-width: 48px;
    padding: 3px 7px;
    border-radius: 12px;
    font-size: 12px;
    text-align: center;
    border: 1px solid transparent;
}

.badge.active {
    background: #e8f7ee;
    border-color: #b6e5c8;
    color: #16713a;
}

.badge.inactive {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #6b7280;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
}

.dt-center {
    text-align: center !important;
}

.muted {
    color: #6b7280;
    font-size: 12px;
}

.common-help {
    margin-top: 10px;
}

@media (max-width: 1200px) {
    .common-code-layout {
        grid-template-columns: 1fr;
    }

    .common-code-editor {
        position: static;
    }
}


/* Messenger inline edit panel */
.edit-panel {
    margin-top: 12px;
    border-left: 4px solid #4b5563;
}

.form-title {
    margin: 0 0 14px 0;
    font-size: 18px;
    font-weight: 600;
}

.form-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px 12px;
    align-items: center;
}

.form-grid label {
    font-weight: 600;
    color: #333;
}

.form-grid input,
.form-grid select {
    height: 30px;
    border: 1px solid #aaa;
    padding: 3px 6px;
    box-sizing: border-box;
}

.form-actions {
    grid-column: 2 / 3;
    margin-top: 6px;
}

.required {
    color: #d00;
}

.btn-small {
    padding: 3px 8px;
    font-size: 12px;
}

.btn-danger {
    background: #b91c1c;
    border-color: #991b1b;
    color: #fff;
}

.w250 { width: 250px; }
.w500 { width: 500px; }

@media (max-width: 760px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-actions {
        grid-column: 1;
    }

    .w500 {
        width: 100%;
    }
}


/* Restaurant image upload / preview */
.thumb-img {
    width: 64px;
    height: 44px;
    object-fit: cover;
    border: 1px solid #d8dde3;
    background: #f3f4f6;
}

.preview-img {
    display: block;
    max-width: 220px;
    max-height: 150px;
    margin-top: 8px;
    border: 1px solid #d8dde3;
    background: #f3f4f6;
    object-fit: contain;
}

.form-help {
    margin-top: 4px;
    color: #6b7280;
    font-size: 12px;
}

.form-grid textarea {
    border: 1px solid #aaa;
    padding: 6px;
    box-sizing: border-box;
}

.h120 {
    height: 120px;
}


/* Series manager */
.upload-drop-zone {
    width: 500px;
    min-height: 72px;
    border: 2px dashed #9ca3af;
    border-radius: 4px;
    background: #f9fafb;
    color: #4b5563;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    cursor: pointer;
    text-align: center;
}

.upload-drop-zone.drag-over {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
}

.hidden-file {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.series-image-manager {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #d8dde3;
}

.series-image-manager h4 {
    margin: 0 0 10px;
    font-size: 16px;
}

.series-image-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #d8dde3;
}

.series-detail-thumb {
    width: 300px;
    height: 300px;
    object-fit: cover;
    border: 1px solid #d8dde3;
    background: #f3f4f6;
}

.series-image-meta {
    flex: 1;
}

.series-image-meta label {
    display: inline-block;
    margin: 8px 6px 0 0;
}

@media (max-width: 760px) {
    .upload-drop-zone {
        width: 100%;
    }

    .series-image-item {
        flex-direction: column;
    }
}


.summary-box {
    line-height: 1.8;
}

.summary-box strong {
    margin-right: 8px;
}

.hidden-date-picker { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
