@tailwind components;
@tailwind utilities;

@layer components {
    :root {
        --nhrrob-secure-bg: #f0f2f5;
        --nhrrob-secure-card-bg: #ffffff;
        --nhrrob-secure-text: #1e1e1e;
        --nhrrob-secure-text-muted: #646970;
        --nhrrob-secure-border: #dcdcde;
        --nhrrob-secure-primary: #2271b1;
        --nhrrob-secure-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    .nhrrob-secure-settings.dark-mode {
        --nhrrob-secure-bg: #101113;
        --nhrrob-secure-card-bg: #1e1e1e;
        --nhrrob-secure-text: #f0f0f1;
        --nhrrob-secure-text-muted: #a7aaad;
        --nhrrob-secure-border: #2c3338;
        --nhrrob-secure-primary: #72aee6;
        --nhrrob-secure-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    }

    /* Global Body Overrides for Dark Mode */
    body,
    #wpcontent,
    #wpbody,
    #wpbody-content,
    #wpadminbar {
        transition: background-color 0.3s ease, color 0.3s ease;
    }

    body.nhrrob-secure-dark-mode-active #wpcontent,
    body.nhrrob-secure-dark-mode-active #wpbody,
    body.nhrrob-secure-dark-mode-active #wpbody-content,
    body.nhrrob-secure-dark-mode-active {
        background-color: #101113 !important;
    }

    body.nhrrob-secure-dark-mode-active #wpadminbar {
        background-color: #1e1e1e;
    }

    .nhrrob-secure-settings {
        @apply mx-0 my-0 min-h-[calc(100vh-100px)];
        background-color: var(--nhrrob-secure-bg);
        color: var(--nhrrob-secure-text);
        transition: all 0.3s ease;
    }

    .nhrrob-secure-header {
        @apply mb-8;
    }

    .nhrrob-secure-header-main {
        @apply flex items-center justify-between mb-2;
    }

    .nhrrob-secure-header h1 {
        @apply text-3xl font-semibold m-0;
        color: var(--nhrrob-secure-text);
    }

    .nhrrob-secure-settings.dark-mode .nhrrob-secure-dark-mode-toggle {
        @apply text-white hover:text-white;
    }

    .nhrrob-secure-settings .nhrrob-secure-dark-mode-toggle,
    .nhrrob-secure-settings .nhrrob-secure-dark-mode-toggle:focus {
        @apply text-black hover:text-black outline-none;
        box-shadow: none;
    }

    .nhrrob-secure-subtitle {
        @apply text-sm m-0;
        color: var(--nhrrob-secure-text-muted);
    }

    .nhrrob-secure-loading {
        @apply flex items-center justify-center min-h-[400px];
    }

    .nhrrob-secure-cards {
        @apply grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5 mb-6;
    }

    .nhrrob-secure-card {
        @apply border shadow-sm transition-all duration-200 hover:shadow-md;
        background-color: var(--nhrrob-secure-card-bg);
        border-color: var(--nhrrob-secure-border);
        border-radius: 8px;
    }

    .nhrrob-secure-card .components-text-control__input {
        @apply max-w-[28rem];
    }

    .nhrrob-secure-card-title {
        @apply text-lg font-semibold m-0 pb-3 border-b;
        color: var(--nhrrob-secure-text);
        border-color: var(--nhrrob-secure-border);
    }

    .nhrrob-secure-card-header-flex {
        @apply flex items-center justify-between gap-4;
    }

    .nhrrob-secure-card-header-actions {
        @apply flex items-center gap-3;
    }

    .nhrrob-secure-last-checked {
        @apply text-xs font-normal opacity-70;
        color: var(--nhrrob-secure-text-muted);
    }

    /* Core component overrides for Dark Mode */
    .dark-mode .components-toggle-control__label,
    .dark-mode .components-base-control__label,
    .dark-mode .components-checkbox-control__label,
    .dark-mode .components-radio-control__label,
    .dark-mode .components-placeholder__label,
    .dark-mode .components-placeholder__instructions,
    .dark-mode .nhrrob-secure-2fa-method h3,
    .dark-mode .nhrrob-secure-enforced-roles h3,
    .dark-mode .nhrrob-secure-ip-card h3,
    .dark-mode .nhrrob-secure-ip-card .components-base-control__label,
    .dark-mode .nhrrob-secure-country-select label {
        color: var(--nhrrob-secure-text) !important;
    }

    .
    .dark-mode .components-placeholder {
        background-color: var(--nhrrob-secure-vuln-bg) !important;
        border-color: var(--nhrrob-secure-vuln-border) !important;
        box-shadow: none !important;
    }

    .dark-mode .components-text-control__input,
    .dark-mode .components-textarea-control__input,
    .dark-mode .components-select-control__input {
        background-color: #2c3338 !important;
        border-color: #43494e !important;
        color: #f0f0f1 !important;
    }

    /* IP Manager SelectControl specific styling */
    .dark-mode .nhrrob-secure-ip-card .components-select-control__input {
        background-color: #2c3338 !important;
        border-color: #43494e !important;
        color: #f0f0f1 !important;
    }

    .dark-mode .components-placeholder__input::placeholder,
    .dark-mode input::placeholder,
    .dark-mode textarea::placeholder {
        color: rgba(240, 240, 241, 0.6) !important;
    }

    /* Session Manager Dark Mode */
    .dark-mode .session-item.bg-gray-50 {
        background-color: rgba(255, 255, 255, 0.03) !important;
        border-color: var(--nhrrob-secure-border) !important;
    }

    .dark-mode .session-item.bg-blue-50 {
        background-color: rgba(34, 113, 177, 0.15) !important;
        border-color: var(--nhrrob-secure-border) !important;
    }

    .dark-mode .session-item .text-gray-700 {
        color: var(--nhrrob-secure-text) !important;
    }

    .dark-mode .session-item .text-gray-500 {
        color: var(--nhrrob-secure-text-muted) !important;
    }

    .dark-mode .session-item .bg-blue-100 {
        background-color: rgba(34, 113, 177, 0.3) !important;
        color: #72aee6 !important;
    }

    /* Hardening Headers */
    .nhrrob-secure-setting-subtitle {
        @apply text-sm font-semibold mb-3 mt-0 uppercase tracking-wide opacity-80;
        color: var(--nhrrob-secure-text-muted);
    }

    .dark-mode .nhrrob-secure-setting-subtitle {
        color: #a7aaad;
    }

    .nhrrob-secure-card .components-toggle-control {
        @apply items-start;
    }

    .nhrrob-secure-card .components-toggle-control .components-base-control__field {
        @apply mb-0;
    }

    /* Notice styling */
    .nhrrob-secure-settings .components-notice {
        @apply m-0 mb-5;
    }

    .nhrrob-secure-settings.dark-mode .components-notice__content {
        color: #1e1e1e;
    }

    /* Vulnerability Checker Styles */
    .nhrrob-secure-vulnerability-card .nhrrob-secure-card-header-flex {
        @apply mb-4 border-b pb-3;
        border-color: var(--nhrrob-secure-border);
    }

    .nhrrob-secure-vulnerability-card .nhrrob-secure-card-title {
        @apply border-b-0 pb-0 shrink-0;
    }

    .nhrrob-secure-last-scan {
        @apply text-sm mb-4;
        color: var(--nhrrob-secure-text-muted);
    }

    .nhrrob-secure-status-success {
        @apply flex items-center gap-2 p-4 rounded-lg bg-green-50 text-green-800 font-medium;
    }

    .dark-mode .nhrrob-secure-status-success {
        @apply bg-green-900/20 text-green-400;
    }

    .nhrrob-secure-status-success .dashicons {
        @apply text-green-600;
    }

    .dark-mode .nhrrob-secure-status-success .dashicons {
        @apply text-green-400;
    }

    .vulnerability-section {
        @apply mt-6;
    }

    .vulnerability-section h3 {
        @apply text-base font-semibold mb-3 uppercase tracking-wider text-xs;
        color: var(--nhrrob-secure-text-muted);
    }

    .vulnerability-item {
        @apply mb-4 p-4 rounded-lg border;
        border-color: var(--nhrrob-secure-border);
        background-color: var(--nhrrob-secure-bg);
    }

    .vulnerability-item strong {
        @apply block mb-2 text-sm;
        color: var(--nhrrob-secure-text);
    }

    .vulnerability-item ul {
        @apply list-disc list-inside m-0 space-y-1;
    }

    .vulnerability-item li {
        @apply text-xs leading-relaxed;
        color: var(--nhrrob-secure-text-muted);
    }


    /* File Scanner Styles */
    .nhrrob-secure-vulnerability-card.padded-header .nhrrob-secure-card-header-flex {
        @apply p-5;
    }

    .nhrrob-scan-controls {
        @apply flex items-center gap-4 shrink-0;
    }

    .nhrrob-scan-controls .components-button {
        @apply flex items-center justify-center gap-2 px-4 py-2 h-auto !important;
    }

    .nhrrob-scan-controls .components-button .dashicon {
        @apply static m-0 !important;
    }

    .nhrrob-scan-type-toggle {
        @apply inline-flex bg-gray-100 rounded-md p-1 border border-gray-200;
    }

    .nhrrob-scan-toggle-btn {
        @apply px-3 py-1.5 text-xs font-medium rounded border-0 bg-transparent cursor-pointer transition-all duration-200 text-gray-600;
    }

    .nhrrob-scan-toggle-btn:hover {
        @apply text-gray-900 bg-gray-200;
    }

    .nhrrob-scan-toggle-btn.active {
        @apply bg-white text-blue-600 shadow-sm font-semibold;
    }

    .dark-mode .nhrrob-scan-type-toggle {
        @apply bg-gray-800 border-gray-700;
    }

    .dark-mode .nhrrob-scan-toggle-btn {
        @apply text-gray-400;
    }

    .dark-mode .nhrrob-scan-toggle-btn:hover {
        @apply text-white bg-gray-700;
    }

    .dark-mode .nhrrob-scan-toggle-btn.active {
        @apply bg-gray-700 text-blue-400 shadow-none;
    }

    .nhrrob-secure-card-subtitle {
        @apply text-sm text-gray-500 m-0 mt-1;
        color: var(--nhrrob-secure-text-muted);
    }

    .nhrrob-scan-results {
        @apply mt-0;
    }

    .nhrrob-card-body {
        @apply p-5;
    }

    .nhrrob-result-group {
        @apply mb-6 border rounded-lg overflow-hidden bg-white shadow-sm;
        border-color: var(--nhrrob-secure-border);
    }

    .dark-mode .nhrrob-result-group {
        @apply bg-transparent;
    }

    .nhrrob-result-group-title {
        @apply px-4 py-3 m-0 text-sm font-semibold uppercase tracking-wider bg-gray-50 border-b text-gray-600;
        border-color: var(--nhrrob-secure-border);
    }

    .dark-mode .nhrrob-result-group-title {
        @apply bg-gray-800 text-gray-400;
    }

    .nhrrob-result-list {
        @apply divide-y overflow-y-auto max-h-[400px];
    }

    .nhrrob-result-list>* {
        border-color: var(--nhrrob-secure-border);
    }

    .nhrrob-result-row {
        @apply flex items-center justify-between p-4 hover:bg-gray-50 transition-colors duration-150;
    }

    .dark-mode .nhrrob-result-row:hover {
        @apply bg-gray-800;
    }

    .nhrrob-file-info {
        @apply flex flex-col text-sm;
    }

    .nhrrob-file-info strong {
        @apply mb-1 text-gray-800 break-all text-xs;
    }

    .dark-mode .nhrrob-file-info strong {
        @apply text-gray-200;
    }

    .nhrrob-file-meta {
        @apply text-xs text-gray-500 flex items-center gap-1;
    }

    .nhrrob-file-actions {
        @apply mt-4 sm:mt-0 flex items-center gap-2 shrink-0;
    }

    .button-link-delete {
        @apply text-red-600 hover:text-red-700 font-medium !important;
    }

    .notice.inline-notice {
        @apply m-0 mb-4;
    }

    .nhrrob-warning-notice {
        @apply mb-5;
    }

    .nhrrob-scan-count {
        @apply mt-4 pt-2.5 border-t border-gray-200;
        border-color: var(--nhrrob-secure-border);
    }
}

