/* ============================================================
   Rooms.Net — App Design System
   Shared CSS for both public and management UI.
   Imported by _Layout.cshtml and _LayoutManagement.cshtml.
   ============================================================ */

/* ===== DESIGN TOKENS ===================================================== */

:root {
    --primary:           #007a33;
    --primary-hover:     #006b2d;
    --primary-light:     #f0faf4;
    --primary-subtle:    #d1f0de;

    --text-dark:         #111827;
    --text-body:         #374151;
    --text-muted:        #6b7280;
    --text-light:        #9ca3af;

    --border:            #e5e7eb;
    --border-dark:       #d1d5db;

    --bg-page:           #f8fafc;
    --bg-card:           #ffffff;
    --bg-subtle:         #f9fafb;

    --radius-sm:         6px;
    --radius-md:         10px;
    --radius-lg:         14px;

    --shadow-sm:         0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:         0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
    --shadow-lg:         0 10px 25px rgba(0,0,0,.10), 0 4px 10px rgba(0,0,0,.05);

    /* Status colour pairs */
    --s-active-bg:       #dcfce7; --s-active-tx:    #166534;
    --s-pending-bg:      #fef9c3; --s-pending-tx:   #854d0e;
    --s-info-bg:         #dbeafe; --s-info-tx:      #1e40af;
    --s-warning-bg:      #fff7ed; --s-warning-tx:   #9a3412;
    --s-danger-bg:       #fee2e2; --s-danger-tx:    #991b1b;
    --s-neutral-bg:      #f3f4f6; --s-neutral-tx:   #374151;

    /* Management sidebar */
    --sidebar-w:         240px;
    --topbar-h:          60px;
}


/* ===== GLOBAL BASE ======================================================== */

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-body);
    line-height: 1.6;
}


/* ===== STATUS BADGES ====================================================== */

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.status-badge.active,
.status-badge.accepted,
.status-badge.published  { background: var(--s-active-bg);  color: var(--s-active-tx); }
.status-badge.pending    { background: var(--s-pending-bg); color: var(--s-pending-tx); }
.status-badge.shortlisted,
.status-badge.viewed,
.status-badge.info       { background: var(--s-info-bg);    color: var(--s-info-tx); }
.status-badge.withdrawn,
.status-badge.warning    { background: var(--s-warning-bg); color: var(--s-warning-tx); }
.status-badge.rejected,
.status-badge.danger     { background: var(--s-danger-bg);  color: var(--s-danger-tx); }
.status-badge.inactive,
.status-badge.draft,
.status-badge.secondary  { background: var(--s-neutral-bg); color: var(--s-neutral-tx); }


/* ===== ACTION BUTTONS (small, semantic) =================================== */

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .15s;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.4;
    background: none;
}

