@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

:root {
    --md-sys-color-primary: #FF8C42;
    --md-sys-color-primary-hover: #FF9E5C;
    --md-sys-color-primary-dark: #E67A2E;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #FFE4D0;
    --md-sys-color-on-primary-container: #3D2000;
    --md-sys-color-secondary: #1E3A5F;
    --md-sys-color-secondary-hover: #2A4A7C;
    --md-sys-color-secondary-dark: #0F1F3D;
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #C7D7F0;
    --md-sys-color-on-secondary-container: #0A1625;
    --md-sys-color-tertiary: #6B4FA0;
    --md-sys-color-on-tertiary: #FFFFFF;
    --md-sys-color-error: #DC3545;
    --md-sys-color-on-error: #FFFFFF;
    --md-sys-color-error-container: #FFE5E8;
    --md-sys-color-on-error-container: #410012;
    --md-sys-color-success: #28A745;
    --md-sys-color-on-success: #FFFFFF;
    --md-sys-color-warning: #FFC107;
    --md-sys-color-on-warning: #000000;
    --md-sys-color-surface: #0F1F3D;
    --md-sys-color-on-surface: #E8EDF5;
    --md-sys-color-surface-variant: #1E3A5F;
    --md-sys-color-on-surface-variant: #C7D7F0;
    --md-sys-color-outline: #6B82A3;
    --md-sys-color-outline-variant: #2A4A7C;
    --md-sys-color-background: #0A1625;
    --md-sys-color-on-background: #E8EDF5;
    --md-sys-color-surface-1: #152B4A;
    --md-sys-color-surface-2: #1E3A5F;
    --md-sys-color-surface-3: #274A73;
    --md-sys-color-surface-4: #305987;
    --md-sys-color-surface-5: #39699C;
    --md-elevation-1: 0 2px 4px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --md-elevation-2: 0 3px 6px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
    --md-elevation-3: 0 6px 12px rgba(0, 0, 0, 0.4), 0 3px 6px rgba(0, 0, 0, 0.3);
    --md-elevation-4: 0 8px 16px rgba(0, 0, 0, 0.4), 0 4px 8px rgba(0, 0, 0, 0.3);
    --md-elevation-5: 0 12px 24px rgba(0, 0, 0, 0.5), 0 6px 12px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0A1625 0%, #0F1F3D 50%, #1E3A5F 100%);
    color: var(--md-sys-color-on-background);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "sidebar header"
        "sidebar main";
    min-height: 100vh;
}

.sidebar {
    grid-area: sidebar;
    background: var(--md-sys-color-surface-1);
    border-right: 1px solid var(--md-sys-color-outline-variant);
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-header {
    padding: 0 20px 24px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    margin-bottom: 16px;
}

.app-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--md-sys-color-primary);
    letter-spacing: 0.15px;
}

.app-subtitle {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    margin: 0 8px;
    border-radius: 12px;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--md-sys-color-surface-3);
    color: var(--md-sys-color-on-surface);
}

.nav-item.active {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    box-shadow: 0 2px 8px rgba(255, 140, 66, 0.3);
}

.nav-item .material-symbols-outlined {
    font-size: 24px;
}

.header {
    grid-area: header;
    background: var(--md-sys-color-surface-1);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    font-size: 22px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--md-sys-color-primary) 0%, var(--md-sys-color-primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--md-sys-color-surface-3);
    border-radius: 20px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--md-sys-color-on-primary);
    font-weight: 600;
    font-size: 14px;
}

.main-content {
    grid-area: main;
    padding: 32px;
    overflow-y: auto;
}

.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    background: var(--md-sys-color-surface-2);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--md-elevation-1);
    transition: box-shadow 0.2s ease;
    margin-bottom: 24px;
}

.card:hover {
    box-shadow: var(--md-elevation-2);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 20px;
    border: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.btn-primary:hover {
    background: var(--md-sys-color-primary-hover);
    box-shadow: var(--md-elevation-2);
}

.btn-secondary {
    background: var(--md-sys-color-surface-3);
    color: var(--md-sys-color-on-surface);
}

.btn-secondary:hover {
    background: var(--md-sys-color-surface-4);
}

.btn-error {
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
}

.btn-error:hover {
    background: #c92a3a;
}

.btn-success {
    background: var(--md-sys-color-success);
    color: var(--md-sys-color-on-success);
}

.btn-success:hover {
    background: #218838;
}

.btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-field {
    width: 100%;
    padding: 12px 16px;
    background: var(--md-sys-color-surface-3);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 8px;
    color: var(--md-sys-color-on-surface);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

.input-field:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 3px rgba(255, 140, 66, 0.15);
}

textarea.input-field {
    resize: vertical;
    min-height: 100px;
    font-family: 'Courier New', monospace;
}

select.input-field {
    cursor: pointer;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.checkbox-input {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--md-sys-color-primary);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--md-sys-color-surface-2);
    border-radius: 24px;
    padding: 32px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--md-elevation-5);
    animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    margin-bottom: 24px;
}

