@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@500;600;700&display=swap');

:root {
    --maphira-azure: #4A90A4;
    --maphira-azure-light: #6BB3C9;
    --maphira-azure-soft: #E8F4F8;
    --maphira-sand: #C4A35A;
    --maphira-sand-light: #F5EFE0;
    --maphira-olive: #6B8E6B;
    --maphira-olive-light: #E8F0E8;
    --maphira-bg: #FAFBFC;
    --maphira-bg-card: #FFFFFF;
    --maphira-text: #2D3748;
    --maphira-text-light: #718096;
    --maphira-border: #E2E8F0;
    --maphira-shadow: rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: url('/static/bg-maphira.png') center center / cover no-repeat fixed;
    background-color: var(--maphira-bg);
    min-height: 100vh;
    color: var(--maphira-text);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Sidebar menu - works on both desktop and mobile */
.nav-links-desktop {
    display: none !important;
}

.nav-mobile-menu {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
    z-index: 1050;
    transition: right 0.3s ease;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.nav-mobile-menu.open {
    right: 0;
}

.nav-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.nav-mobile-overlay.open {
    opacity: 1;
    visibility: visible;
}

.nav-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--maphira-border);
}

.nav-mobile-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--maphira-text-light);
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s ease;
}

.nav-mobile-close:hover {
    color: var(--maphira-azure);
}

.nav-mobile-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--maphira-bg);
    border-radius: 12px;
    margin-bottom: 1rem;
}

.nav-mobile-user .user-avatar {
    width: 40px;
    height: 40px;
}

.nav-mobile-user .user-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}

.nav-mobile-user-info {
    flex: 1;
}

.nav-mobile-user-name {
    font-weight: 600;
    color: var(--maphira-text);
}

.nav-mobile-user-email {
    font-size: 0.8rem;
    color: var(--maphira-text-light);
}

.nav-mobile-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-mobile-links a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--maphira-text);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-mobile-links a:hover,
.nav-mobile-links a:active {
    background: var(--maphira-azure-soft);
    color: var(--maphira-azure);
}

.nav-mobile-links a i {
    width: 20px;
    text-align: center;
    color: var(--maphira-azure);
}

.nav-mobile-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--maphira-border);
}

.nav-mobile-logout {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #E53E3E;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    width: 100%;
}

.nav-mobile-logout:hover {
    background: #FEE2E2;
}

/* Mobile specific adjustments */
@media (max-width: 768px) {
    body {
        background: url('/static/bg-maphira-mobile.png') center center / cover no-repeat fixed;
        background-color: var(--maphira-bg);
    }
    
    .navbar-maphira .container {
        padding: 0.5rem 1rem;
    }
    
    .navbar-maphira .nav-logo img {
        height: 26px !important;
    }
    
    .nav-mobile-menu {
        width: 280px;
        right: -300px;
    }
}

/* Menu toggle button - always visible */
.nav-mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--maphira-border);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    color: var(--maphira-text);
    transition: all 0.2s ease;
}

.nav-mobile-toggle:hover {
    background: white;
    border-color: var(--maphira-azure);
    color: var(--maphira-azure);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: var(--maphira-text);
}

.maphira-brand {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 600;
}

.maphira-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 2.5rem;
    color: var(--maphira-azure);
}

.maphira-subtitle {
    color: var(--maphira-text-light);
    font-size: 1.1rem;
    font-weight: 400;
}

