/* Custom styles for DataPort */

:root {
    --primary: #0066cc;
    --primary-hover: #0052a3;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

/* Fix modal footer background to match body instead of header */
dialog article footer {
    background-color: transparent !important;
}

/* Login page styling */
.login-card {
    max-width: 380px;
    margin: 10vh auto;
}

.login-card article {
    padding: 2.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

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

.login-card h1 {
    margin-bottom: 0.25rem;
    color: var(--primary);
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.login-card p {
    color: var(--pico-muted-color);
    margin: 0;
    font-size: 0.9rem;
}

.login-card label {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
}

.login-card label small {
    font-weight: 400;
    opacity: 0.8;
}

.login-card input {
    font-size: 0.95rem;
}

.login-card button[type="submit"] {
    margin-top: 1.25rem;
    font-size: 0.95rem;
    padding: 0.75rem;
    font-weight: 500;
}

.login-card footer {
    margin-top: 2rem;
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--pico-muted-border-color);
}

.login-card footer small {
    font-size: 0.85rem;
    line-height: 1.5;
}

.login-card footer small.block {
    margin-top: 0.5rem;
    color: var(--pico-muted-color);
}

/* Error messages */
.error-message {
    background-color: var(--pico-del-color);
    color: white;
    padding: 0.75rem;
    border-radius: var(--pico-border-radius);
    margin-top: 1rem;
}

.success-message {
    background-color: var(--success);
    color: white;
    padding: 0.75rem;
    border-radius: var(--pico-border-radius);
    margin-top: 1rem;
}

/* Danger button styling */
.btn-sm.danger,
button.danger {
    background-color: var(--danger);
    border-color: var(--danger);
    color: white;
}

.btn-sm.danger:hover,
button.danger:hover {
    background-color: #d73533;
    border-color: #d73533;
    color: white;
}

/* Auto-save indicator */
.auto-save-indicator {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--pico-background-color);
    border: 1px solid var(--pico-muted-border-color);
    padding: 0.5rem 1rem;
    border-radius: var(--pico-border-radius);
    box-shadow: var(--pico-box-shadow);
    display: none;
    align-items: center;
    gap: 0.5rem;
    z-index: 1000;
}

.auto-save-indicator.show {
    display: flex;
}

.auto-save-indicator.saving {
    border-color: var(--warning);
    color: var(--warning);
}

.auto-save-indicator.saved {
    border-color: var(--success);
    color: var(--success);
}

.auto-save-indicator.error {
    border-color: var(--danger);
    color: var(--danger);
}

/* Spinner animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Dashboard styles */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-header h1 {
    margin: 0;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Data table styles for desktop productivity */
.data-table-container {
    overflow-x: auto;
    margin: 1rem 0;
}

.data-table {
    width: 100%;
    font-size: 0.875rem;
}

.data-table th {
    position: sticky;
    top: 0;
    background: var(--pico-background-color);
    z-index: 10;
}

/* Dense table mode for desktop */
@media (min-width: 768px) {
    .data-table.dense td,
    .data-table.dense th {
        padding: 0.5rem;
    }
    
    .data-table input[type="text"],
    .data-table input[type="email"],
    .data-table input[type="tel"] {
        padding: 0.25rem 0.5rem;
        margin: 0;
    }
    
    /* Vertical lines between data field columns in master data table - desktop only */
    /* Header always gets lines */
    #masterDataGrid .data-table.dense th:not(:first-child):not(:last-child) {
        border-left: 1px solid rgba(255, 255, 255, 0.08);
    }
    
    /* Data cells only get lines if row has content (has-data class) */
    #masterDataGrid .data-table.dense tr.has-data td:not(:first-child):not(:last-child) {
        border-left: 1px solid rgba(255, 255, 255, 0.08);
    }
    
    /* Also add right border to separate actions column if present */
    #masterDataGrid .data-table.dense th:nth-last-child(2),
    #masterDataGrid .data-table.dense tr.has-data td:nth-last-child(2) {
        border-right: 1px solid rgba(255, 255, 255, 0.08);
    }
}

/* Edit mode indicator */
.edit-mode-active {
    border: 2px solid var(--danger);
    position: relative;
}

.edit-mode-badge {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: var(--danger);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--pico-border-radius);
    z-index: 100001;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}


/* Modal error messages */
.modal-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 0.75rem;
    border-radius: var(--pico-border-radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.modal-success {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
    padding: 0.75rem;
    border-radius: var(--pico-border-radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Mobile responsive adjustments */
@media (max-width: 767px) {
    .login-card {
        margin: 2rem auto;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .button-group button {
        width: 100%;
    }
    
    /* Stack form fields on mobile */
    .data-point-config {
        grid-template-columns: 1fr;
    }
    
    /* Make tables scrollable with indicator */
    .data-table-container {
        position: relative;
    }
    
    .data-table-container::after {
        content: '→';
        position: absolute;
        right: 0.5rem;
        top: 50%;
        transform: translateY(-50%);
        font-size: 1.5rem;
        color: var(--pico-muted-color);
        pointer-events: none;
        opacity: 0.5;
    }
}

/* Utility classes */
.text-center { text-align: center; }
.text-muted { color: var(--pico-muted-color); }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.block { display: block; }
.hidden { display: none; }

/* Modal adjustments for mobile */
@media (max-width: 767px) {
    dialog {
        width: 100%;
        max-width: 100%;
        margin: 0;
        max-height: 100vh;
        border-radius: 0;
    }
}

/* Participant row actions */
.row-actions {
    display: flex;
    gap: 0.25rem;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.btn-icon {
    padding: 0.25rem;
    line-height: 1;
    min-width: auto;
}