/* ============================================
   FPT Web Push - Component Styles
   Cards, Forms, Buttons, Badges, Tabs, Search
   ============================================ */

/* ============================================
   Cards
   ============================================ */
.card {
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid #F8F9FC;
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #181D27;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--primary-color);
    font-size: 18px;
}

/* ============================================
   Form Elements
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #414651;
    font-size: 14px;
}

.form-text {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid #D0D5DD;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
    background: #fff;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(3, 78, 162, 0.1);
}

.form-input-with-btn {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.form-input-with-btn .form-input {
    flex: 1;
}

.form-input-with-btn .btn {
    white-space: nowrap;
}

/* Setting Row */
.setting-row {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 20px;
}

.setting-label {
    font-weight: 500;
    color: #414651;
    font-size: 14px;
    min-width: 180px;
    padding-top: 8px;
}

.setting-content {
    flex: 1;
}

.setting-helper {
    font-size: 13px;
    color: #717680;
    margin-bottom: 6px;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
}

input:checked+.slider {
    background-color: var(--primary-color);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    height: 36px;
    border: 1px solid transparent;
    gap: 6px;
    font-family: inherit;
    font-weight: 500;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
}

.btn-default {
    background-color: #fff;
    border-color: #D0D5DD;
    color: #535862;
}

.btn-default:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.btn-danger {
    background-color: var(--error-color);
    color: #fff;
    border-color: var(--error-color);
}

.btn-save {
    background-color: var(--primary-color);
    color: #fff;
    padding: 8px 24px;
    border-radius: 6px;
    font-weight: 600;
}

.btn-save:hover {
    background-color: var(--primary-light);
}

.btn-back {
    background: none;
    border: none;
    font-size: 18px;
    color: #535862;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s;
}

.btn-back:hover {
    color: var(--accent-color);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #D0D5DD;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
}

/* ============================================
   Badges
   ============================================ */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
    font-weight: 500;
}

.badge-default {
    background: #EEEEEE;
    color: #535862;
}

.badge-success {
    background: #e6f9e6;
    color: #2e7d32;
}

.badge-error {
    background: #ffebee;
    color: #c62828;
}

/* ============================================
   Tabs (fallback)
   ============================================ */
.tabs {
    display: flex;
    border-bottom: 1px solid #E9EAEB;
    margin-bottom: 20px;
}

.tab-item {
    padding: 12px 20px;
    cursor: pointer;
    position: relative;
    color: #535862;
    font-weight: 500;
    transition: color 0.3s;
}

.tab-item:hover {
    color: var(--accent-color);
}

.tab-item.active {
    color: var(--accent-color);
}

.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-color);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ============================================
   Dashboard Cards
   ============================================ */
.dashboard-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0px 1px 2px 0px rgba(10, 13, 18, 0.05);
    transition: box-shadow 0.3s;
}

.dashboard-card:hover {
    box-shadow: 0px 4px 8px 0px rgba(10, 13, 18, 0.1);
}

.dashboard-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.dashboard-card-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.dashboard-card-value {
    font-size: 24px;
    font-weight: 600;
    color: #181D27;
}

.sdk-hub-dashboard .settings-section {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    box-shadow: 0px 1px 2px 0px rgba(10, 13, 18, 0.05);
}

.ns-status-badge.status-error {
    background-color: #fff2e8;
    color: #d4380d;
}
    }
}

/* ============================================
   Search Box (Header)
   ============================================ */
.search-box {
    position: relative;
}

.search-box input {
    padding: 6px 10px 6px 30px;
    border: 1px solid #D0D5DD;
    border-radius: 6px;
    width: 200px;
    transition: width 0.3s;
    font-size: 13px;
}

.search-box input:focus {
    width: 250px;
    border-color: var(--accent-color);
    outline: none;
}

.search-box i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 12px;
}

/* ============================================
   Info Box
   ============================================ */
.info-box {
    background: #fff7e6;
    border: 1px solid #ffe7ba;
    border-radius: 6px;
    padding: 12px 16px;
    font-size: 13px;
    color: #8c6d1f;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.info-box i {
    margin-top: 2px;
    color: var(--warning-color);
}

/* ============================================
   SDK Hub Utility Classes
   ============================================ */

/* Icon states for namespace/game rows */
.ns-icon,
.game-icon {
    margin-right: 8px;
}

.ns-icon.active {
    color: #034EA2;
}

.ns-icon.inactive {
    color: #bbb;
}

.game-icon.active {
    color: #722ed1;
}

.game-icon.inactive {
    color: #bbb;
}

/* Text states */
.sdk-ns-name.disabled {
    color: #aaa;
}

/* Provider and version text */
.ns-provider {
    color: #666;
    font-size: 13px;
}

.ns-version {
    color: #666;
    font-size: 13px;
    font-weight: 500;
}

/* Metric values */
.metric-value {
    color: #333;
    font-size: 13px;
    font-weight: 500;
}

/* Date cells */
.ns-date {
    color: #999;
    font-size: 12px;
}