.modal-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.table-container {
    overflow-x: auto;
    margin-top: 16px;
    border-radius: 12px;
    background: var(--md-sys-color-surface-3);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--md-sys-color-surface-4);
}

th {
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--md-sys-color-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
}

th:hover {
    background: var(--md-sys-color-surface-5);
}

th.sortable::after {
    content: '⇅';
    margin-left: 8px;
    opacity: 0.5;
}

th.sort-asc::after {
    content: '↑';
    opacity: 1;
}

th.sort-desc::after {
    content: '↓';
    opacity: 1;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-on-surface);
    font-size: 14px;
}

tr:hover {
    background: var(--md-sys-color-surface-2);
}

tbody tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: rgba(40, 167, 69, 0.2);
    color: #4CAF50;
}

.badge-error {
    background: rgba(220, 53, 69, 0.2);
    color: #F44336;
}

.badge-warning {
    background: rgba(255, 193, 7, 0.2);
    color: #FFC107;
}

.badge-info {
    background: rgba(255, 140, 66, 0.2);
    color: var(--md-sys-color-primary);
}

.badge-pending {
    background: rgba(107, 130, 163, 0.2);
    color: #6B82A3;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--md-sys-color-surface-4);
    border-radius: 3px;
    overflow: hidden;
    margin: 16px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--md-sys-color-primary) 0%, var(--md-sys-color-primary-dark) 100%);
    width: 0%;
    transition: width 0.3s ease;
}

.alert {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-8px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert-success {
    background: rgba(40, 167, 69, 0.15);
    border-left: 4px solid var(--md-sys-color-success);
    color: #4CAF50;
}

.alert-error {
    background: rgba(220, 53, 69, 0.15);
    border-left: 4px solid var(--md-sys-color-error);
    color: #F44336;
}

.alert-warning {
    background: rgba(255, 193, 7, 0.15);
    border-left: 4px solid var(--md-sys-color-warning);
    color: #FFC107;
}

.alert-info {
    background: rgba(255, 140, 66, 0.15);
    border-left: 4px solid var(--md-sys-color-primary);
    color: var(--md-sys-color-primary);
}

.loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--md-sys-color-surface-4);
    border-top-color: var(--md-sys-color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--md-sys-color-on-surface-variant);
}

.empty-state .material-symbols-outlined {
    font-size: 64px;
    opacity: 0.3;
    margin-bottom: 16px;
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--md-sys-color-surface-2);
    border-radius: 24px;
    padding: 48px;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--md-elevation-3);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--md-sys-color-primary) 0%, var(--md-sys-color-primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
}

.code-block {
    background: var(--md-sys-color-surface-4);
    border-radius: 8px;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    overflow-x: auto;
    margin: 8px 0;
    max-height: 200px;
    overflow-y: auto;
}

.help-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: help;
    margin-left: 6px;
    position: relative;
}

.help-tooltip:hover::after {
    content: attr(data-help);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--md-sys-color-surface-5);
    color: var(--md-sys-color-on-surface);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 400;
    white-space: normal;
    width: 200px;
    margin-bottom: 8px;
    box-shadow: var(--md-elevation-3);
    z-index: 1000;
    text-align: left;
}

.tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    margin-bottom: 24px;
}

.tab {
    padding: 12px 24px;
    background: none;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
}

.tab:hover {
    color: var(--md-sys-color-on-surface);
}

.tab.active {
    color: var(--md-sys-color-primary);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--md-sys-color-primary);
    border-radius: 3px 3px 0 0;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.fab {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    box-shadow: var(--md-elevation-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.fab:hover {
    box-shadow: var(--md-elevation-4);
    transform: scale(1.05);
}

.search-box {
    position: relative;
    margin-bottom: 16px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    background: var(--md-sys-color-surface-3);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 24px;
    color: var(--md-sys-color-on-surface);
    font-family: inherit;
    font-size: 14px;
}

.search-box .material-symbols-outlined {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--md-sys-color-on-surface-variant);
    pointer-events: none;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.pending {
    background: var(--md-sys-color-warning);
}

.status-dot.processing {
    background: var(--md-sys-color-primary);
}

.status-dot.completed {
    background: var(--md-sys-color-success);
}

.status-dot.failed {
    background: var(--md-sys-color-error);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.filter-group {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 6px 16px;
    background: var(--md-sys-color-surface-3);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-chip:hover {
    background: var(--md-sys-color-surface-4);
}

.filter-chip.active {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border-color: var(--md-sys-color-primary);
}