/* ==========================================================================
   Layout dark mode overrides
   반드시 [data-theme="dark"] 안에서만 적용
   ========================================================================== */

   [data-theme="dark"] .top-bar-primary {
    background-color: #0b0b0b;
    border-bottom-color: #3d3d3d;
}

[data-theme="dark"] .top-bar-secondary {
    background-color: #0b0b0b;
    border-bottom-color: #3d3d3d;
}

[data-theme="dark"] .brand-logo-text {
    color: #ffffff;
}

[data-theme="dark"] .category-link {
    color: #e0e0e0;
}
[data-theme="dark"] .category-link:hover {
    color: #ffffff;
}
[data-theme="dark"] .category-link.active {
    color: #ffffff;
    border-bottom-color: #eac4ff;
    font-weight: 700;
}

[data-theme="dark"] .sidebar {
    background-color: #0b0b0b;
    border-right-color: #3d3d3d;
}

[data-theme="dark"] .sidebar-title        { color: #e0e0e0; }
[data-theme="dark"] .sidebar-section-title { color: #c0c0c0; }
[data-theme="dark"] .sidebar-link         { color: #ffffff; }
[data-theme="dark"] .sidebar-link:hover   { background-color: #2f2f2f; color: #ececec;; }
[data-theme="dark"] .sidebar-link.active  { background-color: #2f2f2f; color: #eac4ff; font-weight: 600; }

[data-theme="dark"] .content-area { background-color: #2f2f2f; }

[data-theme="dark"] .app-container { background-color: #2f2f2f; }

/* placeholder 다크모드 */
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #c0c0c0 !important;
}

/* 테이블 라인 */
[data-theme="dark"] .org-table td,
[data-theme="dark"] .member-table td,
[data-theme="dark"] .notif-table td {
    border-bottom-color: #2f2f2f;
}

/* 흰색 배경 카드 강제 override */
[data-theme="dark"] .summary-card,
[data-theme="dark"] .table-container,
[data-theme="dark"] .metric-card,
[data-theme="dark"] .filter-container {
    background-color: #272727 !important;
    border-color: #3d3d3d !important;
}

[data-theme="dark"] .org-table th,
[data-theme="dark"] .member-table th,
[data-theme="dark"] .notif-table th,
[data-theme="dark"] .audit-table th {
    background-color: #272727;
    border-bottom-color: #3d3d3d;
    color: #c0c0c0;
}

[data-theme="dark"] .org-table td,
[data-theme="dark"] .member-table td,
[data-theme="dark"] .notif-table td,
[data-theme="dark"] .audit-table td {
    color: #e0e0e0;
    border-bottom-color: #2f2f2f;
}

[data-theme="dark"] .org-table tbody tr:hover,
[data-theme="dark"] .member-table tbody tr:hover,
[data-theme="dark"] .notif-table tbody tr:hover,
[data-theme="dark"] .audit-table tbody tr:hover {
    background-color: #2f2f2f;
}

/* 페이지 타이틀 — Bootstrap text-dark 강제 override */
[data-theme="dark"] .text-dark {
    color: #ececec !important;
}

[data-theme="dark"] .text-muted {
    color: #c0c0c0 !important;
}

/* ── 버튼 다크모드 ── */
[data-theme="dark"] .btn-primary {
    background:   #eac4ff;
    border-color: #eac4ff;
    color:        #1a1a1a;
}
[data-theme="dark"] .btn-primary:hover { background: #d4a8f0; border-color: #d4a8f0; }

[data-theme="dark"] .btn-secondary {
    background:   #2f2f2f;
    border-color: #3d3d3d;
    color:        #e0e0e0;
}
[data-theme="dark"] .btn-secondary:hover { background: #3d3d3d; border-color: #c0c0c0; color: #ffffff; }

[data-theme="dark"] .btn-danger-outline {
    background:   #2f2f2f;
    border-color: #7f1d1d;
    color:        #fca5a5;
}

[data-theme="dark"] .btn-revoke {
    background:   transparent;
    border-color: #7f1d1d;
    color:        #fca5a5;
}

[data-theme="dark"] .add-org-btn,
[data-theme="dark"] .invite-btn,
[data-theme="dark"] .seal-notice-btn,
[data-theme="dark"] .btn-modal-primary {
    background:   #eac4ff;
    color:        #1a1a1a;
    border-color: #eac4ff;
}
[data-theme="dark"] .add-org-btn:hover,
[data-theme="dark"] .invite-btn:hover,
[data-theme="dark"] .btn-modal-primary:hover { background: #d4a8f0; }

/* ── 카드/컨테이너 다크모드 ── */
[data-theme="dark"] .card-panel,
[data-theme="dark"] .modal-card,
[data-theme="dark"] .modal-panel,
[data-theme="dark"] .kebab-menu,
[data-theme="dark"] .table-container {
    background:   #272727;
    border-color: #2f2f2f;
}

[data-theme="dark"] .org-header { background: #2f2f2f; border-bottom-color: #3d3d3d; }

/* ── action icon 버튼 ── */
[data-theme="dark"] .action-icon-btn {
    border-color: #3d3d3d;
    color:        #808080;
}
[data-theme="dark"] .action-icon-btn:hover {
    background:   #2f2f2f;
    border-color: #c0c0c0;
    color:        #ffffff;
}

/* ── Mark all / filter tab ── */
[data-theme="dark"] .mark-all-btn {
    background:   #2f2f2f;
    border-color: #3d3d3d;
    color:        #e0e0e0;
}
[data-theme="dark"] .filter-tab        { border-color: #3d3d3d; color: #c0c0c0; }
[data-theme="dark"] .filter-tab:hover  { background: #2f2f2f; color: #e0e0e0; }
[data-theme="dark"] .filter-tab.active { background: #eac4ff; border-color: #eac4ff; color: #1a1a1a; }

/* ── btn-dark (Audit Search) ── */
[data-theme="dark"] .btn-dark {
    background:   #eac4ff;
    border-color: #eac4ff;
    color:        #1a1a1a;
}

/* ── search input ── */
[data-theme="dark"] .search-input {
    background: #2f2f2f;
    border-color: #3d3d3d;
    color: #ffffff;
}

/* ── Refresh / 보조 버튼 ── */
[data-theme="dark"] .btn-detail-outline,
[data-theme="dark"] .resend-btn {
    background:   #2f2f2f;
    border-color: #3d3d3d;
    color:        #e0e0e0;
}
[data-theme="dark"] .btn-detail-outline:hover,
[data-theme="dark"] .resend-btn:hover {
    background:   #3d3d3d;
    color:        #ffffff;
}

/* ── 테이블 row 흰 배경 강제 제거 ── */
[data-theme="dark"] table,
[data-theme="dark"] .org-table tbody tr,
[data-theme="dark"] .member-table tbody tr,
[data-theme="dark"] .notif-table tbody tr,
[data-theme="dark"] .audit-table tbody tr,
[data-theme="dark"] .key-table tbody tr {
    background-color: transparent !important;
    color: #e0e0e0;
}

[data-theme="dark"] .org-table tbody tr:hover,
[data-theme="dark"] .member-table tbody tr:hover,
[data-theme="dark"] .notif-table tbody tr:hover,
[data-theme="dark"] .audit-table tbody tr:hover,
[data-theme="dark"] .key-table tbody tr:hover {
    background-color: #2f2f2f !important;
}

/* ── Dropdown (Bootstrap select) ── */
[data-theme="dark"] select,
[data-theme="dark"] .form-select {
    background-color: #2f2f2f !important;
    border-color:     #3d3d3d !important;
    color:            #ececec !important;
}

[data-theme="dark"] option {
    background-color: #2f2f2f;
    color:            #ececec;
}

/* ── Pending 뱃지 (경고 계열 색상 통일) ── */
[data-theme="dark"] .kyc-badge.pending,
[data-theme="dark"] .status-pending,
[data-theme="dark"] .status-pending-badge {
    background:   #2d1b00 !important;
    color:        #fb923c !important;
    border-color: #78350f !important;
}

/* ── filter-select (멤버 페이지 All Roles) ── */
[data-theme="dark"] .filter-select {
    color:       #e0e0e0;
    background:  transparent;
}

/* ── Upload Logo label 버튼 ── */
[data-theme="dark"] label[style*="background:#ffffff"],
[data-theme="dark"] label[style*="background: #ffffff"] {
    background: #2f2f2f !important;
    border-color: #3d3d3d !important;
    color: #e0e0e0 !important;
}

/* ── Remove 버튼 (인라인 스타일 override) ── */
[data-theme="dark"] button[style*="background:none"][style*="border:1px solid #fecaca"],
[data-theme="dark"] button[style*="background: none"][style*="border: 1px solid #fecaca"] {
    background: #2d1111 !important;
    border-color: #7f1d1d !important;
    color: #fca5a5 !important;
}

/* ── Danger Zone 카드 테두리 ── */
[data-theme="dark"] .danger-zone {
    border-color: #7f1d1d !important;
    background:   #272727 !important;
}

/* ── Transfer 버튼 (btn-danger-outline) ── */
[data-theme="dark"] .btn-danger-outline {
    background:   #2d1111;
    border-color: #7f1d1d;
    color:        #fca5a5;
}
[data-theme="dark"] .btn-danger-outline:hover {
    background: #3d1515;
}

/* ── input, textarea 다크 배경 ── */
[data-theme="dark"] .field-input,
[data-theme="dark"] .field-textarea,
[data-theme="dark"] .field-select {
    background:   #2f2f2f !important;
    border-color: #3d3d3d !important;
    color:        #ececec !important;
}

/* ══ 1. 테이블 row 흰 배경 완전 제거 ══ */
[data-theme="dark"] tr {
    background-color: transparent !important;
}
[data-theme="dark"] tbody tr:hover {
    background-color: #2f2f2f !important;
}

/* ══ 2. content-area — Aspire #272727 ══ */
[data-theme="dark"] .content-area,
[data-theme="dark"] .app-container {
    background-color: #272727 !important;
}

/* ══ 3. Hobby 배지 (Bootstrap bg-light) ══ */
[data-theme="dark"] .badge.bg-light,
[data-theme="dark"] .bg-light {
    background-color: #2f2f2f !important;
    color: #e0e0e0 !important;
    border-color: #3d3d3d !important;
}

/* ══ 4. Development 배지 — env-dev 다크 ══ */
[data-theme="dark"] .env-dev {
    background: #1e1b4b;
    color: #a5b4fc;
}
[data-theme="dark"] .env-prod    { background: #052e16; color: #86efac; }
[data-theme="dark"] .env-staging { background: #2d1b00; color: #fdba74; }
[data-theme="dark"] .env-testing { background: #0c1a3a; color: #7dd3fc; }

/* ══ 4. app-card 로고 흰 배경 ══ */
[data-theme="dark"] .app-icon {
    background-color: #2f2f2f !important;
    border: 1px solid #3d3d3d;
}
/* app-icon 배경색이 인라인 style로 하드코딩된 경우 */
[data-theme="dark"] .app-card .app-icon img {
    filter: brightness(0.85);
}

/* ══ 4. Add card hover ══ */
[data-theme="dark"] .add-app-card:hover {
    border-color: #eac4ff;
    background-color: #272727;
}
[data-theme="dark"] .add-app-card:hover .add-app-icon {
    background-color: #eac4ff;
    color: #1a1a1a;
}

/* ══ type badges 다크 ══ */
[data-theme="dark"] .type-web    { background: #0c1a3a; color: #93c5fd; }
[data-theme="dark"] .type-mobile { background: #052e16; color: #86efac; }
[data-theme="dark"] .type-api    { background: #1e1b4b; color: #c4b5fd; }
[data-theme="dark"] .type-micro  { background: #2d1b00; color: #fdba74; }

/* ══ 1. 녹색 success 배너 다크 ══ */
[data-theme="dark"] .seal-notice.success {
    background: #052e16 !important;
    border-color: #14532d !important;
    color: #86efac !important;
}

/* ══ 2. 탭 active 언더라인 — 전체 ══ */
/* category-link (상단 탭바) */
[data-theme="dark"] .category-link.active {
    border-bottom-color: #eac4ff !important;  /* 어두운 회색으로 */
}

/* settings-tab (Settings 내부 탭) */
[data-theme="dark"] .settings-tab.active {
    border-bottom-color: #eac4ff !important;
}

/* seal-tab (Authority Seals / Device Inventory) */
[data-theme="dark"] .seal-tab.active {
    border-bottom-color: #eac4ff !important;
}

/* member-tab (All Members / Invited) */
[data-theme="dark"] .member-tab.active {
    border-bottom-color: #eac4ff !important;
}

/* settings-tabs 하단 구분선 */
[data-theme="dark"] .settings-tabs {
    border-bottom-color: #2f2f2f !important;
}

/* tab-header-bar 하단 구분선 */
[data-theme="dark"] .tab-header-bar {
    border-bottom-color: #2f2f2f !important;
}

/* 상단 탭바 전체 border */
[data-theme="dark"] .top-bar-secondary {
    border-bottom-color: #2f2f2f !important;
}

/* type-badge.master 다크 */
[data-theme="dark"] .type-badge.master {
    background: #ececec;
    color: #272727;
    border-color: #ececec;
}

/* ══ 모달 카드 내부 텍스트 ══ */
[data-theme="dark"] .modal-card h4,
[data-theme="dark"] .modal-card h5,
[data-theme="dark"] .modal-card .fw-bold {
    color: #ffffff !important;
}

[data-theme="dark"] .modal-card .form-label {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .modal-card .text-muted {
    color: #c0c0c0 !important;
}

[data-theme="dark"] .modal-card .text-dark {
    color: #ffffff !important;
}

/* ══ 모달 내 Bootstrap form-control / form-select ══ */
[data-theme="dark"] .modal-card .form-control,
[data-theme="dark"] .modal-card .form-select {
    background-color: #2f2f2f !important;
    border-color: #3d3d3d !important;
    color: #ececec !important;
}

/* ══ Cancel 버튼 (btn btn-sm + inline border) ══ */
[data-theme="dark"] .modal-card .btn:not(.btn-dark):not(.btn-primary) {
    background-color: #2f2f2f !important;
    border-color: #3d3d3d !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .modal-card .btn-dark {
    background-color: #eac4ff !important;
    border-color: #eac4ff !important;
    color: #1a1a1a !important;
}

/* ══ URL hint 텍스트 ══ */
[data-theme="dark"] .modal-card .text-muted small,
[data-theme="dark"] .modal-card small {
    color: #c0c0c0 !important;
}

/* ── RolesDetail 탭 (Permission Templates / Assigned Members) ── */
[data-theme="dark"] .section-tabs .tab-item,
[data-theme="dark"] .role-tab {
    color: #c0c0c0;
    border-bottom-color: transparent;
}
[data-theme="dark"] .section-tabs .tab-item.active,
[data-theme="dark"] .role-tab.active {
    color: #ececec;
    border-bottom-color: #eac4ff;
}

/* ── Add Permission 모달 버튼 통일 ── */
[data-theme="dark"] .btn-modal-confirm {
    background: #eac4ff !important;
    border-color: #eac4ff !important;
    color: #1a1a1a !important;
}
[data-theme="dark"] .btn-modal-cancel {
    background: #2f2f2f !important;
    border-color: #3d3d3d !important;
    color: #e0e0e0 !important;
}

/* ── preset-badge 다크 ── */
[data-theme="dark"] .preset-badge {
    background: #2f2f2f;
    border-color: #3d3d3d;
    color: #e0e0e0;
}

/* ── SDK 배지 / key-prefix 다크 ── */
[data-theme="dark"] .key-prefix {
    background: #2f2f2f !important;
    border-color: #3d3d3d !important;
    color: #e0e0e0 !important;
}

/* ── section-tab 언더라인 다크 ── */
[data-theme="dark"] .section-tab.active {
    color: #ececec !important;
    border-bottom-color: #eac4ff !important;
}
[data-theme="dark"] .section-tabs {
    border-bottom-color: #2f2f2f !important;
}

/* ── btn-add (Add Permission) — dark에서 accent가 밝아서 override ── */
[data-theme="dark"] .btn-add {
    background:   #eac4ff !important;
    border-color: #eac4ff !important;
    color:        #1a1a1a !important;
}
[data-theme="dark"] .btn-add-outline {
    background:   #2f2f2f !important;
    border-color: #3d3d3d !important;
    color:        #e0e0e0 !important;
}

/* ── pg-btn.active (pagination) ── */
[data-theme="dark"] .pg-btn.active {
    background:   #eac4ff !important;
    border-color: #eac4ff !important;
    color:        #1a1a1a !important;
}

/* ── btn-create (Create Role) ── */
[data-theme="dark"] .btn-create {
    background:   #eac4ff !important;
    border-color: #eac4ff !important;
    color:        #1a1a1a !important;
}

/* ── Notification category-badge 다크 ── */
[data-theme="dark"] .category-badge {
    background:   #2f2f2f !important;
    border-color: #3d3d3d !important;
    color:        #e0e0e0 !important;
}

/* ── Notification status-badge 다크 ── */
[data-theme="dark"] .status-badge.read {
    background:   #2f2f2f !important;
    border-color: #3d3d3d !important;
    color:        #808080 !important;
}

[data-theme="dark"] .status-badge.unread {
    background:   #1e1b4b !important;
    border-color: #4338ca !important;
    color:        #a5b4fc !important;
}

/* ── type-text (SystemAnnouncement 등) 다크 ── */
[data-theme="dark"] .type-text {
    color: #c0c0c0 !important;
}
/* ── radio-option 다크 ── */
[data-theme="dark"] .radio-option {
    color: #e0e0e0;
    border-color: #3d3d3d;
    background: #272727;
}
[data-theme="dark"] .radio-option.selected {
    border-color: #eac4ff;
    background: #1e1b4b;
    color: #c7d2fe;
}
[data-theme="dark"] .radio-dot { border-color: #c0c0c0; }
[data-theme="dark"] .radio-dot.on { border-color: #eac4ff; background: #eac4ff; }

/* ── input focus 다크 배경 유지 (브라우저 autofill override) ── */
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover,
[data-theme="dark"] input:-webkit-autofill:focus,
[data-theme="dark"] input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #2f2f2f inset !important;
    -webkit-text-fill-color: #ececec !important;
    caret-color: #ececec !important;
    border-color: #eac4ff !important;
    transition: background-color 99999s ease-in-out 0s;
}

/* eu-input focus 다크 */
[data-theme="dark"] .eu-input:focus {
    background: #2f2f2f !important;
    color: #ececec !important;
    border-color: #eac4ff !important;
}

/* ── EndUser 모달 버튼 통일 ── */
[data-theme="dark"] .eu-btn-primary {
    background:   #eac4ff !important;
    border-color: #eac4ff !important;
    color:        #1a1a1a !important;
}
[data-theme="dark"] .eu-btn-secondary {
    background:   #2f2f2f !important;
    border-color: #3d3d3d !important;
    color:        #e0e0e0 !important;
}
[data-theme="dark"] .eu-btn-primary:disabled {
    opacity: 0.4;
}


/* ══ 전체 input/textarea 다크모드 (Aspire palette) ══ */
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] .form-control {
    background-color: #2f2f2f !important;
    border-color: #3d3d3d !important;
    color: #ececec !important;
}
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] .form-control:focus {
    background-color: #383838 !important;
    border-color: #eac4ff !important;
    color: #ececec !important;
    box-shadow: 0 0 0 2px rgba(234,196,255,0.25) !important;
}

/* ── 라이트모드 테이블 row 흰 배경 명시적 복원 ── */
:root:not([data-theme="dark"]) tr {
    background-color: transparent;
}

