* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    min-height: 100vh;
}

body:not(.page-login):not(.page-dashboard) {
    display: grid;
    grid-template-rows: auto 1fr auto;
    grid-template-columns: 200px 1fr;
    grid-template-areas:
        "header header"
        "sidebar main"
        "footer footer";
}

.admin-header {
    grid-area: header;
    background: #1a252f;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    font-size: 1.25rem;
    color: #ecf0f1;
}

.admin-header nav a {
    color: #bdc3c7;
    text-decoration: none;
    margin-left: 1rem;
}

.admin-header nav a:hover {
    color: white;
}

.sidebar {
    grid-area: sidebar;
    background: #2c3e50;
    padding: 1rem;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
}

.sidebar nav a {
    color: #ecf0f1;
    text-decoration: none;
    padding: 0.5rem 0;
    border-bottom: 1px solid #34495e;
}

.sidebar nav a:hover {
    color: #3498db;
}

.admin-main {
    grid-area: main;
    padding: 2rem;
    background: #ecf0f1;
}

.admin-main h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.admin-footer {
    grid-area: footer;
    background: #1a252f;
    color: #95a5a6;
    text-align: center;
    padding: 0.75rem;
    font-size: 0.9rem;
}

/* ========== หน้า Login (หลังบ้าน) ========== */
.page-login {
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    padding: 2rem 1.5rem;
}