/* Responsive */
@media (max-width: 782px) {
    .nhrrob-secure-header h1 {
        @apply text-2xl;
    }

    .nhrrob-secure-card .components-text-control__input {
        @apply max-w-full;
    }

    .nhrrob-secure-vuln-footer {
        @apply flex-col items-start gap-2;
    }
}

/* Retention Select */
.nhrrob-secure-retention-select select {
    @apply h-8 py-0 pr-8 pl-2 text-xs border-gray-300;
    border-color: var(--nhrrob-secure-border);
    color: var(--nhrrob-secure-text);
    background-color: var(--nhrrob-secure-bg);
}

.nhrrob-secure-settings.dark-mode .nhrrob-secure-retention-select select {
    background-color: #2c3338 !important;
    /* Darker input bg */
    border-color: var(--nhrrob-secure-border) !important;
    color: var(--nhrrob-secure-text) !important;
}

.nhrrob-secure-retention-select .components-base-control__field {
    @apply mb-0;
}



/* Audit Log Table */
.nhrrob-secure-audit-table-wrapper {
    @apply overflow-x-auto border rounded mt-5;
    border-color: var(--nhrrob-secure-border);
}

.nhrrob-secure-audit-table {
    @apply w-full border-collapse text-[13px];
    background: var(--nhrrob-secure-card-bg);
    color: var(--nhrrob-secure-text-muted);
}