.maphira-tagline {
    color: var(--maphira-sand);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.card {
    border: 1px solid var(--maphira-border);
    border-radius: 16px;
    box-shadow: 0 4px 24px var(--maphira-shadow);
    background: var(--maphira-bg-card);
}

.card-header {
    background: var(--maphira-bg-card);
    border-bottom: 1px solid var(--maphira-border);
    border-radius: 16px 16px 0 0 !important;
    padding: 1.25rem 1.5rem;
}

.card-header h3, .card-header h5 {
    color: var(--maphira-text);
    margin: 0;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

.form-control {
    background: var(--maphira-bg);
    border: 1px solid var(--maphira-border);
    color: var(--maphira-text);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    background: var(--maphira-bg-card);
    border-color: var(--maphira-azure);
    box-shadow: 0 0 0 4px var(--maphira-azure-soft);
    color: var(--maphira-text);
}

.form-control::placeholder {
    color: var(--maphira-text-light);
}

.form-label {
    font-weight: 500;
    color: var(--maphira-text);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-text {
    color: var(--maphira-text-light);
    font-size: 0.85rem;
}

.btn-primary, .btn-maphira {
    background: linear-gradient(135deg, var(--maphira-azure) 0%, var(--maphira-azure-light) 100%);
    border: none;
    padding: 0.75rem 1.75rem;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    color: white;
    border-radius: 10px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(74, 144, 164, 0.35);
}

.btn-primary:hover, .btn-maphira:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(74, 144, 164, 0.45);
    background: linear-gradient(135deg, var(--maphira-azure-light) 0%, var(--maphira-azure) 100%);
}

.btn-outline-info {
    border: 2px solid var(--maphira-azure);
    color: var(--maphira-azure);
    background: transparent;
    font-weight: 500;
    border-radius: 10px;
}

.btn-outline-info:hover {
    background: var(--maphira-azure);
    border-color: var(--maphira-azure);
    color: white;
}

.btn-outline-secondary {
    border: 1px solid var(--maphira-border);
    color: var(--maphira-text-light);
    background: transparent;
    border-radius: 10px;
}

.btn-outline-secondary:hover {
    background: var(--maphira-bg);
    border-color: var(--maphira-text-light);
    color: var(--maphira-text);
}

.btn-success {
    background: linear-gradient(135deg, var(--maphira-olive) 0%, #5a7a5a 100%);
    border: none;
    box-shadow: 0 4px 14px rgba(107, 142, 107, 0.35);
}

.btn-success:hover {
    background: linear-gradient(135deg, #5a7a5a 0%, var(--maphira-olive) 100%);
}

.btn-outline-danger {
    border: 1px solid #E53E3E;
    color: #E53E3E;
}

.btn-outline-danger:hover {
    background: #E53E3E;
    color: white;
}

.user-dropdown-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--maphira-border);
    color: var(--maphira-text);
    padding: 0.4rem 0.75rem;
    font-weight: 500;
    font-size: 0.85rem;
    border-radius: 20px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-dropdown-btn:hover {
    background: white;
    border-color: var(--maphira-azure);
    color: var(--maphira-azure);
    box-shadow: 0 2px 8px var(--maphira-shadow);
}

.user-dropdown-btn::after {
    margin-left: 0.25rem;
    opacity: 0.6;
}

.user-dropdown-btn .user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--maphira-azure-soft);
}

.user-dropdown-btn .user-icon {
    width: 24px;
    height: 24px;
    background: var(--maphira-azure-soft);
    color: var(--maphira-azure);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.dropdown-menu {
    border: 1px solid var(--maphira-border);
    border-radius: 12px;
    box-shadow: 0 8px 24px var(--maphira-shadow);
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.dropdown-menu .dropdown-item {
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    color: var(--maphira-text);
}

.dropdown-menu .dropdown-item:hover {
    background: var(--maphira-azure-soft);
    color: var(--maphira-azure);
}

.dropdown-menu .dropdown-item-text {
    padding: 0.5rem 0.75rem;
}

.table {
    background: var(--maphira-bg-card);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0;
}

.table th {
    background: var(--maphira-bg);
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--maphira-text-light);
    padding: 1rem;
}

.table td {
    border-color: var(--maphira-border);
    vertical-align: middle;
    color: var(--maphira-text);
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
}

.table-hover tbody tr:hover {
    background-color: var(--maphira-azure-soft);
}

.text-info {
    color: var(--maphira-azure) !important;
}

.text-muted {
    color: var(--maphira-text-light) !important;
}

a {
    color: var(--maphira-azure);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--maphira-azure-light);
}

.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
}

.bg-success {
    background: var(--maphira-olive) !important;
}

.bg-warning {
    background: var(--maphira-sand) !important;
    color: white !important;
}

.bg-danger {
    background: #E53E3E !important;
}

.bg-dark {
    background: var(--maphira-bg) !important;
    color: var(--maphira-text) !important;
}

.progress {
    height: 8px;
    border-radius: 4px;
    background: var(--maphira-border);
}

.progress-bar {
    background: linear-gradient(90deg, var(--maphira-azure) 0%, var(--maphira-olive) 100%);
    border-radius: 4px;
}

.alert {
    border: none;
    border-radius: 12px;
}

.alert-danger {
    background: #FFF5F5;
    border-left: 4px solid #E53E3E;
    color: #C53030;
}

.alert-info {
    background: var(--maphira-azure-soft);
    border-left: 4px solid var(--maphira-azure);
    color: var(--maphira-azure);
}

.maphira-icon {
    color: var(--maphira-azure);
}

.maphira-compass {
    display: inline-block;
}

.status-completed, .status-200 { color: var(--maphira-olive); }
.status-running { color: var(--maphira-sand); }
.status-failed { color: #E53E3E; }
.status-301, .status-302 { color: var(--maphira-sand); }
.status-400, .status-403, .status-404, .status-500 { color: #E53E3E; }

.scan-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.scan-row:hover {
    background-color: var(--maphira-azure-soft);
}

.truncate {
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-container {
    max-height: 70vh;
    overflow: auto;
}

.filter-btn {
    margin: 3px;
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
}

.filter-btn.active {
    background-color: var(--maphira-azure);
    border-color: var(--maphira-azure);
    color: white;
}

.cell-content {
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.maphira-narrative {
    color: var(--maphira-text-light);
    font-size: 0.95rem;
    font-style: italic;
}

.maphira-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--maphira-border) 50%, transparent 100%);
    margin: 1.5rem 0;
}

.stat-card {
    text-align: center;
    padding: 1.25rem;
}

.stat-card .stat-icon {
    font-size: 1.5rem;
    color: var(--maphira-azure);
    margin-bottom: 0.5rem;
}

.stat-card h6 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--maphira-text-light);
    margin-bottom: 0.25rem;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--maphira-azure);
}

