/* Task Checker Agent Platform - Dark Monochrome Theme */

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

:root {
    /* Sleek monochrome palette */
    --bg-primary: #0b0b0b;
    --bg-secondary: #111111;
    --bg-tertiary: #171717;
    --bg-elevated: #1f1f1f;

    --text-primary: #f5f5f5;
    --text-secondary: #d6d6d6;
    --text-muted: #9a9a9a;

    --border-subtle: #1f1f1f;
    --border-default: #2a2a2a;
    --border-strong: #3a3a3a;

    --accent-primary: #f5f5f5;
    --accent-hover: #ffffff;
    --accent-subtle: #1a1a1a;

    --success: #e6e6e6;
    --danger: #cfcfcf;
    --warning: #bdbdbd;

    --shadow-sm: 0 1px 6px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);

    --gradient-primary: radial-gradient(circle at 20% 20%, #141414 0%, #0b0b0b 55%);
    --gradient-accent: linear-gradient(135deg, #ffffff 0%, #cfcfcf 100%);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --space-1: 8px;
    --space-2: 12px;
    --space-3: 16px;
    --space-4: 24px;
    --space-5: 32px;
    --space-6: 40px;
}

body {
    font-family: 'Space Grotesk', 'Helvetica Neue', sans-serif;
    background: var(--gradient-primary);
    color: var(--text-primary);
    line-height: 1.6;
    letter-spacing: 0.2px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.section {
    min-height: 100vh;
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Loading Screen */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.spinner {
    border: 4px solid var(--border-default);
    border-top: 4px solid var(--accent-primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

/* Auth Section */
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: transparent;
    position: relative;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.05) 0%, transparent 55%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.03) 0%, transparent 60%);
    pointer-events: none;
}

.logo {
    text-align: center;
    margin-bottom: 32px;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

.logo h1 {
    font-size: 44px;
    font-weight: 600;
    margin-bottom: 6px;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 16px;
    color: var(--text-secondary);
}

.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: var(--shadow-md);
    text-align: center;
    max-width: 420px;
    width: 100%;
    position: relative;
    z-index: 1;
}

.auth-card h2 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.auth-card p {
    color: var(--text-secondary);
    margin-bottom: 28px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-default);
}

.auth-form {
    padding: 0;
    text-align: left;
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-note {
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 13px;
}

.auth-card .auth-note {
    margin: 12px 0 0;
}

.form-error {
    color: var(--danger);
    font-size: 13px;
    margin: 8px 0 12px;
}

.password-reset-dialog {
    max-width: 480px;
}

.features {
    margin-top: 32px;
    text-align: left;
}

.feature {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.feature-icon {
    color: var(--success);
    font-weight: bold;
    margin-right: 12px;
}

/* Header */
.header {
    background: linear-gradient(180deg, rgba(17, 17, 17, 0.98) 0%, rgba(11, 11, 11, 0.95) 100%);
    border-bottom: 1px solid var(--border-default);
    padding: 20px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
}

.header-left h1 {
    font-size: 20px;
    margin-bottom: 2px;
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.3px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.user-email {
    color: var(--text-secondary);
    font-size: 13px;
}

.user-role {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-strong);
}

.user-role.super-admin {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border: 1px solid var(--accent-primary);
}

.user-role.admin {
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

/* User Management */
.user-management-section {
    margin-bottom: 28px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border-default);
}

.user-management-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.section-header {
    margin-bottom: 16px;
}

.section-header h3 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#user-management-modal .modal-body {
    padding: 24px 28px 8px;
}

#user-management-modal form {
    padding: 0;
}

#user-management-modal .form-group {
    margin-bottom: 16px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.user-item:hover {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
}

.user-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-item-email {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 13px;
}

.user-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 11px;
}

.user-item-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-strong);
}

.user-item-badge.super-admin {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border: 1px solid var(--accent-primary);
}

.user-item-actions {
    display: flex;
    gap: 8px;
}

/* Buttons */
.btn {
    padding: 12px 20px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--accent-primary);
    color: var(--bg-primary);
    font-weight: 600;
}

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

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-default);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
}

.btn-danger {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
}

.btn-danger:hover {
    background: var(--bg-elevated);
}

.btn-large {
    padding: 14px 24px;
    font-size: 15px;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.btn.is-loading {
    cursor: wait;
    opacity: 0.85;
    pointer-events: none;
}

.btn.is-loading::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.8s linear infinite;
}

/* Dashboard */
.dashboard-actions {
    margin: 28px 0;
}

.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.agent-card {
    position: relative;
    background: linear-gradient(180deg, #151515 0%, #101010 100%);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
    transition: all 0.3s ease;
}

.agent-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.45);
}