.btn-action.primary  { background: var(--primary); color: #fff; }
.btn-action.primary:hover { background: var(--primary-hover); color: #fff; text-decoration: none; }

.btn-action.secondary { background: #fff; color: var(--text-dark); border-color: var(--border); }
.btn-action.secondary:hover { border-color: var(--border-dark); color: var(--text-dark); text-decoration: none; }

.btn-action.danger { background: #fff; color: var(--s-danger-tx); border-color: #fecaca; }
.btn-action.danger:hover { background: var(--s-danger-bg); border-color: #fca5a5; text-decoration: none; color: var(--s-danger-tx); }

.btn-action.success { background: #fff; color: var(--s-active-tx); border-color: #bbf7d0; }
.btn-action.success:hover { background: var(--s-active-bg); text-decoration: none; color: var(--s-active-tx); }

.btn-action.warning { background: #fff; color: var(--s-warning-tx); border-color: #fed7aa; }
.btn-action.warning:hover { background: var(--s-warning-bg); text-decoration: none; color: var(--s-warning-tx); }

/* Override Bootstrap primary to use brand green */
.btn-primary { background-color: var(--primary) !important; border-color: var(--primary) !important; }
.btn-primary:hover, .btn-primary:focus { background-color: var(--primary-hover) !important; border-color: var(--primary-hover) !important; }
.btn-outline-primary { color: var(--primary) !important; border-color: var(--primary) !important; }
.btn-outline-primary:hover { background-color: var(--primary) !important; color: #fff !important; }


/* ===== PAGE HEADER ======================================================== */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header-text { flex: 1; min-width: 0; }

.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.page-breadcrumb a   { color: var(--text-muted); text-decoration: none; }
.page-breadcrumb a:hover { color: var(--primary); }
.page-breadcrumb-sep { color: var(--text-light); }

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 4px;
    line-height: 1.3;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
}

.page-header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }


/* ===== EMPTY STATE ======================================================== */

.empty-state {
    text-align: center;
    padding: 56px 32px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.empty-state-icon {
    width: 60px;
    height: 60px;
    background: var(--bg-subtle);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 22px;
    color: var(--text-light);
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.empty-state-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0 auto 20px;
    max-width: 320px;
}


/* ===== DATA SECTION (card wrapper for tables / lists) ===================== */

.data-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.data-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.data-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}


/* ===== STAT CARDS ========================================================= */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s, transform .2s;
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 30px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 14px;
}

.stat-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all .15s;
}

.stat-action:hover { border-color: var(--primary); background: var(--primary-light); text-decoration: none; }


/* ===== ACTION CARDS ======================================================= */

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.action-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
    transition: all .2s;
}

.action-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    border-color: var(--primary);
    color: inherit;
    text-decoration: none;
}

.action-icon {
    width: 42px;
    height: 42px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 17px;
    flex-shrink: 0;
}

.action-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 2px;
}

.action-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}


/* ===== SECTION HEADING ==================================================== */

.section-heading {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 16px;
}


/* ===== FILTER PILLS ======================================================= */

.filter-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-pill { position: relative; }
.filter-pill input[type="radio"] { position: absolute; opacity: 0; width: 0; }

.filter-pill label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all .15s;
    background: var(--bg-card);
    user-select: none;
}

.filter-pill label:hover { border-color: var(--primary); color: var(--primary); }

.filter-pill input:checked + label {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.filter-pill-count {
    background: rgba(0,0,0,.12);
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 11px;
}

.filter-pill input:checked + label .filter-pill-count { background: rgba(255,255,255,.25); }


/* ===== ROOM/LISTING MANAGEMENT CARDS ===================================== */

.mgmt-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.mgmt-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all .2s;
    display: flex;
    flex-direction: column;
}

.mgmt-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.mgmt-card-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.mgmt-card-placeholder {
    height: 180px;
    background: var(--bg-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 32px;
}

.mgmt-card-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mgmt-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.mgmt-card-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.mgmt-card-price small {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
}

.mgmt-card-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

.mgmt-card-meta-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mgmt-card-meta-row i { width: 14px; text-align: center; color: var(--text-light); }

.mgmt-card-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.mgmt-card-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-subtle);
    flex-wrap: wrap;
}

.mgmt-card-footer {
    padding: 8px 16px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-light);
}


/* ===== PHOTO GRID (property/room edit) ==================================== */

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.photo-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-card);
}

.photo-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.photo-item-actions {
    padding: 8px;
    display: flex;
    gap: 6px;
    flex-direction: column;
}

.photo-main-badge {
    display: block;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    padding: 4px;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
}


/* ===== MANAGEMENT SHELL =================================================== */

.mgmt-body {
    background: var(--bg-page);
    min-height: 100vh;
    margin-bottom: 0 !important;
}

.mgmt-shell {
    display: flex;
    min-height: 100vh;
}


/* SIDEBAR */

.mgmt-sidebar {
    width: var(--sidebar-w);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    transition: transform .25s ease;
    overflow: hidden;
}

