/* 
   MASTER ADMIN CUSTOM CSS V6 - PREMIUM REBOOT
   Aesthetics: Modern SaaS, High-Contrast, Professional, Glassmorphic
*/



/* ── 1. GLOBAL DESIGN TOKENS ── */
:root {
    --brand-primary: #4f46e5;
    --brand-secondary: #7c3aed;
    --brand-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --brand-glow: rgba(79, 70, 229, 0.25);

    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    --success-bg: #f0fdf4;
    --success-text: #166534;
    --error-bg: #fef2f2;
    --error-text: #991b1b;
    --danger-color: #ef4444;
}

/* Enhanced Error Visibility - No longer hidden as per diagnostic need */
.errornote {
    background: #fff1f2 !important;
    border: 1px solid #fecaca !important;
    color: #b91c1c !important;
    padding: 16px 20px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    margin-bottom: 25px !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.1) !important;
}
.errornote::before {
    content: '\f071';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 1.2rem;
}

/* ── 2. BASE LAYOUT & TYPOGRAPHY ── */
body.layout-fixed {
    background-color: var(--slate-50) !important;
    font-family: 'Inter', sans-serif !important;
    color: var(--slate-800) !important;
    /* Deep, professional indigo-slate */
}

/* Global Link Color Override */
a,
a:link,
a:visited {
    color: var(--brand-primary);
    transition: color 0.15s ease;
}

a:hover {
    color: var(--brand-secondary);
    text-decoration: none;
}

.app-main {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    padding-bottom: 50px !important;
}

/* Hide redundant elements */
.content-header,
.breadcrumbs,
.app-content-header {
    display: none !important;
}

/* ── 2.1 LEGACY SYSTEM OVERRIDES (Teal/Cyan/Success Removal) ── */
.bg-info,
.btn-info,
.badge-info,
.info-box-icon.bg-info {
    background-color: var(--brand-primary) !important;
    color: white !important;
}

.text-info,
.text-cyan,
.text-teal {
    color: var(--brand-primary) !important;
}

.btn-success,
.badge-success,
.bg-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    /* Premium Emerald instead of standard Green */
    border: none !important;
}

.custom-control-input:checked~.custom-control-label::before {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
}

/* ── 3. PREMIUM TABLE OVERHAUL ── */
.card .table-responsive {
    border-radius: 0 0 18px 18px !important;
    overflow: auto !important;
    /* Fixed: Allow scroll for responsive tables */
}

.table {
    margin-bottom: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

/* Glassmorphic Header */
.table thead th {
    background: rgba(248, 250, 252, 0.9) !important;
    backdrop-filter: blur(8px) !important;
    color: var(--brand-primary) !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    font-size: 0.72rem !important;
    letter-spacing: 0.08em !important;
    padding: 16px 20px !important;
    border-top: none !important;
    border-bottom: 2px solid var(--brand-primary) !important;
    white-space: nowrap !important;
}

.table thead th a,
.table thead th a:link,
.table thead th a:visited {
    color: var(--brand-primary) !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    text-decoration: none !important;
}

.table thead th a:hover {
    color: var(--brand-secondary) !important;
    text-decoration: underline !important;
}

/* Sorting indicators fix */
.table thead th.sortable.sorted .sortoptions,
.table thead th.sortable.sorted .sortcycle,
.table thead th.sortable.sorted .sorting {
    color: var(--brand-primary) !important;
}

.table tbody td {
    padding: 14px 20px !important;
    vertical-align: middle !important;
    font-size: 0.92rem !important;
    color: var(--slate-700) !important;
    border-bottom: 1px solid var(--slate-100) !important;
    transition: background 0.2s ease !important;
}

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

/* Row Hover Interaction */
.table tbody tr:hover td {
    background-color: rgba(79, 70, 229, 0.03) !important;
    color: var(--slate-900) !important;
}

/* Zebra Striping */
.table-striped tbody tr:nth-of-type(odd) td {
    background-color: #fafbfc !important;
}

/* Selection Highlight */
.table tbody tr.selected td {
    background-color: rgba(79, 70, 229, 0.08) !important;
}

/* ── 4. PREMIUM BUTTON SYSTEM ── */
/* Base Overrides for ALL Admin Buttons */
.btn {
    border-radius: 12px !important;
    font-weight: 700 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    padding: 10px 20px !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    font-size: 0.88rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.btn:active {
    transform: scale(0.97) !important;
}

/* Primary Action Glow Buttons */
.btn-primary,
.button.default,
input[type="submit"].default {
    background: var(--brand-gradient) !important;
    border: none !important;
    color: white !important;
    box-shadow: 0 4px 14px var(--brand-glow) !important;
}

.btn-primary:hover,
.button.default:hover,
input[type="submit"].default:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35) !important;
    background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%) !important;
}

/* Secondary / Outline Buttons — Now consistently 브랜드 Indigo with White Text */
.btn-secondary,
a.button,
input[type="submit"],
input[type="button"],
.btn-default {
    background: var(--brand-primary) !important;
    border: 1px solid var(--brand-primary) !important;
    color: white !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05) !important;
}

/* Results Table Premium Wrap */
.premium-table-wrap {
    background: white !important;
    border-radius: 20px !important;
    border: 1px solid var(--slate-200) !important;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05) !important;
    overflow-x: auto !important;
    /* Allow horizontal scroll for large tables */
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.premium-table-wrap table {
    width: 100%;
    margin: 0 !important;
    border-collapse: collapse !important;
}

