/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    color: #e0e0e0;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #333;
    padding: 1rem 0;
    position: sticky; /* was sticky */
    top: 0;
    z-index: 100;
}

.header-wrapper {
    position: relative; /* For absolute positioning of history */
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 2rem;
    background: linear-gradient(45deg, #00d4ff, #ff00d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-btn {
    padding: 0.4rem 0.8rem;
    border: 1px solid #333;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.header-btn:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: #00d4ff;
    color: #00d4ff;
}

.docs-btn:hover {
    background: rgba(255, 0, 212, 0.1);
    border-color: #ff00d4;
    color: #ff00d4;
}

.session-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid #ff4444;
    border-radius: 8px;
}

.session-status.active {
    background: rgba(0, 255, 0, 0.1);
    border-color: #44ff44;
}

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

.session-status.active .status-indicator {
    background: #44ff44;
}

/* Ensure Active text is green */
#sessionTime {
    color: #10b981 !important;
}

.session-status.active .status-text {
    color: #10b981 !important;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Cards */
.card {
    background: rgba(25, 25, 25, 0.6);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.card:hover {
    border-color: #444;
    transform: translateY(-1px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid #333;
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

.card-header p {
    font-size: 0.85rem;
    color: #aaa;
    margin: 0;
}

/* Payment Section */
.payment-content {
    text-align: left;
}

.payment-section {
    margin-bottom: 1rem; /* Reduced margin to lift up */
    margin-top: -0.5rem; /* Lift up slightly */
}

.payment-card {
    max-width: 400px;
    margin: 0 auto;
}

.payment-card-wide {
    max-width: 100%;
}

.payment-card-wide .card-header {
    padding: 0.75rem 1rem;
}

.payment-card-wide .payment-content {
    padding: 0.75rem 1rem 1rem;
}

.wallet-input-section.compact label {
    font-size: 0.85rem;
}

.wallet-input-section.compact input {
    padding: 0.5rem;
    font-size: 0.9rem;
}

.payment-card-wide .card-header h2 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.payment-card-wide .card-header p {
    font-size: 0.85rem;
    margin: 0;
}

.payment-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.payment-address {
    margin: 2rem 0;
    text-align: left;
}

.payment-address label {
    display: block;
    margin-bottom: 0.5rem;
    color: #ccc;
    font-weight: 500;
}

.address-input {
    display: flex;
    gap: 0.5rem;
}

.address-input input {
    flex: 1;
    padding: 0.75rem;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid #444;
    border-radius: 8px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.copy-btn {
    padding: 0.75rem 1rem;
    background: #333;
    border: 1px solid #555;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: #555;
}

.transaction-input {
    margin: 1.5rem 0;
    text-align: left;
}

.transaction-input label {
    display: block;
    margin-bottom: 0.5rem;
    color: #ccc;
    font-weight: 500;
}

.transaction-input input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid #444;
    border-radius: 8px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.verify-btn {
    background: linear-gradient(45deg, #00d4ff, #ff00d4);
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    color: #000;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.verify-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 212, 255, 0.3);
}

/* Recommendations */
.recommendations-section {
    margin-bottom: 1rem;
}

.recommendations-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.recommendation-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(20, 20, 20, 0.4);
    border: 1px solid #333;
    border-radius: 6px;
    font-size: 0.9rem;
}

.recommendation-item .icon {
    font-size: 1rem;
    min-width: 1.5rem;
    text-align: center;
}

.recommendation-item .text {
    color: #ccc;
    line-height: 1.4;
}

/* Process Description */
.process-description-section {
    margin-bottom: 1rem;
}

.process-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.process-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(20, 20, 20, 0.4);
    border: 1px solid #333;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.process-step:hover {
    border-color: #555;
    background: rgba(30, 30, 30, 0.6);
}

.step-detail {
    margin-top: 0.5rem;
    color: #bbb;
    border-top: 1px dashed #333;
    padding-top: 0.5rem;
    font-size: 0.8rem;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    background: linear-gradient(45deg, #00d4ff, #ff00d4);
    color: #000;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.step-content h3 {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.step-content p {
    color: #aaa;
    font-size: 0.75rem;
    line-height: 1.3;
    margin: 0;
}

/* Wallet Input Section */
.wallet-input-section {
    margin: 1rem 0;
    text-align: left;
}

.wallet-input-section label {
    display: block;
    margin-bottom: 0.4rem;
    color: #ccc;
    font-weight: 500;
    font-size: 0.9rem;
}

.wallet-input-section input {
    width: 100%;
    padding: 0.6rem;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid #444;
    border-radius: 6px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.wallet-input-section input:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
}

.input-help {
    display: block;
    margin-top: 0.2rem;
    color: #888;
    font-size: 0.75rem;
    font-style: italic;
}

.confirm-payment-btn {
    background: linear-gradient(45deg, #00d4ff, #ff00d4);
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 6px;
    color: #000;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.8rem;
    width: 100%;
}

.confirm-payment-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(0, 212, 255, 0.3);
}

.confirm-payment-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Payment Info */
.payment-info {
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
}

.payment-info p {
    margin: 0.5rem 0;
    color: #e0e0e0;
    font-size: 0.9rem;
}

.payment-status {
    margin: 1rem 0;
    text-align: center;
}

.status-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: #00d4ff;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #333;
    border-top: 2px solid #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dashboard Layout */
.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 400px; /* Increased right sidebar from 300px to 400px */
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.main-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr; /* Equal width: Settings, Control Panel, Live Logs */
    gap: 1.5rem;
    max-width: 1200px; /* Match container width to align with process overview card */
    margin: 0 auto;
}

@media (max-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
    
    .history-sidebar {
        order: -1;
    }
}

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

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-group label {
    color: #ccc;
    font-weight: 500;
    font-size: 0.9rem;
}

.setting-group input {
    padding: 0.75rem;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid #444;
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
}

.setting-group input:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
}

.setting-group input:disabled {
    opacity: 0.5;
    background: rgba(20, 20, 20, 0.3);
    cursor: not-allowed;
    border: 1px solid #333;
    color: #667;
}

.setting-group input:disabled::placeholder {
    color: #667;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.control-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.status-display {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #333;
}

.status-item:last-child {
    border-bottom: none;
}

.status-item .label {
    color: #888;
    font-weight: 500;
}

.status-item .value {
    color: #fff;
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 1rem;
}

.action-buttons.vertical {
    flex-direction: column;
    gap: 0.75rem;
}

.fee-info {
    text-align: center;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 6px;
    color: #10b981;
}

.fee-info small {
    font-size: 0.8rem;
    font-weight: 500;
}

.btn-wide {
    width: 100%;
    padding: 0.75rem 1rem;
}

.btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-primary {
    background: linear-gradient(45deg, #00d4ff, #ff00d4);
    color: #000;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 212, 255, 0.3);
}

.btn-secondary {
    background: #333;
    color: #fff;
    border: 1px solid #555;
}

.btn-secondary:hover:not(:disabled) {
    background: #555;
}

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

/* History Sidebar */
.history-sidebar {
    display: flex;
    flex-direction: column;
}

.history-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.history-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab-btn {
    flex: 1;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    border: 1px solid #333;
    color: #888;
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #00d4ff 0%, #ff00d4 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.tab-btn.active {
    color: #fff;
    border-color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.tab-btn.active::before {
    opacity: 1;
}

.tab-btn:hover {
    color: #fff;
    border-color: #555;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
    height: 100%;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.history-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
}

.history-info {
    padding: 1rem;
    background: rgba(20, 20, 20, 0.6);
    border: 1px solid #333;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #ccc;
}

.history-info p {
    margin: 0.5rem 0;
}

.history-list {
    flex: 1 1 auto;
    overflow-y: auto;
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 0.5rem;
    height: 100%;
}

.history-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: rgba(30, 30, 30, 0.8);
    border: 1px solid #444;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.history-item:hover {
    border-color: #666;
    background: rgba(40, 40, 40, 0.8);
}

.history-item.placeholder {
    opacity: 0.6;
    font-style: italic;
}

.history-item .wallet-number {
    display: block;
    color: #00d4ff;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.history-item .wallet-address {
    display: block;
    color: #e0e0e0;
    margin-bottom: 0.25rem;
    word-break: break-all;
}

.history-item .private-key {
    display: block;
    color: #888;
    font-size: 0.75rem;
    word-break: break-all;
}

/* Token History Styles */
.token-item {
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.token-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #333;
}

.token-number {
    background: #00d4ff;
    color: #000;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.token-name {
    font-weight: bold;
    color: #fff;
}

.token-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.token-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.token-detail .label {
    color: #888;
    font-size: 0.8rem;
}

.token-detail .value {
    color: #fff;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Wallet History Styles */
.wallet-item {
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.wallet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #333;
}

.wallet-number {
    background: #333 !important;
    color: #fff !important;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Override any green backgrounds in history */
.history-item .wallet-number {
    background: #333 !important;
    color: #fff !important;
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.wallet-address {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #00d4ff;
}

.wallet-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.private-key-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.private-key-section .label {
    color: #888;
    font-size: 0.8rem;
}

.private-key-section .private-key {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: #888;
    word-break: break-all;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5rem;
    border-radius: 4px;
}

.export-btn {
    background: #333;
    border: 1px solid #555;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

.export-btn:hover {
    background: #555;
}

/* Logs */
.logs-card {
    height: 400px;
    display: flex;
    flex-direction: column;
}

.logs-card .card-header {
    margin-bottom: 1rem;
}

.clear-btn {
    background: #333;
    border: 1px solid #555;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

.clear-btn:hover {
    background: #555;
}

.logs-content {
    flex: 1;
    overflow: hidden;
}

.logs-container {
    height: 100%;
    overflow-y: auto;
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    white-space: nowrap;
    overflow-x: hidden;
    /* Safari-specific fixes */
    -webkit-overflow-scrolling: touch;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    /* Ensure logs are never disabled */
    pointer-events: auto !important;
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
}

/* Safari-specific overrides */
@supports (-webkit-appearance: none) {
    .logs-container {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    /* Safari: ensure history uses full intended size */
    .history-sidebar {
        margin-left: 0 !important;
        width: 320px !important;
        min-width: 320px !important;
        max-width: 320px !important;
        -webkit-flex: 0 0 320px !important;
        flex: 0 0 320px !important;
        align-self: stretch !important;
    }
    .dashboard-layout {
        align-items: stretch !important;
    }
    .history-card {
        height: 100% !important;
        display: -webkit-flex !important;
        display: flex !important;
        -webkit-flex-direction: column !important;
        flex-direction: column !important;
    }
    .history-content {
        -webkit-flex: 1 1 auto !important;
        flex: 1 1 auto !important;
        display: -webkit-flex !important;
        display: flex !important;
        -webkit-flex-direction: column !important;
        flex-direction: column !important;
        min-height: 0 !important;
    }
    .history-list {
        -webkit-flex: 1 1 auto !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
    }
    
    /* Safari: ensure flex children don't overflow and scroll correctly */
    .dashboard-layout,
    .control-panel,
    .logs-card,
    .history-card,
    .history-content,
    .logs-content {
        min-height: 0 !important;
        align-items: stretch !important;
    }
    
    .logs-content,
    .history-content {
        display: -webkit-flex !important;
        display: flex !important;
        -webkit-flex-direction: column !important;
        flex-direction: column !important;
    }
    
    .logs-container,
    .history-list {
        -webkit-overflow-scrolling: touch !important;
        -webkit-transform: translateZ(0) !important;
        transform: translateZ(0) !important;
    }
    
    /* Tabs: ensure content is visible and fills space */
    .tab-content.active {
        display: -webkit-flex !important;
        display: flex !important;
        -webkit-flex-direction: column !important;
        flex-direction: column !important;
        min-height: 0 !important;
    }
    
    .logs-card {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .logs-content {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .log-entry {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        color: #fff !important;
    }
}

/* Dashboard Layout - History as overlay */
.dashboard-layout {
    display: flex;
    width: 100%;
    max-width: 1200px !important; /* Match container width exactly */
    margin: 0 auto;
    gap: 0.5rem !important;
    position: relative; /* For absolute positioning of history */
}

.history-sidebar {
    position: absolute;
    top: 100%; /* Position right under the header */
    right: 20px; /* Align with the right side of the header */
    width: 320px;
    min-width: 320px;
    max-width: 320px;
    z-index: 1000; /* High z-index to overlap other elements */
    display: none; /* Initially hidden */
    background: rgba(0, 0, 0, 0.95); /* Semi-transparent background */
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.history-sidebar.visible {
    display: flex; /* Show when visible */
}

.logs-card {
    flex: 1 !important;
    min-width: 0;
    overflow: hidden;
    height: 400px !important;
    width: 100%; /* Take full width when history is hidden */
}

.log-entry {
    margin-bottom: 0.5rem;
    word-wrap: break-word;
}

.log-entry .timestamp {
    color: #666;
    margin-right: 0.5rem;
}

.log-entry .message {
    color: #e0e0e0;
}

.log-entry.error .message {
    color: #ff6b6b;
}

.log-entry.success .message {
    color: #51cf66;
}

.log-entry.warning .message {
    color: #ffd43b;
}

/* Footer */
.footer {
    background: rgba(20, 20, 20, 0.95);
    border-top: 1px solid #333;
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
}

.footer p {
    color: #888;
    font-size: 0.9rem;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.5s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .amount {
        font-size: 2rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .logs-card {
        height: 300px;
    }
}

/* Settings Validation Styles */
.valid-setting {
    border: 2px solid #51cf66 !important;
    box-shadow: 0 0 8px rgba(81, 207, 102, 0.3) !important;
    background-color: rgba(81, 207, 102, 0.05) !important;
}

.invalid-setting {
    border: 2px solid #fa5252 !important;
    box-shadow: 0 0 8px rgba(250, 82, 82, 0.3) !important;
    background-color: rgba(250, 82, 82, 0.05) !important;
}

.validation-message {
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
}


.form-group {
    position: relative;
}

/* History dropdown refinement - position under header buttons */
.history-sidebar {
	position: absolute;
	top: 100%;
	left: 0; /* will be set dynamically by JS to align under History button */
	right: auto; /* JS overrides */
	width: 320px;
	min-width: 280px;
	max-width: 90vw;
	z-index: 1000;
	display: none;
	background: rgba(0, 0, 0, 0.95);
	border-radius: 8px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Unify widths with payment/process cards by matching container width */
.dashboard-grid {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr; /* Equal width: Settings, Control Panel, Live Logs */
	gap: 1.5rem;
	max-width: 1200px; /* Match container width to align with process overview card */
	margin: 0 auto;
	width: 100%;
}

.dashboard-layout {
	display: flex;
	width: 100%;
	max-width: 1200px !important; /* match .dashboard-grid and container */
	margin: 0 auto;
	gap: 0.5rem !important;
	position: relative;
}

.logs-card {
	flex: 1 !important;
	min-width: 0;
	overflow: hidden;
	height: 400px !important;
	width: 100%;
}

/* Mobile-specific layout for comfortable use on small screens */
@media (max-width: 480px) {
	/* Stack sections and add padding */
	.container {
		padding: 0 12px;
	}
	.header .container {
		flex-direction: column;
		gap: 0.75rem;
	}
	.header-buttons .header-btn {
		padding: 0.6rem 0.8rem;
		font-size: 0.95rem;
	}
	.payment-card,
	.recommendations-card {
		max-width: 100%;
	}
	.dashboard-grid {
		grid-template-columns: 1fr; /* stack settings and control panel */
		gap: 1rem;
		max-width: 100%;
	}
	.logs-card {
		height: 300px !important;
	}
	/* History dropdown spans screen width on mobile for easier reading */
	.history-sidebar {
		left: 12px !important;
		right: 12px !important;
		width: auto;
		max-width: none;
	}
	.tab-btn {
		font-size: 0.95rem;
		padding: 0.75rem 1rem;
	}
	.history-list {
		max-height: 50vh;
	}
}

/* Mobile app-like layout */
@media (max-width: 480px) {
	:root {
		/* Avoid iOS Safari address bar jump */
		height: 100%;
	}
	html, body {
		height: 100%;
	}
	body {
		display: flex;
		flex-direction: column;
		height: 100vh; /* App-like viewport */
		overflow: hidden; /* prevent double scroll */
	}
	.app {
		display: flex;
		flex-direction: column;
		min-height: 100%;
	}
	.main {
		flex: 1 1 auto;
		overflow-y: auto; /* single scroll area */
		-webkit-overflow-scrolling: touch;
	}
	/* Stack sections full-width */
	.container { padding: 0 12px; max-width: 100%; }
	.recommendations-section, .payment-section, .dashboard-section { margin: 10px 0; }
	.payment-card, .recommendations-card, .settings-card, .control-card, .logs-card { width: 100%; max-width: 100%; }
	.dashboard-grid { grid-template-columns: 1fr; gap: 12px; max-width: 100%; }
	.logs-card { height: 300px !important; }
	/* Header remains sticky app bar */
	.header { position: sticky; top: 0; z-index: 100; }
	.header .container { flex-direction: column; gap: 8px; }
	.header-buttons .header-btn { padding: 10px 12px; font-size: 15px; }
	/* History dropdown fills width on mobile */
	.history-sidebar { left: 12px !important; right: 12px !important; width: auto; max-width: none; }
	/* Full-width containers and cards */
	.container { max-width: 100%; width: 100%; padding: 0 12px; }
	.recommendations-card,
	.payment-card,
	.settings-card,
	.control-card,
	.logs-card,
	.history-card,
	.card { width: 100% !important; max-width: 100% !important; }
	.dashboard-grid { grid-template-columns: 1fr !important; max-width: 100% !important; width: 100% !important; }
	.dashboard-layout { max-width: 100% !important; width: 100% !important; }
	/* Ensure inputs and buttons fill width where appropriate */
	input[type="text"],
	input[type="password"],
	input[type="number"],
	button,
	select,
	textarea { width: 100%; box-sizing: border-box; }
	/* History dropdown spans available width */
	.history-sidebar { left: 12px !important; right: 12px !important; width: auto !important; max-width: none !important; }
	/* Ensure cards and panels share same centered width */
	.recommendations-card,
	.payment-card,
	.settings-card,
	.control-card,
	.logs-card,
	.history-card,
	.card {
		max-width: 85% !important;
		width: 85% !important;
		margin-left: auto !important;
		margin-right: auto !important;
	}
	/* Align dashboard containers under cards */
	.dashboard-grid,
	.dashboard-layout {
		max-width: 85% !important;
		width: 85% !important;
		margin-left: auto !important;
		margin-right: auto !important;
	}
	/* Make logs thinner and wrap messages */
	.logs-card { height: 280px !important; }
	.logs-container {
		white-space: normal !important;
		word-break: break-word !important;
		overflow-wrap: anywhere !important;
	}
	.log-entry .log-message { white-space: normal !important; }
}