.sidebar-header {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-logo {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-logo:hover { color: var(--primary-hover); text-decoration: none; }

.sidebar-close {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 6px;
    border-radius: var(--radius-sm);
}

.sidebar-close:hover { background: var(--bg-subtle); }

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 14px 10px 5px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-body);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all .15s;
    margin-bottom: 1px;
}

.sidebar-link i {
    width: 18px;
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.sidebar-link:hover { background: var(--bg-subtle); color: var(--text-dark); text-decoration: none; }
.sidebar-link:hover i { color: var(--text-dark); }

.sidebar-link.active { background: var(--primary-light); color: var(--primary); }
.sidebar-link.active i { color: var(--primary); }

.sidebar-badge {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-avatar {
    width: 30px;
    height: 30px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-signout-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all .15s;
    font-size: 14px;
}

.sidebar-signout-btn:hover { background: var(--bg-subtle); color: var(--text-dark); }


/* TOPBAR */

.mgmt-topbar {
    height: var(--topbar-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 12px;
}

.topbar-menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 7px;
    cursor: pointer;
    color: var(--text-dark);
    border-radius: var(--radius-sm);
    font-size: 16px;
    line-height: 1;
}

.topbar-menu-toggle:hover { background: var(--bg-subtle); }

.topbar-title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: all .15s;
}

.topbar-link:hover { color: var(--text-dark); background: var(--bg-subtle); text-decoration: none; }


/* MAIN AREA */

.mgmt-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

.mgmt-content {
    flex: 1;
    padding: 28px 32px;
}


/* OVERLAY */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 150;
}

.sidebar-overlay.open { display: block; }


/* ===== MESSAGING ========================================================== */

.conversation-list { list-style: none; padding: 0; margin: 0; }

.conversation-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: background .15s;
}

.conversation-item:last-child { border-bottom: none; }
.conversation-item:hover { background: var(--bg-subtle); text-decoration: none; color: inherit; }
.conversation-item.unread { border-left: 3px solid var(--primary); }

