/* Base styles */
:root {
    --primary-color: #86b8ff;
    --primary-dark: #5a96b8;
    --text-color: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.85);
    --bg-color: rgba(30, 50, 90, 0.75);
    --card-bg: #284678;
    --border-color: rgba(120, 150, 200, 0.4);
    --error-color: #ef4444;
    --success-color: #10b981;
    --row-hover: rgba(134, 184, 255, 0.2);
    --test-color: #4caf50;
    --live-color: #f59e0b;
    --earnings-color: #38bdf8;
    --chart-bg: #1e3c6e;
}

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

html {
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    background: linear-gradient(145deg, #17294d 0%, #2a4272 100%);
    position: relative;
    overflow-x: hidden;
}

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

a:hover {
    color: #a8d1ff;
}

/* Flow Animation */
.flow-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.flow-lines {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 1;
}

@keyframes flowAnimation {
    0% { stroke-dashoffset: 1000; }
    100% { stroke-dashoffset: 0; }
}

.flow-path {
    fill: none;
    stroke: rgba(160, 200, 255, 0.4);
    stroke-width: 2.5;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: flowAnimation 30s linear infinite;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: rgba(30, 50, 90, 0.9);
    border-bottom: 1px solid var(--border-color);
    width: 100%;
    position: relative;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.navbar-brand {
    display: flex;
    align-items: center;
}

.navbar-tagline {
    margin-left: 20px;
    display: inline-flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.7);
}

.navbar-logo-inline {
    max-height: 34px;
    margin-left: 6px;
    vertical-align: middle;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.navbar-menu {
    display: flex;
    align-items: center;
}

/* Main content container */
.main-container {
    flex: 1;
    max-width: 1600px;
    margin: 1rem auto;
    width: calc(100% - 2rem);
    padding-left: 1rem;
    padding-right: 1rem;
    position: relative;
    z-index: 1;
}

/* Welcome section */
.welcome-section {
    text-align: center;
    max-width: 800px;
    margin: 5rem auto 3rem;
}

/* Typography */
h1 {
    font-size: 2.75rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.intro-text {
    font-size: 1.125rem;
    max-width: 600px;
    margin: 0 auto 1.5rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.7;
}

.intro-text a {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 500;
}

.intro-text a:hover {
    color: #a8d1ff;
}

/* Page header */
.page-header {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

/* Button styles */
.btn, .login-btn {
    background-color: rgba(30, 50, 90, 1);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn {
    background-color: var(--primary-color);
    color: #17294d;
    border: none;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    background-color: #a8d1ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Disabled button styling */
.btn:disabled, .btn.loading {
    opacity: 0.7;
    background-color: #6b92cc;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:disabled:hover, .btn.loading:hover {
    background-color: #6b92cc;
    transform: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-green {
    background-color: var(--success-color); /* #10b981 */
    color: var(--text-color); /* white */
    border: none;
    border-radius: 6px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-green:hover {
    background-color: #12cf93; /* Lighter green for hover */
    color: var(--text-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.login-btn:hover {
    background-color: rgba(45, 65, 105, 1);
    border-color: #a8d1ff;
    color: #a8d1ff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Documentation buttons */
.documentation-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* Documentation Navigation */
.docs-navbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    justify-content: center;
    padding: 1rem;
    z-index: 10;
}

.docs-nav-container {
    display: flex;
    justify-content: flex-end;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
}

.docs-nav-links {
    display: flex;
    gap: 1rem;
}

.docs-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-color);
    background-color: rgba(40, 70, 120, 0.9);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(134, 184, 255, 0.4);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.docs-nav-link i {
    color: var(--primary-color);
}

.docs-nav-link:hover {
    background-color: rgba(50, 80, 130, 0.85);
    border-color: var(--primary-color);
}

/* Ensure navbar and fixed navbar links align horizontally */
.navbar .docs-nav-links {
    margin-right: 1.5rem;
    position: relative;
    top: 1px; /* Fine-tune vertical alignment */
}

.navbar .docs-nav-link {
    background-color: rgba(40, 70, 120, 0.7);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid rgba(134, 184, 255, 0.25);
    padding: 0.5rem 0.75rem;
}

.navbar .docs-nav-link:hover {
    background-color: rgba(50, 80, 130, 0.85);
    border-color: var(--primary-color);
}

/* Keep the old doc-btn styles for backwards compatibility */
.doc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.doc-btn i {
    margin-right: 0.5rem;
}

/* API Reference button styling */
.api-ref-btn {
    display: inline-flex;
}

/* Form elements */
.create-link-form {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0;
    border-top: none;
    box-shadow: none;
    transition: all 0.3s ease-in-out;
    max-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
}

.create-link-form.open {
    max-height: 2000px; /* Large enough to contain the form */
    padding: 1.5rem;
}

.form-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Submit button alignment */
#submit-btn {
    margin-left: auto;
}

input, select {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.95rem;
    background-color: #325082;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

/* Make placeholders much lighter */
::placeholder {
    color: rgba(255, 255, 255, 0.8);
    opacity: 1;
}

:-ms-input-placeholder {
    color: rgba(255, 255, 255, 0.8);
}

::-ms-input-placeholder {
    color: rgba(255, 255, 255, 0.8);
}

input:focus, select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(134, 184, 255, 0.3);
    background-color: #3a5a8c;
}


.input-with-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 140px;
}

.input-with-tooltip input {
    width: 100%;
    padding-right: 28px;
}

.input-with-tooltip .tooltip {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    z-index: 1;
}

.input-with-tooltip .tooltip i {
    display: block;
}

/* Toggle switch styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin-right: 5px;
}

.toggle-switch-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    background-color: rgba(100, 140, 200, 0.4);
    border-radius: 20px;
    margin-right: 8px;
    transition: .4s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--test-color);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-text {
    font-size: 14px;
    user-select: none;
}

.toggle-text .tooltip {
    margin-left: 5px;
}

/* Mode indicators */
.mode-test {
    color: var(--test-color);
    font-weight: 600;
}

.mode-live {
    color: var(--live-color);
    font-weight: 600;
}

.checkbox-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.5rem;
}

.checkbox-control input[type="checkbox"] {
    width: auto;
    flex: none;
    cursor: pointer;
}

.checkbox-control label {
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

#price-input {
    width: 100%;
}

#method-select {
    width: 100px;
}

/* Data table */
.data-table-container {
    background-color: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th {
    background-color: #233c69;
    padding: 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    cursor: default;
}

.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background-color: var(--row-hover);
}

.ellipsis {
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    cursor: pointer;
}

/* Add specific tooltip style for ellipsis URLs to make sure they're visible */
.ellipsis[data-tooltip]::after {
    min-width: 150px;
    max-width: 450px;
    white-space: normal;
    word-break: break-all;
    text-align: left;
    border: 1px solid var(--border-color);
}

/* Make sure ellipsis tooltips are visible */
.ellipsis[data-tooltip]::before,
.ellipsis[data-tooltip]::after {
    z-index: 1000;
}

/* Empty state */
.empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state h3 {
    color: var(--primary-color);
    margin: 1rem 0;
}

.empty-icon {
    color: var(--primary-color);
    opacity: 0.8;
    margin-bottom: 1rem;
}

/* User menu */
.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: transparent;
    border: none;
    border-radius: 1.5rem;
    padding: 0.4rem 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-menu-trigger:hover {
    opacity: 0.8;
}

.user-avatar {
    width: 1.75rem;
    height: 1.75rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 50%;
    color: #17294d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background-color: var(--card-bg);
    border-radius: 0.5rem;
    min-width: 220px;
    display: none;
    z-index: 100;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.user-menu-dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

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

.user-email-display {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
    background-color: #233c69;
    font-weight: 500;
}

.user-menu-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.user-menu-item:hover {
    background-color: var(--row-hover);
}

.user-menu-item i {
    color: var(--primary-color);
    opacity: 0.8;
}

.user-menu-item:hover i {
    color: var(--primary-color);
    opacity: 1;
}

.user-email-short {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: none;
}

/* Hide doc links in user menu by default, they are shown on mobile via media query */
.user-menu-item-doc-link {
    display: none;
}

@media (min-width: 768px) {
    .user-email-short {
        display: inline;
    }
}

/* Short URL container */
.short-url-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.copy-btn, .delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    transition: all 0.2s ease;
    opacity: 0.8;
    position: relative;
}

.copy-btn:hover, .delete-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.copy-btn i, .action-icon {
    color: var(--primary-color);
}

.delete-btn i, .delete-icon {
    color: var(--error-color);
}

.copy-success {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--card-bg);
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    z-index: 100;
    opacity: 0;
    transition: all 0.2s ease;
    pointer-events: none;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    margin-bottom: 8px;
}

.copy-success.show {
    opacity: 1;
}

/* Message styles */
.error, .success {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.925rem;
}

.error {
    background-color: rgba(239, 68, 68, 0.2);
    color: #ff6b6b;
    border-left: 3px solid var(--error-color);
}

.success {
    background-color: rgba(16, 185, 129, 0.2);
    color: #2ecc71;
    border-left: 3px solid var(--success-color);
}

/* Loading indicator */
#spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    margin-left: 8px;
    animation: spin 0.8s linear infinite;
}

.htmx-request #spinner,
.loading #spinner {
    display: inline-block;
}

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


/* Responsive design */
@media (max-width: 768px) {
    .navbar {
        padding: 0.75rem 1rem;
    }
    
    .docs-nav-container {
        justify-content: center;
    }
    
    .main-container {
        padding: 1rem;
        max-width: 100%;
        margin: 0 auto 2rem;
        width: calc(100% - 1rem);
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    
    .data-table th, .data-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
    
    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Settings page adjustments for small screens */
    .settings-container {
        padding: 0 10px;
    }

    .settings-field-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .settings-field label {
        width: auto;
        margin-bottom: 5px;
    }

    .settings-value,
    .payment-address-field .settings-input {
        width: 100%;
    }

    .settings-note {
        margin-left: 0;
        padding-left: 10px;
    }

    .payment-address-field .btn-settings-save {
        width: 100%;
        margin-top: 10px;
    }

    /* Hide navbar doc links on mobile */
    .navbar .docs-nav-links {
        display: none;
    }
    
    /* Show doc links in user menu on mobile */
    .user-menu-item-doc-link {
        display: flex; /* Or block, depending on desired layout, flex matches other user-menu-items */
    }
}

/* Custom Tooltip Styles */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::before, 
[data-tooltip]::after {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
    z-index: 100;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    background-color: rgba(30, 50, 90, 0.95);
    color: var(--text-color);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    white-space: pre-line;
    bottom: calc(100% + 8px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    min-width: 250px;
    max-width: 400px;
    text-align: left;
}

[data-tooltip]::before {
    content: '';
    border: 5px solid transparent;
    border-top-color: rgba(30, 50, 90, 0.95);
    bottom: calc(100% + 3px);
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
}

/* Specific adjustment for icon tooltip */
.input-with-tooltip .tooltip[data-tooltip]::after {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
}

.input-with-tooltip .tooltip {
    pointer-events: auto;
}

.input-with-tooltip .tooltip i {
    display: block;
}

/* Adjust tooltip position/style specifically for table headers */
.th-tooltip[data-tooltip]::before,
.th-tooltip[data-tooltip]::after {
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(100% + 8px); 
}

.th-tooltip[data-tooltip]::before {
    bottom: calc(100% + 3px);
}

/* Adjust tooltip position/style for icon buttons */
.icon-btn[data-tooltip]::before,
.icon-btn[data-tooltip]::after,
.copy-btn[data-tooltip]::before,
.copy-btn[data-tooltip]::after {
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(100% + 8px);
    white-space: nowrap;
    z-index: 20;
}

.icon-btn[data-tooltip]::before,
.copy-btn[data-tooltip]::before {
    bottom: calc(100% + 3px);
}

.th-tooltip {
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.3rem;
    position: relative; 
    color: var(--primary-color);
    line-height: 1;
}

.th-tooltip i {
    display: block; 
    vertical-align: middle;
}

.status-cell {
    text-align: center;
}

.status-icon-test {
    color: #22c55e;
}

.status-icon-live {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Dashboard Stats Section */
.dashboard-stats {
    margin-bottom: 1rem;
}

.stats-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
}

.stats-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stats-card {
    background-color: var(--card-bg);
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.stats-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats-item h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-muted);
}

.value {
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

.loading-placeholder {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: normal;
    opacity: 0.8;
}

.stats-chart {
    background-color: var(--card-bg);
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chart-header {
    margin-bottom: 1rem;
}

.chart-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-muted);
}

.chart-container {
    height: 250px;
    position: relative;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
}

/* Responsive adjustments for stats */
@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .stats-item {
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .value {
        font-size: 1.1rem;
    }
    
    .chart-container {
        height: 220px;
    }
}

/* Table sorting indicators */
th.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 1.5em; /* Make space for the arrow */
}

th.sortable::after {
    content: '';
    position: absolute;
    right: 0.5em;
    top: 50%;
    margin-top: -0.4em; /* Center the arrow */
    width: 0;
    height: 0;
    border-left: 0.4em solid transparent;
    border-right: 0.4em solid transparent;
    opacity: 0.3;
    transition: opacity 0.2s ease-in-out;
}

th.sortable:hover::after {
    opacity: 0.7;
}

th.sortable.asc::after {
    border-bottom: 0.5em solid var(--text-muted);
    opacity: 1;
}

th.sortable.desc::after {
    border-top: 0.5em solid var(--text-muted);
    opacity: 1;
}

/* Table Filter Controls */
.table-filters {
    padding: 1rem;
    background-color: #233c69; /* Match header background */
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.table-filters label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.filter-select {
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    background-color: #325082;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
}

/* Settings Page Styles */
.settings-container {
    max-width: 800px;
    margin: 10px auto;
    padding: 0 10px;
}

.settings-container h1 {
    color: var(--text-color);
    margin-bottom: 20px;
    font-size: 24px;
}

.settings-card {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.settings-card h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.settings-field {
    margin-bottom: 15px;
}

.settings-field-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
}

.settings-field label {
    display: block;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 14px;
    width: 120px;
    flex-shrink: 0;
}

.input-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 5px; /* Add some space between input/value and note */
}

.settings-value,
.payment-input-group {
    padding: 10px 12px;
    background: #325082;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-family: monospace;
    display: flex;
    align-items: center;
    justify-content: space-between;
    word-break: break-all;
    width: 100%; /* Make it take full width of input-area */
}

.payment-input-group {
    /* Specific styles for payment input group if different from settings-value above */
    /* For now, inherits most from .settings-value above */
    /* Ensure input and button are spaced correctly if needed */
    gap: 10px; /* Space between input and button */
}

.payment-input-group .settings-input {
    flex: 1; /* Allow input to grow */
    /* Resetting padding/border if they come from .settings-input base style */
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-color);
}

.payment-input-group .settings-input:focus {
    outline: none;
    box-shadow: none;
}

.secret-field {
    position: relative;
}

.secret-field span {
    flex: 1;
    margin-right: 10px;
}

.secret-field button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
    padding: 5px;
    margin-left: 5px;
}

