/**
 * ImmigraSuite Admin - Error Logs
 * Error logs page, stats, tables, and entry display
 */

/* ==========================================================================
   Error Logs Container
   ========================================================================== */

.is-error-logs {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ==========================================================================
   Stats Cards
   ========================================================================== */

.is-error-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 768px) {
    .is-error-stats {
        grid-template-columns: 1fr;
    }
}

.is-error-stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid rgb(229 231 235);
}

.dark .is-error-stat-card {
    background: rgb(17 24 39);
    border-color: rgb(55 65 81);
}

.is-error-stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgb(243 244 246);
    color: rgb(107 114 128);
}

.dark .is-error-stat-icon {
    background: rgb(55 65 81);
    color: rgb(156 163 175);
}

.is-error-stat-total .is-error-stat-icon {
    background: rgb(219 234 254);
    color: rgb(59 130 246);
}

.dark .is-error-stat-total .is-error-stat-icon {
    background: rgba(59, 130, 246, 0.2);
}

.is-error-stat-files .is-error-stat-icon {
    background: rgb(220 252 231);
    color: rgb(34 197 94);
}

.dark .is-error-stat-files .is-error-stat-icon {
    background: rgba(34, 197, 94, 0.2);
}

.is-errors-icon {
    background: rgb(254 226 226) !important;
    color: rgb(239 68 68) !important;
}

.dark .is-errors-icon {
    background: rgba(239, 68, 68, 0.2) !important;
}

.is-error-stat-errors.is-has-errors {
    border-color: rgb(254 202 202);
    background: rgb(254 242 242);
}

.dark .is-error-stat-errors.is-has-errors {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
}

.is-error-stat-content {
    flex: 1;
}

.is-error-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: rgb(17 24 39);
    line-height: 1;
}

.dark .is-error-stat-value {
    color: rgb(243 244 246);
}

.is-errors-value {
    color: rgb(239 68 68) !important;
}

.is-error-stat-label {
    font-size: 14px;
    color: rgb(107 114 128);
    margin-top: 4px;
}

.dark .is-error-stat-label {
    color: rgb(156 163 175);
}

/* ==========================================================================
   Tabs Container
   ========================================================================== */

.is-error-tabs-container {
    overflow: hidden;
}

.is-error-tabs-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid rgb(229 231 235);
    flex-wrap: wrap;
}

.dark .is-error-tabs-header {
    border-color: rgb(55 65 81);
}

.is-error-tabs-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    flex-wrap: wrap;
    flex: 1;
}

.is-error-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: rgb(107 114 128);
    background: transparent;
    border: 1px solid rgb(229 231 235);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.is-error-tab:hover {
    color: rgb(234 88 12);
    border-color: rgb(234 88 12);
    background: rgb(255 247 237);
}

.is-error-tab-active {
    color: white !important;
    background: rgb(234 88 12) !important;
    border-color: rgb(234 88 12) !important;
}

.dark .is-error-tab {
    color: rgb(156 163 175);
    border-color: rgb(55 65 81);
}

.dark .is-error-tab:hover {
    background: rgba(234, 88, 12, 0.1);
}

.is-error-tab-size {
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    background: rgb(243 244 246);
    border-radius: 9999px;
    color: rgb(107 114 128);
}

.is-error-tab-active .is-error-tab-size {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.dark .is-error-tab-size {
    background: rgb(55 65 81);
    color: rgb(156 163 175);
}

/* ==========================================================================
   Actions
   ========================================================================== */

.is-error-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Action Buttons - Download and Clear */
.is-error-actions .is-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.is-error-actions .is-btn svg {
    width: 16px;
    height: 16px;
}

.is-error-actions .is-btn-secondary {
    background: white;
    color: rgb(55 65 81);
    border-color: rgb(209 213 219);
}

.is-error-actions .is-btn-secondary:hover {
    background: rgb(249 250 251);
    border-color: rgb(156 163 175);
}

.dark .is-error-actions .is-btn-secondary {
    background: rgb(55 65 81);
    color: rgb(209 213 219);
    border-color: rgb(75 85 99);
}

.dark .is-error-actions .is-btn-secondary:hover {
    background: rgb(75 85 99);
    border-color: rgb(107 114 128);
}

.is-error-actions .is-btn-danger {
    background: rgb(239 68 68);
    color: white;
    border-color: rgb(239 68 68);
}

.is-error-actions .is-btn-danger:hover {
    background: rgb(220 38 38);
    border-color: rgb(220 38 38);
}

/* View Entry Button (Eye Icon) */
.is-error-view-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgb(243 244 246);
    border: 1px solid rgb(229 231 235);
    border-radius: 6px;
    color: rgb(107 114 128);
    cursor: pointer;
    transition: all 0.2s;
}

