:root {
    --primary-blue: #0f62fe;
    --primary-hover: #0043ce;
    --bg-color: #f4f7fb;
    --card-bg: #ffffff;
    --text-dark: #161616;
    --text-muted: #525252;
    --border-color: #e0e0e0;
    --accent-light: #edf5ff;
    --header-bg: #ffffff;
    --success: #198754;
}

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

body {
    font-family: 'Assistant', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-dark);
    direction: rtl;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
}

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

header.top-header {
    background: var(--header-bg);
    padding: 1.25rem 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
}

.freelance-logo {
    max-height: 44px;
    width: auto;
}

.subtitle {
    font-size: 1.1rem;
    color: #002d9c;
    font-weight: 700;
    margin: 0;
}

.btn-freelance-connect {
    background: linear-gradient(135deg, #0f62fe 0%, #0043ce 100%);
    color: #ffffff;
    border: none;
    padding: 0.45rem 1rem;
    font-size: 0.88rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(15, 98, 254, 0.2);
}

.btn-freelance-connect:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 98, 254, 0.3);
}

.freelance-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #e6f4ea;
    border: 1px solid #ceead6;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #137333;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-text {
    color: #137333;
    font-weight: 600;
    font-size: 0.85rem;
}

.btn-disconnect-sm {
    background: #ffffff;
    border: 1px solid #b7e1cd;
    color: #137333;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-disconnect-sm:hover {
    background-color: #fff0f1;
    border-color: #ffb3b8;
    color: #da1e28;
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.07);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 2px solid var(--accent-light);
    padding-bottom: 0.75rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.btn {
    background-color: var(--primary-blue);
    color: #ffffff;
    border: none;
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(15, 98, 254, 0.2);
}

.btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 98, 254, 0.3);
}

.btn-google {
    background-color: #ffffff;
    color: #3c4043;
    border: 1px solid #dadce0;
    box-shadow: 0 2px 6px rgba(57, 57, 57, 0.2);
}

.btn-google:hover {
    background-color: #f8f9fa;
    box-shadow: 0 4px 12px rgba(38, 38, 38, 0.3);
}

.btn-outlook {
    background-color: #0078d4;
    color: #ffffff;
}

.btn-outlook:hover {
    background-color: #005a9e;
}

.oauth-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.date-range-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

input[type="date"] {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid #8d8d8d;
    transition: border-color 0.2s;
}

input[type="date"]:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.15);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 1rem 1.25rem;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--accent-light);
    color: #002d9c;
    font-weight: 700;
    font-size: 0.95rem;
}

tr:nth-child(even) {
    background-color: #fcfcfc;
}

.download-link {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 700;
}

.download-link:hover {
    text-decoration: underline;
}

.btn-disconnect {
    background-color: #ffffff;
    color: #555555;
    border: 1px solid #d0d0d0;
    padding: 0.55rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-disconnect:hover {
    background-color: #fff0f1;
    border-color: #ffb3b8;
    color: #da1e28;
}

/* Full Screen Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-container {
    background: #ffffff;
    width: 100%;
    max-width: 1050px;
    max-height: 92vh;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-close-btn {
    position: absolute;
    top: 1.25rem;
    left: 1.5rem;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close-btn:hover {
    background: rgba(218, 30, 40, 0.1);
    color: #da1e28;
}

.modal-header {
    padding: 2rem 2.5rem 1.25rem;
    background: linear-gradient(180deg, #edf5ff 0%, #ffffff 100%);
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.modal-logo {
    max-height: 44px;
    width: auto;
    margin-bottom: 0.75rem;
}

.modal-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: #002d9c;
    margin-bottom: 0.35rem;
}

.modal-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2.25rem 2.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-col {
    display: flex;
    flex-direction: column;
}

.col-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent-light);
}

.modal-form-col {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.modal-form-col input[type="text"],
.modal-form-col input[type="password"] {
    padding: 0.85rem 1rem;
    border: 1px solid #8d8d8d;
    border-radius: 8px;
    font-size: 1rem;
    width: 100%;
}

.btn-primary-full {
    width: 100%;
    background: var(--primary-blue);
    color: #ffffff;
    border: none;
    padding: 0.95rem;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1rem;
    box-shadow: 0 4px 12px rgba(15, 98, 254, 0.25);
}

.btn-primary-full:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 16px rgba(15, 98, 254, 0.35);
}

.alert-error {
    background-color: #fff0f1;
    border: 1px solid #ffb3b8;
    color: #da1e28;
    padding: 0.85rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

.modal-info-col {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.benefits-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.benefit-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: #ffffff;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.benefit-icon {
    font-size: 1.6rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 0.2rem;
}

.benefit-content h4 {
    font-size: 1rem;
    font-weight: 700;
    color: #0f62fe;
    margin-bottom: 0.25rem;
}

.benefit-content p {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.4;
}

@media (max-width: 850px) {
    header.top-header {
        flex-direction: column;
        text-align: center;
    }

    .header-right {
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-body {
        grid-template-columns: 1fr;
    }

    .modal-container {
        max-height: 96vh;
    }
}

/* Scanning Animation & Progress UI */
.scan-loading-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    background: linear-gradient(180deg, #edf5ff 0%, #ffffff 100%);
    border-radius: 16px;
}

.scan-spinner {
    width: 56px;
    height: 56px;
    border: 5px solid rgba(15, 98, 254, 0.15);
    border-top: 5px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin-bottom: 1.25rem;
}

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

.scan-loading-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #002d9c;
    margin-bottom: 0.4rem;
}

.scan-loading-sub {
    font-size: 0.92rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.scan-progress-bar {
    width: 100%;
    max-width: 380px;
    height: 8px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.scan-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0f62fe 0%, #0043ce 50%, #0f62fe 100%);
    background-size: 200% 100%;
    width: 100%;
    animation: progressShimmer 1.8s ease-in-out infinite;
    border-radius: 10px;
}

@keyframes progressShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