.secret-field button:hover {
    color: var(--primary-color);
}

.regen-btn {
    color: var(--text-muted);
}

.regen-btn:hover {
    color: #f44336; /* Red color to indicate caution */
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
    padding: 5px;
}

.icon-btn:hover {
    color: var(--primary-color);
}

.settings-note {
    font-size: 12px;
    color: var(--text-muted);
    margin: 5px 0 15px 0; /* Adjusted margin */
    width: 100%; /* Ensure it takes full width of input-area */
}

.regenerate-form {
    margin-top: 10px;
    margin-left: 120px;
}

.danger-btn {
    background: #f44336;
    border-color: #d32f2f;
}

.danger-btn:hover {
    background: #d32f2f;
}

.user-menu-dropdown .active {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
}

/* Styles for Payment Address Field to match Secret Field */
.payment-address-field {
    display: flex;
    align-items: center;
}

.payment-address-field .settings-input {
    flex: 1; /* Take up available space */
    padding: 10px 12px;
    background: #325082;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-family: monospace; /* Match secret field font */
    margin-right: 10px; /* Space before button */
}

.payment-address-field .settings-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(134, 184, 255, 0.3);
    background-color: #3a5a8c;
}

.btn-settings-save {
    background-color: var(--primary-color); /* Match dashboard button */
    color: #17294d;
    border: none;
    border-radius: 6px;
    padding: 0.75rem 1.5rem; /* Match dashboard button */
    font-size: 1rem; /* Match dashboard button */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* Match dashboard button */
}

