@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap');

:root {
    --app-bg: #0b1220;
    --app-surface: #131c2e;
    --app-surface-elevated: #1a2540;
    --app-card-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    --app-border: #2a3f66;
    --app-muted: #94a3b8;
    --app-text: #e2e8f0;
}

:root,
[data-bs-theme="dark"] {
    --bs-font-sans-serif: 'Open Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Buttons and text fields: consistent corner radius */
.btn,
.btn-sm,
.btn-lg,
.form-control,
.form-control-sm,
.form-control-lg,
.form-select,
.form-select-sm,
.form-select-lg {
    border-radius: 5px;
}

body.app-body {
    font-family: var(--bs-body-font-family);
    background: var(--app-bg);
    color: var(--app-text);
}

html {
    font-family: var(--bs-body-font-family);
}

.app-navbar {
    border-bottom: 1px solid var(--app-border);
    background: rgba(19, 28, 46, 0.96);
    backdrop-filter: blur(8px);
}

.app-navbar .navbar-brand {
    color: var(--app-text);
}

.app-brand-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.app-brand-icon-lg {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.app-card {
    border: 1px solid var(--app-border);
    border-radius: 14px;
    box-shadow: var(--app-card-shadow);
    background: var(--app-surface);
    color: var(--app-text);
}

.card-title-sm {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.dashboard-create-import-cards .card-body {
    font-size: 0.8125rem;
}

.dashboard-create-import-cards .form-control,
.dashboard-create-import-cards .form-select,
.dashboard-create-import-cards textarea.form-control {
    font-size: 0.8125rem;
}

.dashboard-create-import-cards .form-control-lg {
    font-size: 0.875rem;
    min-height: calc(1.45em + 0.65rem + 2px);
    padding: 0.45rem 0.65rem;
}

.dashboard-create-import-cards .btn {
    font-size: 0.8125rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.85rem;
}

.stat-tile {
    background: var(--app-surface-elevated);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    padding: 0.8rem;
}

.stat-tile .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--app-muted);
}

.stat-tile .value {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.table-clean thead th {
    background: var(--app-surface-elevated);
    color: var(--app-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom-width: 1px;
    border-color: var(--app-border);
}

.table-clean td,
.table-clean th {
    vertical-align: middle;
    border-color: var(--app-border);
}

.table-clean {
    --bs-table-bg: transparent;
    --bs-table-color: var(--app-text);
    font-size: 0.875rem;
}

/* Dashboard Lists & Progress: Exact column widths */
.table-lists-progress th:nth-child(1), .table-lists-progress td:nth-child(1) { width: 3%; }
.table-lists-progress th:nth-child(2), .table-lists-progress td:nth-child(2) { width: 15%; white-space: normal; word-break: break-word; }
.table-lists-progress th:nth-child(3), .table-lists-progress td:nth-child(3) { width: 8%; }
.table-lists-progress th:nth-child(4), .table-lists-progress td:nth-child(4) { width: 8%; }
.table-lists-progress th:nth-child(5), .table-lists-progress td:nth-child(5) { width: 8%; }
.table-lists-progress th:nth-child(6), .table-lists-progress td:nth-child(6) { width: 8%; }
.table-lists-progress th:nth-child(7), .table-lists-progress td:nth-child(7) { width: 5%; }
.table-lists-progress th:nth-child(8), .table-lists-progress td:nth-child(8) { width: 5%; }
.table-lists-progress th:nth-child(9), .table-lists-progress td:nth-child(9) { width: 13%; }
.table-lists-progress th:nth-child(10), .table-lists-progress td:nth-child(10) { width: 8%; }
.table-lists-progress th:nth-child(11), .table-lists-progress td:nth-child(11) { width: 19%; }

.btn-soft {
    border: 1px solid var(--app-border);
    background: var(--app-surface-elevated);
    color: var(--app-text);
}

.btn-soft:hover {
    background: #243352;
    color: var(--app-text);
}

/* Distinct, Vibrant & Colorful Button Variants */
.btn-action-copy {
    background: linear-gradient(135deg, #0284c7 0%, #06b6d4 100%);
    border: 1px solid rgba(56, 189, 248, 0.6);
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(6, 182, 212, 0.35);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-action-copy:hover:not(:disabled) {
    background: linear-gradient(135deg, #0369a1 0%, #0891b2 100%);
    border-color: #38bdf8;
    color: #ffffff !important;
    box-shadow: 0 4px 18px rgba(6, 182, 212, 0.65);
    transform: translateY(-2px);
}

.btn-action-copy:active:not(:disabled) {
    transform: translateY(0);
}

.btn-action-export {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border: 1px solid rgba(52, 211, 153, 0.6);
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-action-export:hover:not(.disabled):not(:disabled) {
    background: linear-gradient(135deg, #047857 0%, #059669 100%);
    border-color: #34d399;
    color: #ffffff !important;
    box-shadow: 0 4px 18px rgba(16, 185, 129, 0.65);
    transform: translateY(-2px);
}

.btn-action-export:active:not(.disabled):not(:disabled) {
    transform: translateY(0);
}

.btn-action-add {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    border: 1px solid rgba(192, 132, 252, 0.6);
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(168, 85, 247, 0.35);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-action-add:hover:not(:disabled) {
    background: linear-gradient(135deg, #6d28d9 0%, #9333ea 100%);
    border-color: #c084fc;
    color: #ffffff !important;
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.65);
    transform: translateY(-2px);
}

.btn-action-add:active:not(:disabled) {
    transform: translateY(0);
}

.btn-action-csv {
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
    border: 1px solid rgba(251, 146, 60, 0.6);
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.35);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-action-csv:hover:not(:disabled) {
    background: linear-gradient(135deg, #d97706 0%, #c2410c 100%);
    border-color: #fb923c;
    color: #ffffff !important;
    box-shadow: 0 4px 18px rgba(234, 88, 12, 0.65);
    transform: translateY(-2px);
}

.btn-action-csv:active:not(:disabled) {
    transform: translateY(0);
}

.btn-action-zip {
    background: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
    border: 1px solid rgba(244, 114, 182, 0.6);
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(236, 72, 153, 0.35);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-action-zip:hover:not(:disabled) {
    background: linear-gradient(135deg, #db2777 0%, #e11d48 100%);
    border-color: #f472b6;
    color: #ffffff !important;
    box-shadow: 0 4px 18px rgba(236, 72, 153, 0.65);
    transform: translateY(-2px);
}

.btn-action-zip:active:not(:disabled) {
    transform: translateY(0);
}

.action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    justify-content: flex-end;
}

.btn-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.125rem;
    height: 2.125rem;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
}

.btn-action-icon i {
    display: block;
    line-height: 1;
}

.btn-action-icon:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.action-tooltip-wrap {
    line-height: 0;
    vertical-align: middle;
}

.app-cron-path-box {
    border-radius: 5px;
    background: var(--app-surface-elevated);
    border-color: var(--app-border) !important;
    color: var(--app-text);
}

.keyword-chip {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.18) 0%, rgba(139, 92, 246, 0.18) 100%);
    border: 1px solid rgba(139, 92, 246, 0.45);
    color: #e0e7ff;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.keyword-chip:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.25) 0%, rgba(220, 38, 38, 0.25) 100%);
    border-color: #ef4444;
    color: #fecaca;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.auth-wrapper {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.auth-card {
    max-width: 900px;
    width: 100%;
}

.auth-hero {
    background: linear-gradient(140deg, #1d4ed8, #1e3a8a 55%, #2563eb);
    color: #fff;
    border-radius: 14px 0 0 14px;
    padding: 2rem;
}

.auth-pane {
    padding: 2rem;
    background: var(--app-surface);
}

.auth-muted {
    color: #bfdbfe;
}

.empty-state {
    border: 1px dashed var(--app-border);
    border-radius: 12px;
    padding: 1.1rem;
    color: var(--app-muted);
    background: var(--app-surface-elevated);
}

@media (max-width: 991px) {
    .auth-hero {
        border-radius: 14px 14px 0 0;
    }
}

/* Top-right Floating Toast Notification */
.app-toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: calc(100vw - 2.5rem);
    pointer-events: none;
}

.app-toast {
    pointer-events: auto;
    min-width: 280px;
    max-width: 420px;
    padding: 0.85rem 1.15rem;
    border-radius: 10px;
    background: rgba(19, 28, 46, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.1);
    border: 1px solid var(--app-border);
    color: var(--app-text);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: appToastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.app-toast.app-toast-hiding {
    opacity: 0;
    transform: translateY(-12px) scale(0.96);
}

.app-toast-icon {
    font-size: 1.15rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.app-toast-body {
    flex-grow: 1;
    font-weight: 500;
    line-height: 1.4;
}

.app-toast-close {
    background: transparent;
    border: none;
    color: var(--app-muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.app-toast-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* Toast Color Variants */
.app-toast-success {
    border-color: rgba(52, 211, 153, 0.4);
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.94) 0%, rgba(19, 28, 46, 0.97) 100%);
}
.app-toast-success .app-toast-icon {
    color: #34d399;
}

.app-toast-info {
    border-color: rgba(56, 189, 248, 0.4);
    background: linear-gradient(135deg, rgba(12, 74, 110, 0.94) 0%, rgba(19, 28, 46, 0.97) 100%);
}
.app-toast-info .app-toast-icon {
    color: #38bdf8;
}

.app-toast-warning {
    border-color: rgba(251, 191, 36, 0.4);
    background: linear-gradient(135deg, rgba(120, 53, 15, 0.94) 0%, rgba(19, 28, 46, 0.97) 100%);
}
.app-toast-warning .app-toast-icon {
    color: #fbbf24;
}

.app-toast-danger {
    border-color: rgba(248, 113, 113, 0.4);
    background: linear-gradient(135deg, rgba(127, 29, 29, 0.94) 0%, rgba(19, 28, 46, 0.97) 100%);
}
.app-toast-danger .app-toast-icon {
    color: #f87171;
}

@keyframes appToastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