.is-error-view-btn:hover {
    background: rgb(234 88 12);
    border-color: rgb(234 88 12);
    color: white;
}

.is-error-view-btn svg {
    width: 16px;
    height: 16px;
}

.dark .is-error-view-btn {
    background: rgb(55 65 81);
    border-color: rgb(75 85 99);
    color: rgb(156 163 175);
}

.dark .is-error-view-btn:hover {
    background: rgb(234 88 12);
    border-color: rgb(234 88 12);
    color: white;
}

/* ==========================================================================
   Date Selector
   ========================================================================== */

.is-error-date-select {
    margin-left: 16px;
    padding: 6px 32px 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: rgb(55 65 81);
    background: white;
    border: 1px solid rgb(209 213 219);
    border-radius: 6px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    transition: all 0.2s;
}

.is-error-date-select:hover {
    border-color: rgb(234 88 12);
}

.is-error-date-select:focus {
    outline: none;
    border-color: rgb(234 88 12);
    box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.1);
}

.dark .is-error-date-select {
    background-color: rgb(55 65 81);
    border-color: rgb(75 85 99);
    color: rgb(209 213 219);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
}

.dark .is-error-date-select:hover {
    border-color: rgb(234 88 12);
}

.dark .is-error-date-select:focus {
    border-color: rgb(234 88 12);
    box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.2);
}

/* ==========================================================================
   Log Info Bar
   ========================================================================== */

.is-error-log-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgb(249 250 251);
    border-bottom: 1px solid rgb(229 231 235);
    flex-wrap: wrap;
    gap: 12px;
}

.dark .is-error-log-info {
    background: rgb(31 41 55);
    border-color: rgb(55 65 81);
}

.is-error-log-description {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: rgb(17 24 39);
}

.dark .is-error-log-description {
    color: rgb(243 244 246);
}

.is-error-log-desc-text {
    color: rgb(107 114 128);
    font-weight: normal;
}

.dark .is-error-log-desc-text {
    color: rgb(156 163 175);
}

.is-error-log-meta {
    display: flex;
    gap: 16px;
}

.is-error-log-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: rgb(107 114 128);
}

.is-error-log-meta-item svg {
    width: 16px;
    height: 16px;
}

.dark .is-error-log-meta-item {
    color: rgb(156 163 175);
}

/* ==========================================================================
   Table
   ========================================================================== */

.is-error-table-wrap {
    overflow-x: auto;
}

.is-error-table {
    width: 100%;
    border-collapse: collapse;
}

.is-error-th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: rgb(107 114 128);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgb(249 250 251);
    border-bottom: 1px solid rgb(229 231 235);
}

.dark .is-error-th {
    background: rgb(31 41 55);
    color: rgb(156 163 175);
    border-color: rgb(55 65 81);
}

.is-error-th-time {
    width: 140px;
}

.is-error-th-level {
    width: 100px;
}

.is-error-th-actions {
    width: 60px;
    text-align: center;
}

.is-error-td {
    padding: 12px 16px;
    font-size: 14px;
    color: rgb(55 65 81);
    border-bottom: 1px solid rgb(243 244 246);
    vertical-align: middle;
}

.dark .is-error-td {
    color: rgb(209 213 219);
    border-color: rgb(55 65 81);
}

.is-error-tr:hover .is-error-td {
    background: rgb(249 250 251);
}

.dark .is-error-tr:hover .is-error-td {
    background: rgb(31 41 55);
}

.is-error-tr-error {
    background: rgb(254 242 242);
}

.is-error-tr-error:hover .is-error-td {
    background: rgb(254 226 226) !important;
}

.dark .is-error-tr-error {
    background: rgba(239, 68, 68, 0.1);
}

.dark .is-error-tr-error:hover .is-error-td {
    background: rgba(239, 68, 68, 0.15) !important;
}