.btn-settings-save:hover {
    background-color: #a8d1ff; /* Lighter hover */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Match dashboard button hover */
}

.landing-tagline {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin-top: -1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.landing-logo-inline {
    max-height: 34px;
    margin-left: 6px;
}

/* Tabs container */
.tabs-container {
    margin-bottom: 20px;
}

.tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    position: relative;
    transition: all 0.2s ease;
}

.tab.active {
    color: #fff;
}

.tab.active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: #63b3ed;
}

/* File upload components */
.file-section {
    flex: 1;
    min-width: 250px;
}

.file-section input {
    width: 100%;
}

.file-dropzone {
    border: 2px dashed rgba(99, 179, 237, 0.5);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-dropzone:hover, .file-dropzone.dragover {
    background: rgba(255, 255, 255, 0.05);
    border-color: #63b3ed;
}

.dropzone-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.dropzone-content i {
    color: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.dropzone-content span {
    color: rgba(255, 255, 255, 0.7);
    position: relative;
    top: 1px;
}

.file-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 10px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-name {
    font-weight: 500;
    word-break: break-word;
}

.file-size {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.5);
}

.remove-file {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: color 0.2s ease;
}

.remove-file:hover {
    color: #ef4444;
}

.file-hints {
    margin-top: 5px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8em;
}

.hidden {
    display: none;
}

/* Loading button state */
.btn.loading {
    position: relative;
    animation: subtle-pulse 2s infinite;
}

@keyframes subtle-pulse {
    0% { opacity: 0.7; }
    50% { opacity: 0.9; }
    100% { opacity: 0.7; }
}

/* Cover image container */
.cover-image-container {
    margin-bottom: 15px;
    width: 100%;
}

.cover-image-container label {
    display: block;
    margin-bottom: 5px;
    color: #a0aec0;
    font-size: 0.9rem;
}

#cover-image-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #2d3748;
    border-radius: 6px;
    background-color: #1a202c;
    color: #e2e8f0;
}