.login-container { max-width: 380px; width: 100%; text-align: center; }
.login-header { margin-bottom: 2rem; }
.login-logo {
    width: 120px; height: 120px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, #FF0FE3 0%, #FFF672 100%);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.login-logo img { width: 115%; height: 115%; object-fit: contain; }
.login-header h1 { font-size: 1.75rem; font-weight: 700; color: black; margin-bottom: 0.25rem; }
.login-subtitle { font-size: 0.95rem; color: #333; font-weight: 400; }
.login-form { margin-bottom: 1.5rem; }
.login-form .form-group { margin-bottom: 1.25rem; text-align: left; }
.login-form label { display: block; font-size: 0.9rem; color: black; margin-bottom: 0.4rem; font-weight: 500; }
.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%; padding: 0.75rem 1rem;
    border: 1px solid #ddd; border-radius: 8px; font-size: 0.95rem; outline: none;
}
.login-form input:focus { border-color: #ff6b9d; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 2.75rem; }
.toggle-password {
    position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; padding: 0.25rem;
}
.toggle-password .eye-icon { width: 20px; height: 20px; color: #666; }
.btn-login {
    width: 100%; padding: 0.875rem 1.5rem;
    background: #B50AB5; color: white; font-size: 1rem; font-weight: 600;
    border: none; border-radius: 20px; cursor: pointer; margin-top: 0.5rem;
}
.btn-login:hover { opacity: 0.9; }
.link-forgot { display: block; margin-top: 1rem; font-size: 0.9rem; color: #e74c3c; text-decoration: none; }
.link-forgot:hover { text-decoration: underline; }
.social-login { margin: 1.5rem 0; padding-top: 1.5rem; border-top: 1px solid #ddd; }
.social-divider { font-size: 0.85rem; color: #333; margin-bottom: 1rem; }
.social-buttons { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.social-btn { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; text-decoration: none; font-size: 0.9rem; font-weight: 500; border-radius: 8px; }
.social-btn svg { width: 22px; height: 22px; }
.social-facebook { color: #1877f2; }
.social-facebook svg { color: #1877f2; }
.social-line { color: #00b900; }
.social-line svg { color: #00b900; }
.social-sep { color: #ddd; font-size: 1rem; }
.register-text { font-size: 0.9rem; color: #333; }
.link-register { color: #e91e63; font-weight: 600; text-decoration: none; }
.link-register:hover { text-decoration: underline; }

/* ========== หน้า Dashboard (หลัง Login) ========== */
.page-dashboard {
    display: flex;
    flex-direction: column;
    background: white;
}

.dashboard-header {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem 1.25rem;
    background: white; border-bottom: 1px solid #eee;
}
.hamburger-btn {
    position: absolute;
    left: 1.25rem;
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    padding: 0.5rem; background: none; border: none; cursor: pointer;
}
.hamburger-line { width: 22px; height: 2px; background: black; display: block; }
.header-logo {
    display: flex; align-items: center; gap: 0.5rem;
    text-decoration: none; color: black; font-weight: 700; font-size: 1.1rem;
}
.header-logo-icon {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    background: linear-gradient(135deg, #FF0FE3 0%, #FFF672 100%);
    border-radius: 50%;
    overflow: hidden;
}
.header-logo img { width: 80%; height: 80%; object-fit: contain; }
.dashboard-main {
    flex: 1; padding: 2rem 1.5rem 6rem;
    display: flex; flex-direction: column; align-items: center;
}
.dashboard-title {
    font-size: 1.5rem; font-weight: 700; color: black;
    margin-bottom: 2rem; align-self: flex-start; width: 100%;
}
.add-shop-card {
    display: flex; flex-direction: column; align-items: center;
    background: none; border: none; cursor: pointer;
    color: black; max-width: 200px; font-family: inherit;
}
.add-shop-box {
    width: 120px; height: 120px; border: 2px dashed #333; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; margin-bottom: 0.75rem;
    transition: border-color 0.2s, background 0.2s;
}
.add-shop-card:hover .add-shop-box { border-color: #9c27b0; background: rgba(156, 39, 176, 0.05); }
.add-icon { font-size: 3rem; font-weight: 300; line-height: 1; }
.add-shop-label { font-size: 1rem; font-weight: 500; }
.dashboard-footer {
    background: #B50AB5; color: white; text-align: center; padding: 1rem 1.5rem;
}
.dashboard-footer p { margin: 0; font-size: 0.9rem; }

/* ========== Add Shop Modal ========== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    width: 100%;
    max-width: 380px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: black;
    margin-bottom: 0.25rem;
}

.modal-subtitle {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.modal-upload-area {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 140px;
    margin: 0 auto 1.5rem;
    border: 2px solid #2196F3;
    background: #f5f5f5;
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.modal-upload-area .preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.upload-icon {
    position: relative;
    color: #B50AB5;
}

.upload-icon svg {
    width: 48px;
    height: 48px;
}

.upload-plus {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #B50AB5;
    color: white;
    border-radius: 50%;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.modal-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
}

.modal-input:focus {
    border-color: #B50AB5;
}

.modal-select-wrap {
    position: relative;
}

.modal-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.btn-modal {
    padding: 0.6rem 1.5rem;
    border-radius: 24px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}

.btn-cancel {
    background: white;
    border: 2px solid #B50AB5;
    color: #B50AB5;
}

.btn-confirm {
    background: #B50AB5;
    border: none;
    color: white;
}

.btn-modal:hover {
    opacity: 0.9;
}

.btn-modal.btn-cancel {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Add Shop Page (full page form) */
.add-shop-page {
    align-items: center;
    justify-content: flex-start;
    padding-top: 2rem;
}

.add-shop-form-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* ========== Shop Settings Page (ตั้งค่าร้าน) ========== */
.shop-settings-page {
    align-items: flex-start;
    padding: 2rem 1.5rem 6rem;
}

.shop-settings-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

.shop-settings-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: black;
}

.btn-edit {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: inherit;
}

.btn-edit svg {
    width: 18px;
    height: 18px;
}

.shop-settings-form {
    width: 100%;
    max-width: 900px;
}

/* Add-shop layout ไปที่ add-shop.css */

@media (max-width: 768px) {
    .preview-card {
        width: 100%;
        padding: 1.5rem;
    }
    .preview-card-icon {
        width: 60px;
        height: 60px;
    }
    .preview-card-icon svg {
        width: 32px;
        height: 32px;
    }
    .preview-card-name {
        font-size: 1.1rem;
    }
    .preview-service-img-wrap {
        width: 80px;
        height: 80px;
    }
    .preview-actions {
        flex-wrap: wrap;
        justify-content: stretch;
    }
    .btn-preview {
        flex: 1;
        min-width: 120px;
    }
}


.image-upload-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.image-upload-box {
    width: 100%;
    aspect-ratio: 1;
    max-width: 200px;
    border: 2px dashed #ccc;
    background: #f9f9f9;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.image-upload-box:hover {
    border-color: #999;
    background: #f5f5f5;
}

.image-upload-box .preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-upload-box.has-image .image-placeholder {
    display: none;
}

.image-placeholder {
    width: 48px;
    height: 48px;
    color: #999;
}

.image-ratio {
    font-size: 0.85rem;
    color: #666;
}

.shop-settings-fields {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Outlined fields - label on border */
.shop-settings-fields .field-group-outlined {
    position: relative;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: white;
}

.shop-settings-fields .field-group-outlined:focus-within {
    border-color: #B50AB5;
}

.shop-settings-fields .field-group-outlined .field-floating-label {
    position: absolute;
    top: 0;
    left: 12px;
    transform: translateY(-50%);
    padding: 0 6px;
    background: white;
    font-size: 0.9rem;
    color: #555;
    pointer-events: none;
    z-index: 1;
}

.shop-settings-fields .field-group-outlined:focus-within .field-floating-label {
    color: #B50AB5;
}

.shop-settings-fields .field-group-outlined .field-input,
.shop-settings-fields .field-group-outlined .field-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    background: transparent;
    box-sizing: border-box;
}

.shop-settings-fields .field-group-outlined .field-textarea {
    border: none;
    padding: 0.75rem 1rem;
    resize: vertical;
    min-height: 80px;
}

.shop-settings-fields .field-group-color .field-color-wrap {
    padding: 0.5rem 1rem 0.75rem;
    border: none;
}

.shop-settings-fields .field-group-color .field-color-hex {
    border: none;
    background: transparent;
}

.shop-settings-fields .field-group-select .field-select {
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.field-label {
    font-size: 0.9rem;
    color: #333;
}

.field-input {
    padding: 0.65rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
}

.field-input:focus {
    border-color: #B50AB5;
}

.field-textarea {
    resize: vertical;
    min-height: 80px;
}

.field-color-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.field-color {
    width: 44px;
    height: 38px;
    padding: 2px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
}

.field-color-hex {
    flex: 1;
    font-family: monospace;
}

.field-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.field-radio-group {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
}

.radio-label input {
    width: 18px;
    height: 18px;
}

.shop-settings-preview {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

.preview-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
}

.preview-card {
    max-width: 420px;
    padding: 2rem;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.preview-card-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #F698A3;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    overflow: hidden;
}

.preview-card-icon .preview-logo-img {
    width: 115%;
    height: 115%;
    object-fit: contain;
}

.preview-card-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 0.25rem;
}

.preview-card-detail {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.preview-section-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 1rem 0;
    text-align: left;
}

.preview-service-cards {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.preview-service-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.preview-service-img-wrap {
    width: 100px;
    height: 100px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    background: #f5f5f5;
}

.preview-service-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-service-label {
    font-size: 0.85rem;
    color: #1a1a1a;
}

.preview-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn-preview {
    padding: 0.6rem 1.5rem;
    border-radius: 24px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
}

.btn-cancel {
    background: white;
    color: #B50AB5;
    border-color: #B50AB5;
}

.btn-cancel:hover {
    background: #faf5fa;
}

.btn-save {
    background: #B50AB5;
    color: white;
    border-color: #B50AB5;
}

.btn-save:hover {
    background: #9d089d;
}

/* ========== Sidebar Navbar Component ========== */
.sidebar-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

.sidebar-nav {
    position: fixed;
    top: 0; left: 0;
    width: 260px;
    height: 100vh;
    background: white;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-nav.open {
    transform: translateX(0);
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #eee;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: black;
    font-weight: 700;
    font-size: 1.1rem;
}

.sidebar-logo .header-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #FF0FE3 0%, #FFF672 100%);
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo .header-logo-icon img {
    width: 80%;
    height: 80%;
    object-fit: contain;
}

.sidebar-menu {
    padding: 1rem 0;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    color: black;
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.2s, color 0.2s;
}

.sidebar-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.sidebar-link:hover {
    background: #f5f5f5;
}

.sidebar-link.active {

    color: #b50ab5;
    font-weight: 600;
}

.sidebar-divider {
    height: 1px;
    background: #ddd;
    margin: 0 1rem;
}

.sidebar-menu-bottom {
    flex: 0;
    padding: 1rem 0;
}

.sidebar-link-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-link-user .user-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