.is-error-td-time {
    white-space: nowrap;
    color: rgb(107 114 128);
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.dark .is-error-td-time {
    color: rgb(156 163 175);
}

.is-error-no-time {
    color: rgb(156 163 175);
}

.is-error-td-message {
    max-width: 600px;
}

.is-error-message-text {
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.is-error-td-actions {
    text-align: center;
}

/* ==========================================================================
   Level Badge
   ========================================================================== */

.is-error-level {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.is-error-level-debug {
    background: rgb(243 244 246);
    color: rgb(107 114 128);
}

.dark .is-error-level-debug {
    background: rgb(55 65 81);
    color: rgb(156 163 175);
}

.is-error-level-info {
    background: rgb(219 234 254);
    color: rgb(30 64 175);
}

.dark .is-error-level-info {
    background: rgba(59, 130, 246, 0.2);
    color: rgb(147 197 253);
}

.is-error-level-notice {
    background: rgb(220 252 231);
    color: rgb(22 101 52);
}

.dark .is-error-level-notice {
    background: rgba(34, 197, 94, 0.2);
    color: rgb(134 239 172);
}

.is-error-level-warning {
    background: rgb(254 249 195);
    color: rgb(133 77 14);
}

.dark .is-error-level-warning {
    background: rgba(234, 179, 8, 0.2);
    color: rgb(250 204 21);
}

.is-error-level-error {
    background: rgb(254 226 226);
    color: rgb(153 27 27);
}

.dark .is-error-level-error {
    background: rgba(239, 68, 68, 0.2);
    color: rgb(252 165 165);
}

.is-error-level-critical,
.is-error-level-alert,
.is-error-level-emergency {
    background: rgb(127 29 29);
    color: white;
}

.dark .is-error-level-critical,
.dark .is-error-level-alert,
.dark .is-error-level-emergency {
    background: rgb(185 28 28);
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.is-error-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    color: rgb(156 163 175);
    text-align: center;
}

.is-error-empty svg {
    width: 48px;
    height: 48px;
    color: rgb(209 213 219);
}

.dark .is-error-empty svg {
    color: rgb(75 85 99);
}

.is-error-empty p {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

.is-error-empty-hint {
    font-size: 14px;
    color: rgb(156 163 175);
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.is-error-pagination {
    padding: 12px 20px;
    border-top: 1px solid rgb(229 231 235);
}

.dark .is-error-pagination {
    border-color: rgb(55 65 81);
}

/* Hide mobile prev/next view, show desktop view */
.is-error-pagination nav > div:first-child {
    display: none !important;
}

.is-error-pagination nav > div:last-child {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

/* Layout: text on left, buttons on right */
.is-error-pagination nav {
    display: block;
}

/* Align the "Showing X to Y" text */
.is-error-pagination nav p {
    margin: 0;
    font-size: 13px;
    color: rgb(107 114 128);
    line-height: 32px;
}

.dark .is-error-pagination nav p {
    color: rgb(156 163 175);
}

/* Page buttons container */
.is-error-pagination nav > div:last-child > div:last-child {
    display: flex;
    align-items: center;
    gap: 2px;
}

.is-error-pagination nav > div:last-child > div:last-child > span {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

/* Simple pagination - just style links and buttons */
.is-error-pagination a,
.is-error-pagination button {
    padding: 0 10px;
    height: 32px;
    font-size: 13px;
    border-radius: 6px;
    border: 1px solid rgb(229 231 235);
    background: white;
    color: rgb(55 65 81);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.is-error-pagination a:hover,
.is-error-pagination button:hover:not(:disabled) {
    border-color: rgb(234 88 12);
    color: rgb(234 88 12);
    background: rgb(255 247 237);
}

/* Active page */
.is-error-pagination span[aria-current="page"] {
    padding: 0 10px;
    height: 32px;
    font-size: 13px;
    border-radius: 6px;
    background: rgb(234 88 12);
    border: 1px solid rgb(234 88 12);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Disabled state */
.is-error-pagination span[aria-disabled="true"] {
    padding: 0 10px;
    height: 32px;
    font-size: 13px;
    color: rgb(156 163 175);
    cursor: not-allowed;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* SVG icons */
.is-error-pagination svg {
    width: 16px;
    height: 16px;
}

/* Dark mode */
.dark .is-error-pagination a,
.dark .is-error-pagination button {
    border-color: rgb(55 65 81);
    background: rgb(31 41 55);
    color: rgb(209 213 219);
}

.dark .is-error-pagination a:hover,
.dark .is-error-pagination button:hover:not(:disabled) {
    border-color: rgb(234 88 12);
    color: rgb(234 88 12);
    background: rgba(234, 88, 12, 0.1);
}

.dark .is-error-pagination span[aria-current="page"] {
    background: rgb(234 88 12);
    border-color: rgb(234 88 12);
    color: white;
}

.dark .is-error-pagination span[aria-disabled="true"] {
    color: rgb(107 114 128);
}

@media (max-width: 640px) {
    .is-error-pagination {
        text-align: center;
    }
}

/* ==========================================================================
   Entry Modal
   ========================================================================== */

.is-error-entry-container {
    max-height: 500px;
    overflow: auto;
}

.is-error-entry-code {
    margin: 0;
    padding: 16px;
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background: rgb(17 24 39);
    color: rgb(229 231 235);
    border-radius: 8px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
}

.is-error-no-entry {
    text-align: center;
    color: rgb(156 163 175);
    padding: 32px;
}