/* Title and description inputs */
#title-input, #description-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: #325082;
    color: var(--text-color);
    margin-bottom: 15px;
    font-family: inherit;
    font-size: 0.95rem;
}

#description-input {
    resize: vertical;
    min-height: 60px;
}

/* Link title and cover image indicator in table */
.link-title {
    font-weight: 500;
    color: #90cdf4;
}

.has-cover-image {
    margin-left: 5px;
    font-size: 12px;
    vertical-align: middle;
    opacity: 0.8;
}

/* Form toggle button */
.table-action-buttons {
    margin-left: auto;
}

.toggle-form-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-color);
    color: #17294d;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.toggle-form-btn:hover {
    background-color: #a8d1ff;
    transform: translateY(-2px);
}

.toggle-form-btn i {
    color: #17294d;
}

/* Accordion Form Container */
.accordion-form-container {
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.accordion-header:hover {
    background-color: #2a4d82;
}

.accordion-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-muted);
}

.accordion-toggle-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
}

.accordion-toggle-btn i {
    transition: transform 0.3s ease;
}

/* Route Details Styles - Simplified Version */
.route-details-container {
    background-color: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-top: 1rem;
    padding: 1.5rem;
}

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

.route-details-header h2 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--primary-color);
}

.close-details-btn {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: 0.4rem; transition: all 0.2s ease;
    border-radius: 4px;
}
.close-details-btn:hover { background-color: rgba(255,255,255,0.1); color: var(--text-color); }