.btn-secondary:hover,
a.button:hover,
input[type="submit"]:hover,
.btn-default:hover {
    background: var(--brand-secondary) !important;
    border-color: var(--brand-secondary) !important;
    color: white !important;
    transform: translateY(-1px) !important;
}

/* Delete / Danger Buttons */
.btn-danger,
a.deletelink {
    background: #ef4444 !important;
    /* Solid Red for white text contrast */
    color: white !important;
    border: none !important;
}

.btn-danger:hover,
a.deletelink:hover {
    background: #dc2626 !important;
    color: white !important;
}

/* ── 5. DROPDOWN & INPUT PERFECTION ── */
/* Global select overrides */
select,
.form-control,
.vTextField,
.vURLField,
.vLargeTextField {
    border-radius: 12px !important;
    border: 1px solid var(--slate-300) !important;
    padding: 12px 16px !important;
    background-color: var(--slate-50) !important;
    color: var(--slate-800) !important;
    font-weight: 500 !important;
    transition: all 0.2s !important;
}

select:focus,
.form-control:focus {
    outline: none !important;
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1) !important;
    background-color: white !important;
}

/* Select2 Modernization */
.select2-container--default .select2-selection--single {
    border-radius: 12px !important;
    border: 1px solid var(--slate-300) !important;
    height: 48px !important;
    background-color: var(--slate-50) !important;
    padding: 8px 16px !important;
}

.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1) !important;
}

.select2-dropdown {
    border-radius: 16px !important;
    border: 1px solid var(--slate-200) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12) !important;
    padding: 8px !important;
}

.select2-results__option--highlighted[aria-selected] {
    background-color: rgba(79, 70, 229, 0.08) !important;
    color: var(--brand-primary) !important;
    border-radius: 10px !important;
}

/* ── 6. LIST VIEW & FILTERS REFINEMENT ── */
.premium-filter-badge {
    padding: 6px 14px !important;
    background: white !important;
    border: 1px solid var(--slate-200) !important;
    border-radius: 50px !important;
    font-weight: 600 !important;
    color: var(--slate-600) !important;
    font-size: 0.82rem !important;
    transition: all 0.2s !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.premium-filter-badge:hover {
    border-color: var(--brand-primary) !important;
    color: var(--brand-primary) !important;
    background: rgba(79, 70, 229, 0.04) !important;
}

.filter-active-indicator {
    width: 6px;
    height: 6px;
    background: var(--brand-primary);
    border-radius: 50%;
}

/* Search Bar in List View */
#changelist-search .premium-search-wrapper {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--slate-200);
    padding: 0 15px;
}

/* ── 7. CARD & CONTAINER POLISH ── */
.card {
    border: 1px solid var(--slate-200) !important;
    border-radius: 20px !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.01) !important;
    background: white !important;
}

.card-header {
    background: transparent !important;
    border-bottom: 2px solid var(--slate-100) !important;
    padding: 20px 24px !important;
}

/* ── 8. MODAL & OVERLAY BLUR ── */
.modal-content {
    border-radius: 24px !important;
    border: none !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3) !important;
}

.modal-backdrop {
    backdrop-filter: blur(5px) !important;
    background-color: rgba(15, 23, 42, 0.7) !important;
}

/* ── 9. SCROLLBARS ── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--slate-300);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--slate-400);
}

ul {
    list-style: none;
}

a,
a:link,
a:visited {
    color: var(--brand-primary);
    transition: color 0.15s ease;
}

li a {
    color: white !important;
}

.object-tools {
    display: flex !important;
    gap: 1rem;
}

/* ── 10. PREMIUM FORM LAYOUTS (Add/Change Pages) ── */
.custom-entry-wrap {
    padding-top: 50px !important;
    padding-bottom: 80px !important;
}

.app-footer {
    bottom: 0;
    left: 260px;
    /* Offset for custom sidebar */
    right: 0;
    background: rgba(255, 255, 255, 0.82) !important;
    backdrop-filter: blur(16px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
    border-top: 1px solid rgba(226, 232, 240, 0.8) !important;
    /* Matching header border style */
    padding: 15px 30px !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 15px !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05) !important;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden !important;
}

.app-footer .expanded {
    left: 80px;
}

@media (max-width: 992px) {
    .app-footer {
        left: 0 !important;
    }
}

/* Footer Top Gradient Line — Matching Header Style */
.app-footer ::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-primary), #10b981, #06b6d4, var(--brand-secondary));
    background-size: 100% 100%;
    /* Reset scale */
}



/* ── 11. MOBILE RESPONSIVENESS PATCHES ── */
@media (max-width: 768px) {
    #content {
        padding: 15px !important;
    }

    .dash-hero {
        padding-bottom: 15px;
    }

    .dash-hero h1 {
        font-size: 1.4rem !important;
    }

    .premium-table-wrap {
        border-radius: 12px !important;
    }

    /* Table specific responsive adjustments */
    #result_list th,
    #result_list td {
        padding: 12px 10px !important;
        font-size: 0.85rem !important;
        white-space: nowrap;
        /* Prevent messy wrapping in dense leads tables */
    }

    .custom-entry-wrap {
        padding-top: 30px !important;
    }

    .app-footer {
        bottom: 15px;
        padding: 15px 20px !important;
        border-radius: 15px !important;
        flex-wrap: wrap;
        justify-content: center !important;
    }
}

.page-link {

    background-color: var(--brand-primary) !important;
    color: white !important;
}