/* ASIO Sweden Lead Generator - Modern Styles */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Modern Color Palette */
    --primary: hsl(210, 100%, 50%);
    --primary-dark: hsl(210, 100%, 40%);
    --secondary: hsl(270, 60%, 60%);
    --success: hsl(142, 76%, 36%);
    --danger: hsl(0, 72%, 51%);
    --warning: hsl(45, 100%, 51%);

    /* Neutrals */
    --bg-primary: hsl(220, 15%, 10%);
    --bg-secondary: hsl(220, 15%, 15%);
    --bg-card: hsl(220, 15%, 18%);
    --text-primary: hsl(0, 0%, 95%);
    --text-secondary: hsl(0, 0%, 70%);
    --border: hsl(220, 15%, 25%);

    /* Effects */
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h2 {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

/* Container */
.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 2rem;
}


/* Navbar */
.navbar {
    background: #213B76;
    padding: 0.5rem 0;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: nowrap;
}

.logo {
    font-size: 0;
    margin: 0;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo img {
    height: 65px;
    width: auto;
}

.nav-tabs {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    align-items: center;
}

.nav-tab {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.9rem;
    position: relative;
    white-space: nowrap;
}

.nav-tab:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.nav-tab.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: white;
}

/* Main Content */
main {
    flex: 1;
    padding: 3rem 0;
}

.main-interface {
    width: 100%;
    margin: 0 auto;
}

/* Grid Layout Utilities */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.grid-1-2 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

.col-span-2 {
    grid-column: span 2;
}

.col-span-full {
    grid-column: 1 / -1;
}

@media (max-width: 1200px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .grid-2,
    .grid-3,
    .grid-1-2 {
        grid-template-columns: 1fr;
    }

    .col-span-2 {
        grid-column: span 1;
    }
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

/* Card */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* File Upload Area */
.file-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.file-upload-area:hover,
.file-upload-area.drag-over {
    border-color: var(--primary);
    background: hsla(210, 100%, 50%, 0.05);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.file-upload-area p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* File List */
.file-list {
    margin-top: 1.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.file-item:hover {
    background: var(--bg-primary);
}

.file-name {
    color: var(--text-primary);
    font-weight: 500;
}

.file-remove {
    color: var(--danger);
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.file-remove:hover {
    color: hsl(0, 72%, 61%);
}

/* Source Checkboxes */
.source-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.checkbox-label:hover {
    background: var(--bg-primary);
    transform: translateX(4px);
}

.checkbox-label input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
    cursor: pointer;
}

.checkbox-label span {
    color: var(--text-primary);
    font-weight: 500;
}

/* Buttons */
.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-primary);
    border-color: var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: hsl(0, 72%, 61%);
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: hsl(142, 76%, 30%);
    /* Darker shade */
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(22, 163, 74, 0.4);
}

/* Help Text */
.help-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Job Status */
.job-status {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.status-label {
    font-weight: 600;
    margin-right: 0.5rem;
    color: var(--text-secondary);
}

.status-value {
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
}

/* Log Container */
.log-container {
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    padding: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
}

.log-container pre {
    margin: 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Scrollbar */
.log-container::-webkit-scrollbar {
    width: 8px;
}

.log-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Job Actions */
.job-actions {
    margin-top: 1rem;
}

/* Footer */
footer {
    background: var(--bg-card);
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--border);
}

footer p {
    color: var(--text-secondary);
    text-align: center;
    font-size: 0.9rem;
}

/* Error Container */
.error-container {
    text-align: center;
    padding: 3rem;
}

.error-message {
    color: var(--danger);
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.4s ease-out;
}

/* Database View Styles */
.database-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.search-input {
    display: block;
    width: 100%;
    height: 46px !important;
    flex: none !important;
    padding: 0 1rem !important;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
    box-sizing: border-box !important;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-primary);
}

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
}

.data-table thead {
    background: var(--bg-primary);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 0.875rem 1rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover {
    background: var(--bg-primary);
}

.data-table .no-data {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Results Container */
.results-container {
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    padding: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.results-container pre {
    margin: 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.results-actions {
    margin-top: 1rem;
}

/* Import Form Styles */
.import-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
}

.form-control {
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-primary);
}

.form-control:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-control-sm {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    height: auto;
}

.table-info {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    text-align: center;
}

.table-info p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    /* Mobile Navbar Fixes */
    .navbar .container {
        flex-wrap: wrap;
        gap: 1rem;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .logo img {
        height: 40px;
        /* Smaller logo */
    }

    .nav-tabs {
        width: 100%;
        justify-content: center;
        order: 3;
        /* Ensure tabs wrap to bottom */
        margin-top: 0.5rem;
    }

    .user-info {
        margin-left: auto;
    }

    .source-checkboxes {
        grid-template-columns: 1fr;
    }

    h2 {
        font-size: 1.5rem;
    }

    .nav-tabs {
        flex-direction: column;
        gap: 0.25rem;
    }

    .database-controls {
        flex-direction: column;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: var(--bg-card);
    margin: 5% auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close-modal {
    color: var(--text-secondary);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: var(--primary);
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Reminder Items (Shared between Dashboard and Lead Detail) */
.reminder-item {
    border-left: 3px solid var(--primary);
    padding: 0.75rem 2.5rem 0.75rem 0.75rem;
    /* Extra right padding for delete button */
    background: var(--bg-secondary);
    margin-bottom: 0.5rem;
    border-radius: 0 4px 4px 0;
    position: relative;
    transition: transform 0.1s;
}

.reminder-item:hover {
    transform: translateX(2px);
}

.reminder-item.completed {
    border-left-color: var(--success);
    opacity: 0.7;
}

.reminder-item.overdue {
    border-left-color: var(--danger);
    background: rgba(220, 53, 69, 0.1);
    /* Transparent red for dark mode compatibility */
}

.reminder-delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 0.8rem;
    opacity: 0.5;
    transition: all 0.2s;
}

.reminder-item:hover .reminder-delete-btn {
    opacity: 1;
}

.reminder-delete-btn:hover {
    color: var(--danger);
    transform: scale(1.1);
}

/* Property Explorer Styles */
.detail-section {
    margin-bottom: 2rem;
}

.detail-section h4 {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.owner-card {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.owner-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.same-address-list {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border);
}

.same-address-item {
    font-size: 0.9rem;
    padding: 0.25rem 0;
    color: var(--text-secondary);
}

.action-item {
    padding: 0.75rem;
    border-left: 3px solid var(--secondary);
    background: var(--bg-secondary);
    margin-bottom: 0.5rem;
    border-radius: 0 4px 4px 0;
}

#map {
    z-index: 1;
}

/* Map Modal Close Button */
.close-map-modal {
    color: var(--text-secondary);
    font-size: 2.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
    padding: 0 10px;
}

.close-map-modal:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

/* Badge Utility (if not already present or needs override) */
.badge {
    background: var(--bg-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    display: inline-block;
    /* Ensure it respects padding/margin */
}

/* Small Button Utility */
.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}