/* ========== BASE RESET ========== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    line-height: 1.5;
    color: #333;
}

/* ========== LAYOUT ========== */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    margin-bottom: 10px;
    font-size: 28px;
}

h2 {
    font-size: 18px;
    margin: 0 0 15px;
}

h3 {
    font-size: 14px;
    margin: 15px 0 8px;
    color: #666;
}

h4 {
    font-size: 14px;
    margin: 15px 0 10px;
}

.no-margin {
    margin: 0 !important;
}

/* ========== CARD ========== */
.card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ========== FORM ELEMENTS ========== */
input,
textarea,
select {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #000;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
}

.input-row {
    display: flex;
    gap: 10px;
}

.input-row .form-group {
    flex: 1;
}

.input-row input {
    margin-bottom: 0;
}

/* ========== BUTTONS ========== */
button {
    background: #000;
    color: #fff;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s, transform 0.1s;
}

button:hover {
    background: #333;
}

button:active {
    transform: scale(0.98);
}

button:disabled {
    background: #999;
    cursor: not-allowed;
}

button.secondary {
    background: #666;
}

button.secondary:hover {
    background: #555;
}

button.danger {
    background: #dc3545;
}

button.danger:hover {
    background: #c82333;
}

button.success {
    background: #28a745;
}

button.small {
    padding: 6px 12px;
    font-size: 12px;
}

.button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.auth-buttons {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.auth-buttons button {
    flex: 1;
    min-width: 80px;
}

/* ========== TABS ========== */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.tabs button {
    background: #e0e0e0;
    color: #333;
    flex: 1;
    min-width: 100px;
}

.tabs button.active {
    background: #000;
    color: #fff;
}

.main-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 5px;
    -webkit-overflow-scrolling: touch;
}

.main-tabs button {
    background: #e0e0e0;
    color: #333;
    padding: 10px 16px;
    white-space: nowrap;
    flex-shrink: 0;
}

.main-tabs button.active {
    background: #000;
    color: #fff;
}