.conversation-avatar {
    width: 38px;
    height: 38px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.conversation-body { flex: 1; min-width: 0; }
.conversation-header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.conversation-subject { font-size: 14px; font-weight: 600; color: var(--text-dark); }
.conversation-time { font-size: 12px; color: var(--text-light); white-space: nowrap; }
.conversation-with { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.conversation-preview { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; }


/* ===== PUBLIC: override _Layout.cshtml.css cruft ========================== */

a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }


/* ===== MGMT GRID (alias for mgmt-card-grid) ================================ */

.mgmt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.mgmt-card-img--placeholder {
    height: 160px;
    background: var(--bg-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 36px;
    border-radius: 10px 10px 0 0;
}

/* A listing with no photos, shown as something to act on rather than as a
   neutral empty state. It is the most valuable thing a landlord can fix. */
.mgmt-card-img--needs-photos {
    height: 160px;
    background: #fffbeb;
    border: 1px dashed #fde68a;
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #92400e;
    font-size: 26px;
    text-decoration: none;
    transition: background .15s;
}

.mgmt-card-img--needs-photos:hover {
    background: #fef3c7;
    color: #92400e;
}

.mgmt-card-img--needs-photos span {
    font-size: 13px;
    font-weight: 600;
}

/* ===== CONVERSATION ROW ==================================================== */

.conversation-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: background .15s;
}

.conversation-row:last-child { border-bottom: none; }

.conversation-row:hover { background: var(--bg-subtle); }

.conversation-row--unread { border-left: 3px solid var(--primary); }

/* ===== CHAT BUBBLES ======================================================== */

.chat-bubble {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}

.chat-bubble--mine { align-self: flex-end; align-items: flex-end; }

.chat-bubble--theirs { align-self: flex-start; align-items: flex-start; }

.chat-bubble-content {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.chat-bubble--mine .chat-bubble-content {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-bubble--theirs .chat-bubble-content {
    background: var(--bg-subtle);
    color: var(--text-dark);
    border-bottom-left-radius: 4px;
}

.chat-bubble-meta {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
    padding: 0 4px;
}

/* ===== RESPONSIVE ========================================================= */

@media (max-width: 900px) {
    .mgmt-sidebar { transform: translateX(-100%); }
    .mgmt-sidebar.open { transform: translateX(0); }
    .sidebar-close { display: flex; }
    .mgmt-main { margin-left: 0; }
    .topbar-menu-toggle { display: flex; }
    .mgmt-content { padding: 20px 16px; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; align-items: stretch; }
    .page-header-actions { justify-content: flex-start; }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .mgmt-card-grid { grid-template-columns: 1fr; }
    .action-grid { grid-template-columns: 1fr; }
}

/* ===== FORM FIELDS ========================================================= */

.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    line-height: 1.5;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,122,51,.1);
}

.form-control.is-invalid { border-color: #ef4444; }

.form-control:disabled,
.form-control[readonly] { background: var(--bg-subtle); color: var(--text-muted); cursor: not-allowed; }

select.form-control { appearance: auto; }

textarea.form-control { resize: vertical; min-height: 80px; }

.invalid-feedback { color: #ef4444; font-size: 12px; margin-top: 4px; display: none; }
.invalid-feedback.d-block,
.form-control.is-invalid ~ .invalid-feedback { display: block; }

.form-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; display: block; }
.text-muted { color: var(--text-muted) !important; }
.text-danger { color: #ef4444 !important; }

.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.form-check-input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.form-check-label { font-size: 14px; color: var(--text-dark); cursor: pointer; }

.field-group { margin-bottom: 28px; }
.field-group-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.field-group-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; margin-top: -8px; }
.field-group-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }

.form-actions { display: flex; gap: 10px; margin-top: 24px; }

/* ===== TABLE COMPONENT ===================================================== */

.table-component { width: 100%; display: block; }
.table-component .tabulator { width: 100% !important; min-width: 0 !important; }
.table-component .tabulator .tabulator-tableholder { width: 100% !important; }
.table-component .tabulator .tabulator-header { width: 100% !important; }

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.table-toolbar-left { display: flex; gap: 8px; align-items: center; }
.table-toolbar-right { display: flex; gap: 8px; align-items: center; }

.table-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    min-width: 220px;
}

.table-search-icon { color: var(--text-muted); font-size: 13px; }

.table-search-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--text-dark);
    font-family: inherit;
    width: 100%;
}

.table-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-subtle);
}

.table-info-text { font-size: 13px; color: var(--text-muted); }

.row-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
}
.row-action-btn:hover { background: var(--bg-subtle); border-color: #9ca3af; color: var(--text-dark); }
.row-action-btn:last-child:hover { border-color: #fca5a5; color: #dc2626; background: #fff5f5; }

/* ===== STEPPER FIELD ======================================================= */

.stepper-field {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    width: 140px;
}
.stepper-btn {
    flex-shrink: 0;
    width: 38px;
    height: 42px;
    border: none;
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
    user-select: none;
}
.stepper-btn:hover { background: #e5e7eb; color: var(--text-dark); }
.stepper-btn:active { background: #d1d5db; }
.stepper-input {
    flex: 1;
    min-width: 0;
    text-align: center;
    border: none;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    height: 42px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    background: #fff;
    padding: 0;
    -moz-appearance: textfield;
}
.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.stepper-input:focus { outline: none; background: #f0fdf4; }

/* ===== IMAGE UPLOAD ZONE =================================================== */

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: var(--bg-subtle);
}
.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--primary);
    background: #f0fdf4;
}
.upload-zone-icon {
    font-size: 36px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 12px;
}
.upload-zone-title {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-dark);
}
.upload-zone-link { color: var(--primary); text-decoration: underline; }
.upload-zone-hint { margin: 0; font-size: 13px; color: var(--text-muted); }

.upload-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}
.upload-preview-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 90px;
}
.upload-preview-item img {
    width: 90px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.upload-preview-item span {
    font-size: 11px;
    color: var(--text-muted);
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}