.agent-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.08), transparent 40%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.agent-card-header {
    margin-bottom: 16px;
}

.agent-card-header h3 {
    font-size: 18px;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-weight: 600;
}

.agent-card-header p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.agent-card-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.agent-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.agent-card-actions .btn {
    flex: 1;
    justify-content: center;
    font-size: 13px;
    padding: 10px 14px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    margin-bottom: 12px;
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s;
}

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

.modal-content {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-default);
    margin: 4% auto;
    padding: 0;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-large {
    max-width: 900px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-default);
}

.modal-header h2 {
    font-size: 24px;
    color: var(--text-primary);
    font-weight: 600;
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    transition: color 0.2s;
}

.close:hover {
    color: var(--text-primary);
}

/* OneDrive Setup Modal */
.onedrive-setup {
    padding: 24px 28px;
}

.onedrive-setup p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.6;
}

.onedrive-setup p:last-of-type {
    margin-bottom: 24px;
}

.onedrive-setup .btn {
    width: 100%;
}

/* Forms */
form {
    padding: 24px 28px;
}

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

label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.field-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: -4px;
    margin-bottom: 8px;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-default);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    background-color: var(--bg-elevated);
}

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

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Results */
.results-content {
    padding: 24px;
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 16px;
}

.status-pass {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
}

.status-fail {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border: 1px solid var(--border-strong);
}

.status-error {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-strong);
}

.results-summary {
    margin-bottom: 24px;
}

.results-summary h3 {
    margin-bottom: 12px;
    color: var(--text-primary);
}

.report-text {
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    border-radius: 10px;
    padding: 18px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
    color: var(--text-secondary);
    line-height: 1.6;
}

.loading {
    text-align: center;
    padding: 40px;
}

.loading p {
    color: var(--text-muted);
    margin-top: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 12px;
    }

    .agents-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mt-2 {
    margin-top: 16px;
}

.mb-2 {
    margin-bottom: 16px;
}

/* Custom Alert/Confirm Dialog Styles */
.custom-dialog {
    max-width: 500px;
    margin: 15% auto;
    padding: 0;
}

.custom-dialog .modal-header {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-radius: 12px 12px 0 0;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-default);
}

.custom-dialog .modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.custom-dialog .modal-body {
    padding: 32px 24px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.custom-dialog .modal-body p {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.custom-dialog .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-default);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-tertiary);
    border-radius: 0 0 12px 12px;
}

.custom-alert-modal .modal-footer {
    justify-content: center;
}

.custom-alert-modal .btn-primary {
    min-width: 120px;
}

.custom-confirm-modal .modal-footer .btn {
    min-width: 100px;
}

/* Prevent body scroll when custom dialog is open */
body.modal-open {
    overflow: hidden;
}

/* Folder Selector */
.folder-selector-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.folder-selector-wrapper select {
    flex: 1;
}

.btn-small {
    padding: 8px 12px;
    font-size: 14px;
    min-width: auto;
}

.folder-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 14px;
}

.small-spinner {
    border: 2px solid var(--border-default);
    border-top: 2px solid var(--accent-primary);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
}

select {
    cursor: pointer;
}

select option {
    padding: 8px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* Reference Files Upload UI */
.reference-files-upload {
    border: 1px dashed var(--border-default);
    border-radius: 8px;
    padding: 20px;
    margin-top: 12px;
    background-color: var(--bg-primary);
}

.file-type-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.file-type-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.file-type-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
    font-size: 14px;
}

.field-hint-small {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
}

.file-type-section input[type="file"] {
    font-size: 14px;
    padding: 8px;
    border: 1px solid var(--border-default);
    border-radius: 6px;
    background-color: var(--bg-tertiary);
    cursor: pointer;
    width: 100%;
    color: var(--text-secondary);
}

.file-type-section input[type="file"]::-webkit-file-upload-button {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.file-type-section input[type="file"]::-webkit-file-upload-button:hover {
    background: var(--accent-hover);
}

.uploaded-files-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.uploaded-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.uploaded-file-item:hover {
    background: var(--accent-subtle);
    border-color: var(--border-strong);
}

.uploaded-file-item span:first-child {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 12px;
}

.uploaded-file-item span:nth-child(2) {
    color: var(--text-muted);
    font-size: 13px;
    margin-right: 12px;
    flex-shrink: 0;
}

.btn-delete {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    color: var(--text-muted);
}

.btn-delete:hover {
    color: var(--danger);
    transform: scale(1.1);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 6px;
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Selection */
::selection {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}