@media (max-width: 768px) {
    .maphira-title {
        font-size: 2rem;
    }
    
    .container {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}

@keyframes pulse-gentle {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

.loading-pulse {
    animation: pulse-gentle 2s ease-in-out infinite;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--maphira-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--maphira-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--maphira-text-light);
}

.navbar-maphira {
    background: var(--maphira-bg-card);
    border-bottom: 1px solid var(--maphira-border);
    padding: 0.75rem 0;
}

.hero-section {
    padding: 3rem 0;
    text-align: center;
}

.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--maphira-azure-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--maphira-azure);
    font-size: 1.25rem;
}

.maphira-footer {
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid var(--maphira-border);
    padding: 1.5rem 0;
    margin-top: 3rem;
    font-size: 0.9rem;
    color: var(--maphira-text-light);
}

.maphira-footer span {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 600;
    color: var(--maphira-azure);
}

/* Toast Notifications - Maphira Style */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
}

@media (max-width: 768px) {
    .toast-container {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

.maphira-toast {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 4px solid var(--maphira-azure);
    position: relative;
    overflow: hidden;
}

.maphira-toast.toast-exit {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.maphira-toast.toast-success {
    border-left-color: var(--maphira-olive);
}

.maphira-toast.toast-error {
    border-left-color: #E53E3E;
}

.maphira-toast.toast-warning {
    border-left-color: var(--maphira-sand);
}

.maphira-toast.toast-info {
    border-left-color: var(--maphira-azure);
}

.toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.toast-success .toast-icon {
    background: var(--maphira-olive-light);
    color: var(--maphira-olive);
}

.toast-error .toast-icon {
    background: #FEE2E2;
    color: #E53E3E;
}

.toast-warning .toast-icon {
    background: var(--maphira-sand-light);
    color: #B8860B;
}

.toast-info .toast-icon {
    background: var(--maphira-azure-soft);
    color: var(--maphira-azure);
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    color: var(--maphira-text);
    font-size: 0.95rem;
    margin-bottom: 0.15rem;
    font-family: 'Playfair Display', Georgia, serif;
}

.toast-message {
    color: var(--maphira-text-light);
    font-size: 0.85rem;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--maphira-text-light);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
    opacity: 0.6;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--maphira-azure);
    animation: toastProgress linear forwards;
}

.toast-success .toast-progress {
    background: var(--maphira-olive);
}

.toast-error .toast-progress {
    background: #E53E3E;
}

.toast-warning .toast-progress {
    background: var(--maphira-sand);
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Multi-select table styles */
.scan-row-selectable {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.scan-row-selectable:hover {
    background-color: var(--maphira-azure-soft) !important;
}

.scan-row-selectable.selected {
    background-color: rgba(74, 144, 164, 0.15) !important;
}

.scan-row-selectable.selected td {
    border-color: var(--maphira-azure-soft);
}

.scan-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--maphira-azure);
    cursor: pointer;
}

.bulk-actions {
    display: none;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--maphira-azure-soft);
    border-radius: 12px;
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease;
}

.bulk-actions.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.bulk-actions-count {
    font-weight: 600;
    color: var(--maphira-azure);
}

.select-all-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Compass header icon */
.compass-header-icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

/* Compass spinner animation */
.compass-spinner-container {
    display: inline-block;
}

.compass-spinner {
    width: 120px;
    height: 120px;
    object-fit: contain;
    animation: compassSpin 3s ease-in-out infinite;
}

@keyframes compassSpin {
    0% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(90deg);
    }
    50% {
        transform: rotate(180deg);
    }
    75% {
        transform: rotate(270deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* XPath dynamic inputs */
.xpath-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.xpath-row .xpath-name {
    flex: 0 0 35%;
}

.xpath-row .xpath-expression {
    flex: 1;
}

.xpath-row .btn-remove-xpath {
    flex-shrink: 0;
    width: 40px;
    height: 38px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#addXpathBtn {
    background: var(--maphira-azure);
    border-color: var(--maphira-azure);
}

#addXpathBtn:hover {
    background: var(--maphira-azure-light);
    border-color: var(--maphira-azure-light);
}

.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.7) !important;
}

.modal-backdrop.show {
    opacity: 1 !important;
}