.route-detail-item-prominent {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: rgba(0,0,0,0.05);
    border-radius: 6px;
}

.prominent-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.prominent-value {
    font-size: 1.1rem;
    color: var(--text-color);
    line-height: 1.5;
}

.description-value {
    white-space: pre-wrap; /* Preserve line breaks */
    word-break: break-word;
}

.placeholder-text {
    font-style: italic;
    color: rgba(255,255,255,0.5);
}

.route-cover-image-simple {
    margin-top: 0.5rem;
    border-radius: 6px;
    overflow: hidden;
    max-height: 250px;
    display: flex;
    justify-content: flex-start;
    border: 1px solid var(--border-color);
    background-color: rgba(0,0,0,0.1);
}

.route-cover-image-simple img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.route-info-grid.simple-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.route-info-item {
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    background-color: rgba(0,0,0,0.05);
    border-radius: 4px;
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
    text-transform: uppercase;
    font-weight: 600;
}

.info-value {
    font-size: 0.95rem;
    word-break: break-word;
}

.short-url-container.info-value {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.short-url-container a {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.short-url-container .copy-btn i {
    width: 14px; height: 14px;
}

.resource-icon, .mode-icon, .status-icon {
    vertical-align: middle;
    margin-right: 0.3rem;
    width: 1em; height: 1em;
}

.http-method { font-family: monospace; font-weight: bold; }
.price-value { color: var(--earnings-color); font-weight: bold; }
.payment-model { font-weight: 500; }

.route-stats.simple-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.stat-item {
    background-color: rgba(0,0,0,0.05);
    padding: 0.75rem;
    border-radius: 4px;
    text-align: center;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* View Details Button */
.view-details-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    transition: all 0.2s ease;
    opacity: 0.8;
    position: relative;
}

.view-details-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.view-details-btn i {
    color: var(--primary-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .route-info-grid.simple-grid {
        grid-template-columns: 1fr;
    }
    .route-stats.simple-stats {
        grid-template-columns: 1fr;
    }
    .route-details-header h2 {
        font-size: 1.2rem;
    }
}

/* X402 Debug Tool Styles */
.debug-page-container {
    background-color: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 1.2rem;
    max-width: 800px;
    margin: 1rem auto;
}


.debug-form .form-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 0.75rem;
}

/* URL-method group for inline display */
.url-method-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.url-method-group select {
    width: 100px;
    flex-shrink: 0;
    background-color: #325082;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.6rem;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2386b8ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 0.8em;
    padding-right: 1.8rem;
}

.url-method-group input[type="url"] {
    flex-grow: 1;
    background-color: #325082;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.6rem;
}

.debug-form textarea {
    width: 100%;
    background-color: #325082;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.6rem;
    min-height: 80px;
    resize: vertical;
}

.submit-button-container {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
}

.debug-response-area {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    position: relative;
}



.debug-response-area pre,
.debug-response-area code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.4;
    background-color: rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    border-radius: 4px;
    color: #e2e8f0;
    margin: 0;
}

/* JSON formatting in debug tool */
.debug-response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.response-title {
    font-weight: 600;
    color: var(--text-muted);
}

.response-status {
    font-weight: 600;
    color: var(--primary-color);
}

.debug-section {
    margin-bottom: 1rem;
}

.section-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.section-content {
    background-color: rgba(0, 0, 0, 0.15);
    padding: 0.75rem;
    border-radius: 4px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    overflow-x: auto;
    color: #e2e8f0;
    line-height: 1.5;
}

/* JSON specific formatting */
.json-formatted {
    color: #e2e8f0;
}

.json-formatted .json-key {
    color: #63b3ed; /* Light blue for keys */
}

.json-formatted .json-string {
    color: #9ae6b4; /* Light green for strings */
}

.json-formatted .json-number {
    color: #fbd38d; /* Light orange for numbers */
}

.json-formatted .json-boolean {
    color: #fc8181; /* Light red for booleans */
}

.json-formatted .json-null {
    color: #a0aec0; /* Gray for null values */
}