.nhrrob-secure-audit-table th,
.nhrrob-secure-audit-table td {
    @apply p-3 text-left border-b;
    border-color: var(--nhrrob-secure-border);
}

.nhrrob-secure-audit-table th {
    @apply font-semibold;
    background-color: var(--nhrrob-secure-bg);
    color: var(--nhrrob-secure-text);
}

.nhrrob-secure-audit-table tr:last-child td {
    @apply border-b-0;
}

.nhrrob-secure-audit-table tr:hover td {
    background-color: var(--nhrrob-secure-bg);
}

.nhrrob-secure-badge {
    @apply px-1.5 py-0.5 rounded text-[11px] uppercase font-medium;
    background-color: var(--nhrrob-secure-bg);
    color: var(--nhrrob-secure-text);
}

/* Dark Mode support for table */
.nhrrob-secure-settings.dark-mode .nhrrob-secure-audit-table-wrapper {
    border-color: #3c434a;
}

.nhrrob-secure-settings.dark-mode .nhrrob-secure-audit-table {
    background: #1e1e1e;
    color: #dcdcde;
}

.nhrrob-secure-settings.dark-mode .nhrrob-secure-audit-table th {
    background: #2c2c2c;
    color: #ffffff;
    border-bottom-color: #3c434a;
}

.nhrrob-secure-settings.dark-mode .nhrrob-secure-audit-table td {
    border-bottom-color: #3c434a;
}

.nhrrob-secure-settings.dark-mode .nhrrob-secure-audit-table tr:hover td {
    background: #2c2c2c;
}

.nhrrob-secure-settings.dark-mode .nhrrob-secure-badge {
    background: #3c434a;
    color: #dcdcde;
}

.nhrrob-secure-pagination {
    @apply flex justify-center items-center gap-4 mt-5;
}

.nhrrob-secure-page-info {
    @apply text-[13px];
    color: var(--nhrrob-secure-text-muted);
}

.nhrrob-secure-settings.dark-mode .nhrrob-secure-page-info {
    color: #a7aaad;
}

.no-logs {
    @apply text-center p-8 !important;
    color: var(--nhrrob-secure-text-muted);
}

/* Severity indicators */
.severity-2 td:first-child {
    @apply border-l-4 border-l-yellow-400;
}

.severity-3 td:first-child {
    @apply border-l-4 border-l-red-600;
}