.tab-content {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========== CHIPS ========== */
.chip {
    display: inline-block;
    padding: 8px 14px;
    background: #e0e0e0;
    border-radius: 20px;
    font-size: 13px;
    margin: 3px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.chip:hover {
    background: #d0d0d0;
}

.chip.selected {
    background: #000;
    color: #fff;
}

/* ========== TAGS ========== */
.tag {
    display: inline-block;
    padding: 4px 10px;
    background: #e0e0e0;
    border-radius: 4px;
    font-size: 12px;
    margin: 2px;
}

.tag.skill {
    background: #d4edda;
    color: #155724;
}

.tag.doc-type {
    background: #cce5ff;
    color: #004085;
}

/* ========== STATUS BADGES ========== */
.status {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status.pending,
.status.queued {
    background: #fff3cd;
    color: #856404;
}

.status.processing {
    background: #cce5ff;
    color: #004085;
}

.status.shortlisted,
.status.success {
    background: #d4edda;
    color: #155724;
}

.status.rejected,
.status.failed {
    background: #f8d7da;
    color: #721c24;
}

/* ========== SCORE ========== */
.score {
    font-weight: bold;
    font-size: 18px;
}

.score.high {
    color: #28a745;
}

.score.mid {
    color: #ffc107;
}

.score.low {
    color: #dc3545;
}

/* ========== TOGGLE SWITCH ========== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #28a745;
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* ========== STATS GRID ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 15px 0;
}

.stat-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    text-align: center;
}

.stat-card .value {
    font-size: 24px;
    font-weight: bold;
}

.stat-card .label {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.stat-card.success .value {
    color: #28a745;
}

.stat-card.failed .value {
    color: #dc3545;
}

/* ========== FLEX UTILITIES ========== */
.flex {
    display: flex;
    gap: 10px;
    align-items: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.flex-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ========== UPLOAD AREA ========== */
.upload-area {
    border: 2px dashed #ddd;
    padding: 30px;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: #000;
    background: #fafafa;
}

.upload-area.dragover {
    border-color: #000;
    background: #f0f0f0;
}

.upload-area p {
    margin: 0;
}

/* ========== FILE INFO ========== */
.file-info {
    background: #d4edda;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 10px;
}

/* ========== INFO ROWS ========== */
.info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: #666;
}

.info-value {
    font-weight: 500;
    text-align: right;
}

/* ========== PROFILE ELEMENTS ========== */
.profile-link {
    background: #f0f0f0;
    padding: 12px;
    border-radius: 6px;
    word-break: break-all;
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.user-handle {
    color: #666;
    margin-left: 8px;
}

.headline {
    background: #f0f0f0;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-style: italic;
}

/* ========== ROLE CARDS ========== */
.role-card {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    border-left: 3px solid #000;
}

.role-card h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
}

.role-card .company {
    color: #666;
    font-size: 13px;
}

.role-card .duration {
    font-size: 12px;
    color: #999;
}

.role-card .highlights {
    margin-top: 8px;
    font-size: 12px;
    padding-left: 16px;
}

.role-card .highlights li {
    margin-bottom: 3px;
}

/* ========== CERT/PROJECT/PUB CARDS ========== */
.cert-card,
.project-card,
.pub-card {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.cert-card h4,
.project-card h4,
.pub-card h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
}

.cert-card .issuer,
.project-card .desc,
.pub-card .venue {
    color: #666;
    font-size: 13px;
}

.cert-card .date,
.project-card .tech,
.pub-card .type {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

/* ========== LANGUAGE TAGS ========== */
.lang-tag {
    display: inline-block;
    padding: 6px 12px;
    background: #e8f4fd;
    border-radius: 4px;
    margin: 3px;
    font-size: 13px;
}

.lang-tag .proficiency {
    color: #666;
    font-size: 11px;
    margin-left: 5px;
}

/* ========== STRENGTH TAGS ========== */
.strength-tag {
    display: inline-block;
    padding: 4px 8px;
    background: #fff3cd;
    border-radius: 4px;
    font-size: 12px;
    margin: 2px;
}

/* ========== APPLICATION ITEMS ========== */
.app-item,
.doc-item,
.auto-app-item {
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 6px;
    margin-bottom: 10px;
    transition: box-shadow 0.2s;
}

.app-item:hover,
.doc-item:hover,
.auto-app-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.auto-app-item .job-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.auto-app-item .company {
    color: #666;
    font-size: 14px;
}

.auto-app-item .meta {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
}

.auto-app-item .error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
}

/* ========== RESULT CONTENT ========== */
.result-content {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    white-space: pre-wrap;
    line-height: 1.6;
    margin-bottom: 10px;
}

/* ========== RESPONSE LOG ========== */
/* #response {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    white-space: pre-wrap;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 12px;
    max-height: 200px;
    overflow: auto;
} */

/* ========== DIVIDERS ========== */
.section-divider {
    border-top: 1px solid #eee;
    margin: 20px 0;
}

/* ========== SUCCESS MESSAGE ========== */
.success-message {
    margin-top: 10px;
    padding: 12px;
    background: #d4edda;
    border-radius: 6px;
    color: #155724;
}

/* ========== UTILITIES ========== */
.hidden {
    display: none !important;
}

.hint {
    color: #666;
    font-size: 13px;
    margin: 8px 0;
}

/* ========== DETAILS/SUMMARY ========== */
details {
    margin-top: 8px;
    font-size: 12px;
}

details summary {
    cursor: pointer;
    color: #666;
    padding: 4px 0;
}

details pre {
    background: #f8f9fa;
    padding: 10px;
    margin-top: 5px;
    border-radius: 4px;
    overflow: auto;
    white-space: pre-wrap;
}

/* ========== LINKS ========== */
a {
    color: #007bff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 600px) {
    .container {
        padding: 12px;
    }

    h1 {
        font-size: 24px;
    }

    .card {
        padding: 16px;
        margin-bottom: 16px;
    }

    input,
    textarea,
    select {
        padding: 14px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    button {
        padding: 14px 18px;
        width: 100%;
    }

    .button-row {
        flex-direction: column;
    }

    .button-row button {
        width: 100%;
    }

    .auth-buttons {
        flex-direction: column;
    }

    .auth-buttons button {
        width: 100%;
    }

    .input-row {
        flex-direction: column;
        gap: 0;
    }

    .input-row .form-group {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 12px 8px;
    }

    .stat-card .value {
        font-size: 20px;
    }

    .main-tabs {
        gap: 4px;
        margin-bottom: 16px;
    }

    .main-tabs button {
        padding: 10px 12px;
        font-size: 13px;
    }

    .tabs button {
        padding: 10px 12px;
        font-size: 13px;
    }

    .flex-between {
        flex-wrap: wrap;
    }

    .profile-link {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-link button {
        width: auto;
        margin-top: 8px;
    }

    .info-row {
        flex-direction: column;
        gap: 4px;
    }

    .info-value {
        text-align: left;
    }

    .upload-area {
        padding: 20px;
    }

    .chip {
        padding: 10px 14px;
        font-size: 14px;
    }

    .form-group.flex-between {
        flex-direction: row;
        flex-wrap: nowrap;
    }

    .form-group.flex-between label {
        flex: 1;
        margin-bottom: 0;
    }
}

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

    .main-tabs button {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* ========== MODAL ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: #fff;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: auto;
    color: #666;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-body pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    font-family: inherit;
    line-height: 1.6;
}

.modal-body.error {
    color: #dc3545;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-footer button {
    width: auto;
}