/* Site URL link */
.site-url-link {
    color: #034EA2;
    text-decoration: none;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.site-url-link:hover {
    text-decoration: underline;
}

.truncate-text {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.external-icon {
    font-size: 10px;
    opacity: 0.7;
}

/* Text muted */
.text-muted {
    color: #999;
    font-size: 13px;
}

/* Empty state cell */
.empty-state-cell {
    text-align: center;
    color: #999;
    padding: 24px;
}

/* Button state classes */
.btn-success-state {
    background: #52c41a !important;
    border-color: #52c41a !important;
    color: white !important;
}

.btn-error-state {
    background: #ff4d4f !important;
    border-color: #ff4d4f !important;
    color: white !important;
}

/* ============================================
   Modal Styles
   ============================================ */

/* Modal overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Modal container */
.modal-container {
    width: 600px;
    max-height: 90vh;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
}

/* Modal header */
.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
}

.modal-title {
    font-weight: 600;
    font-size: 16px;
    color: #1a2057;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
}

.btn-close-modal:hover {
    color: #333;
}

/* Modal body */
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Modal footer */
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #fff;
}

/* Modal tabs */
.modal-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.modal-tab-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: transparent;
    color: #666;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-tab-btn.active {
    border-color: #034EA2;
    background: #fff;
    color: #034EA2;
}

.modal-tab-btn:hover {
    border-color: #034EA2;
}

.modal-tab-btn i {
    margin-right: 8px;
}

/* Tab content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============================================
   Namespace Selection List
   ============================================ */

.namespace-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.namespace-option {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.namespace-option:hover {
    border-color: #034EA2;
    background: #f0f4f9;
}

.namespace-option input[type="radio"] {
    margin-right: 12px;
}

.namespace-option-content {
    flex: 1;
}

.namespace-option-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.namespace-option-id {
    font-size: 12px;
    color: #999;
}

/* ============================================
   Info Box / Empty State
   ============================================ */

.info-box-create {
    padding: 20px;
    background: #f5f7fa;
    border-radius: 8px;
    border-left: 4px solid #034EA2;
    text-align: center;
}

.info-box-icon {
    font-size: 48px;
    color: #034EA2;
    margin-bottom: 16px;
}

.info-box-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.info-box-desc {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.empty-state-message {
    padding: 24px;
    text-align: center;
    color: #999;
}

/* Empty state illustration */
.empty-state-illustration {
    padding: 60px 24px;
    text-align: center;
}

.empty-state-illustration i {
    font-size: 72px;
    color: #d9d9d9;
    margin-bottom: 16px;
    display: block;
}

.empty-state-illustration .empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
}

.empty-state-illustration .empty-state-desc {
    font-size: 14px;
    color: #999;
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto 24px;
}

/* ============================================
   Layout Utilities
   ============================================ */

.flex-row {
    display: flex;
    align-items: center;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

.gap-16 {
    gap: 16px;
}

.gap-24 {
    gap: 24px;
}

/* ============================================
   Spacing Utilities
   ============================================ */

.mt-20 {
    margin-top: 20px;
}

.mb-12 {
    margin-bottom: 12px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-24 {
    margin-bottom: 24px;
}

/* ============================================
   Text Utilities
   ============================================ */

.font-weight-600 {
    font-weight: 600;
}

.text-center {
    text-align: center;
}

.color-primary {
    color: #034EA2;
}

.color-secondary {
    color: #666;
}

.color-muted {
    color: #999;
}

.font-size-12 {
    font-size: 12px;
}

.font-size-13 {
    font-size: 13px;
}

.font-size-14 {
    font-size: 14px;
}

.font-size-16 {
    font-size: 16px;
}

/* ============================================
   Width/Size Utilities
   ============================================ */

.max-width-480 {
    max-width: 480px;
}

.width-100 {
    width: 100%;
}

/* ============================================
   Search & Filter Bar
   ============================================ */

.search-filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: center;
}

.search-filter-bar .form-input {
    flex: 1;
    max-width: 400px;
}

.filter-dropdown {
    position: relative;
}

.filter-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ff4d4f;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* ============================================
   Accessibility
   ============================================ */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus states for keyboard navigation */
.btn:focus-visible,
.form-input:focus-visible,
.form-select:focus-visible {
    outline: 2px solid #034EA2;
    outline-offset: 2px;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #034EA2;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* ============================================
   SDK Service Available Pool (Thay thế)
   ============================================ */
.sdk-service-available-pool {
    margin-top: 16px;
    animation: fadeIn 0.3s ease;
}

.sdk-pool-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sdk-pool-title {
    font-size: 13px;
    font-weight: 600;
    color: #414651;
    margin-bottom: 8px;
}

.sdk-pool-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #D0D5DD;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sdk-pool-item:hover {
    border-color: var(--primary-color);
    background: #F8F9FC;
    transform: translateX(4px);
}

.sdk-pool-item-name {
    font-weight: 600;
    color: #181D27;
    font-size: 14px;
    margin-bottom: 2px;
}

.sdk-pool-item-meta {
    font-size: 12px;
    color: #717680;
}

.sdk-pool-item-action {
    color: #98A2B3;
    font-size: 14px;
}

.sdk-pool-item:hover .sdk-pool-item-action {
    color: var(--primary-color);
}

.sdk-pool-empty {
    padding: 24px;
    text-align: center;
    color: #717680;
    font-size: 13px;
    background: #F9FAFB;
    border-radius: 8px;
    border: 1px dashed #D0D5DD;
}

.sdk-pool-dropdown-area {
    margin-top: 16px;
    animation: fadeIn 0.3s ease;
}

.sdk-pool-help-text {
    font-size: 12px;
    color: #717680;
    margin-top: 8px;
    font-style: italic;
}
