:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #10b981;
    --secondary-hover: #059669;
    --danger: #ef4444;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 2rem;
    padding: 0 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: transparent;
    width: 100%;
}

.sidebar-item:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.sidebar-item.active {
    background: #eef2ff;
    color: var(--primary);
}

.sidebar-icon {
    width: 20px;
    height: 20px;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    max-width: calc(100% - 260px);
    position: relative;
    /* Contain absolute loader */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

body {
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.5;
    /* Remove body padding since sidebar handles it */
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
}

.upload-section {
    background: var(--card-bg);
    border: 2px dashed var(--border);
    border-radius: 1rem;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.upload-section:hover {
    border-color: var(--primary);
    background: #f1f5f9;
}

.upload-box svg {
    color: var(--primary);
    margin-bottom: 1rem;
}

.upload-box p span {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

.controls-section {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.btn-success {
    background: #10b981;
    color: white;
    margin-top: 1rem;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.btn-primary {
    background: var(--primary);
    color: white;
}

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

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-hover);
}

.btn-danger {
    background: #fee2e2;
    color: var(--danger);
}

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

.table-section {
    background: var(--card-bg);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 3rem;
}

.table-wrapper {
    overflow-x: auto;
    max-height: 500px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}

th {
    background: #f8fafc;
    padding: 1.25rem 1rem;
    font-weight: 700;
    color: #475569;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-main);
    min-width: 150px;
    /* Prevent squashing */
    max-width: 400px;
    vertical-align: middle;
}

tr:hover td {
    background-color: #f1f5f9;
}

/* Specific Column Tuning */
th:first-child,
td:first-child {
    padding-left: 1.5rem;
}

th:last-child,
td:last-child {
    padding-right: 1.5rem;
}

td[contenteditable="true"] {
    transition: all 0.2s;
    cursor: text;
}

td[contenteditable="true"]:focus {
    outline: none;
    background: white !important;
    box-shadow: inset 0 0 0 2px var(--primary);
}

.status-msg {
    font-size: 0.9rem;
    font-weight: 500;
}

.status-msg.success {
    color: var(--secondary);
}

.status-msg.error {
    color: var(--danger);
}

/* Leads Section Specifics */
.leads-table-container {
    background: var(--card-bg);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow);
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

.table-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.btn-mini {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    border-radius: 0.35rem;
    background: #f1f5f9;
    color: var(--text-main);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-mini:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

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

.spinner-small {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.status-pending {
    background: #f1f5f9;
    color: #64748b;
}

.status-processing {
    background: #e0e7ff;
    color: #4338ca;
}

.status-success {
    background: #dcfce7;
    color: #15803d;
}

.status-no-data {
    background: #fef9c3;
    color: #a16207;
}

.status-no-response {
    background: #ffedd5;
    color: #9a3412;
}

.status-error {
    background: #fee2e2;
    color: #b91c1c;
}

/* Full Page Loader Overlay */
.loader-overlay {
    position: absolute;
    /* Changed to only cover main-content */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    background: transparent;
    /* Totally clear so you can see perfectly */
    pointer-events: none;
    /* Allows you to click things through the loader */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    flex-direction: column;
    transition: opacity 0.5s ease;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
}

.loader-logo {
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, #1e3a8a 0%, #172554 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: lowercase;
    box-shadow: 0 0 40px rgba(30, 58, 138, 0.4);
    font-family: 'Outfit', sans-serif;
}

.loader-logo span span {
    color: #60a5fa;
}

.loader-spinner-container {
    position: relative;
    width: 100px;
    height: 50px;
    display: flex;
    justify-content: center;
}

.loader-arc {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 4px solid transparent;
    border-top-color: #3b82f6;
    border-radius: 50%;
    top: -10px;
    animation: spinLoader 1.5s cubic-bezier(0.53, 0.21, 0.29, 0.67) infinite;
}

.loader-arc-small {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid transparent;
    border-top-color: #60a5fa;
    border-radius: 50%;
    top: 5px;
    animation: spinLoader 1s cubic-bezier(0.53, 0.21, 0.29, 0.67) reverse infinite;
}

@keyframes spinLoader {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: #94a3b8;
    letter-spacing: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    margin-top: 1rem;
    text-shadow: 0 0 10px rgba(148, 163, 184, 0.3);
}