/* Checklist App – Simple, light, white & dark blue */

:root {
    --blue-dark: #0d2137;
    --blue-mid: #1a3a5c;
    --blue-soft: #2c5282;
    --blue-light: #e8f0f8;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-500: #64748b;
    --gray-700: #334155;
    --red: #b91c1c;
    --shadow: 0 1px 3px rgba(13, 33, 55, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(13, 33, 55, 0.08), 0 2px 4px -2px rgba(13, 33, 55, 0.06);
    --radius: 8px;
    --font: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--gray-700);
    background: var(--gray-50);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* Header */
.site-header {
    background: var(--blue-dark);
    color: var(--white);
    padding: 1.5rem 0;
    box-shadow: var(--shadow-md);
}

.site-header h1 {
    margin: 0 0 0.25rem 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.site-header .subtitle {
    margin: 0;
    opacity: 0.9;
    font-size: 0.95rem;
}

.site-header .link-admin {
    display: inline-block;
    margin-top: 0.75rem;
    color: var(--blue-light);
    text-decoration: none;
    font-size: 0.9rem;
}

.site-header .link-admin:hover {
    text-decoration: underline;
}

.site-header .domain-user {
    margin: 0.5rem 0 0 0;
    font-size: 0.85rem;
    opacity: 0.9;
    font-family: ui-monospace, monospace;
}

.admin-header .header-actions {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.admin-header .btn-ghost {
    color: var(--blue-light);
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.admin-header .btn-ghost:hover {
    background: rgba(255,255,255,0.1);
}

/* Main */
.main-content {
    flex: 1;
    padding: 1.5rem 0 2rem;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--gray-200);
}

.card h2 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--blue-dark);
}

.empty-state {
    text-align: center;
    color: var(--gray-500);
}

/* Submission list (public) */
.submission-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.submission-item {
    margin-bottom: 1rem;
}

.submission-item:last-child {
    margin-bottom: 0;
}

.submission-meta {
    margin-bottom: 0.35rem;
}

.submission-meta time {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.submission-title {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--blue-dark);
}

.submission-by {
    margin: 0 0 0.25rem 0;
    font-size: 0.85rem;
    color: var(--gray-500);
    font-family: ui-monospace, monospace;
}

.submission-note {
    margin: 0;
    font-size: 0.95rem;
    color: var(--gray-700);
}

/* Login */
.page-login {
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-wrap {
    width: 100%;
    max-width: 360px;
}

.login-card {
    text-align: center;
}

.login-card h1 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    color: var(--blue-dark);
}

.login-desc {
    margin: 0 0 1.25rem 0;
    color: var(--gray-500);
    font-size: 0.95rem;
}

.form-login label {
    display: block;
    text-align: left;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: var(--gray-700);
}

.form-login input[type="password"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.form-login input:focus {
    outline: none;
    border-color: var(--blue-soft);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.15);
}

.form-login .btn {
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 1rem;
}

/* Forms */
.form-add label,
.form-section label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: var(--gray-700);
}

.form-add input[type="text"],
.form-add textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.form-add textarea {
    resize: vertical;
    min-height: 60px;
}

.form-add input:focus,
.form-add textarea:focus {
    outline: none;
    border-color: var(--blue-soft);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.15);
}

.form-add .btn {
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, color 0.15s;
}

.btn-primary {
    background: var(--blue-dark);
    color: var(--white);
}

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

.btn-danger {
    background: var(--red);
    color: var(--white);
}

.btn-danger:hover {
    filter: brightness(1.1);
}

.btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
}

/* Messages */
.message.error {
    background: #fef2f2;
    color: var(--red);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Dashboard stats */
.dashboard-stats .stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--blue-dark);
    margin: 0 0 0.15rem 0;
}

.dashboard-stats .stat-label {
    margin: 0;
    font-size: 0.9rem;
    color: var(--gray-500);
}

/* Admin list */
.admin-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-list-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.admin-list-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.admin-list-item:first-child {
    padding-top: 0;
}

.admin-item-main {
    flex: 1;
    min-width: 0;
}

.admin-item-main strong {
    display: block;
    color: var(--blue-dark);
}

.admin-item-by {
    display: block;
    font-size: 0.8rem;
    color: var(--blue-soft);
    font-family: ui-monospace, monospace;
    margin-top: 0.15rem;
}

.admin-item-note {
    display: block;
    font-size: 0.9rem;
    color: var(--gray-500);
    margin-top: 0.2rem;
}

.admin-item-time {
    display: block;
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.form-delete-inline {
    flex-shrink: 0;
}

.empty-inline {
    margin: 0;
    color: var(--gray-500);
}

.section-desc {
    margin: -0.5rem 0 1rem 0;
    font-size: 0.9rem;
    color: var(--gray-500);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* Build checklist (admin) */
.form-inline {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.form-inline input[type="text"] {
    flex: 1;
    min-width: 12rem;
    margin-bottom: 0;
}

.checklist-items-admin {
    list-style: none;
    padding: 0;
    margin: 0;
}

.checklist-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-100);
}

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

.checklist-item-row .item-title {
    flex: 1;
    min-width: 0;
}

/* Fills list (admin) */
.fills-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.fill-card {
    margin-bottom: 1rem;
}

.fill-card:last-child {
    margin-bottom: 0;
}

.fill-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.fill-meta {
    font-size: 0.9rem;
    color: var(--gray-500);
}

.fill-meta time {
    margin-right: 0.5rem;
}

.fill-by {
    font-family: ui-monospace, monospace;
    color: var(--blue-soft);
}

.fill-comment {
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
    color: var(--gray-700);
}

.fill-responses,
.fill-responses-inline {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
    font-size: 0.9rem;
}

.fill-responses li,
.fill-responses-inline li {
    padding: 0.2rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.fill-responses li:last-child,
.fill-responses-inline li:last-child {
    border-bottom: none;
}

.response-value {
    margin-left: 0.35rem;
    color: var(--gray-700);
}

/* Public fill form */
.fill-form-card {
    margin-bottom: 1.5rem;
}

.form-fill label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-fill > label {
    margin-bottom: 0.35rem;
}

.form-fill textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    margin-bottom: 1rem;
    resize: vertical;
    min-height: 60px;
}

.form-fill textarea:focus {
    outline: none;
    border-color: var(--blue-soft);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.15);
}

.fill-items {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
}

.fill-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.fill-item:first-child {
    padding-top: 0;
}

.fill-item label {
    display: block;
}

.item-label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    color: var(--blue-dark);
}

.item-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1rem;
}

.item-input:focus {
    outline: none;
    border-color: var(--blue-soft);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.15);
}

.form-fill .btn {
    margin-top: 0.25rem;
}

.message.success {
    background: #ecfdf5;
    color: #065f46;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.message.success p {
    margin: 0;
}

.last-submissions h2 {
    margin-bottom: 0.75rem;
}

.fill-summary.submission-item {
    padding: 0;
}

.fill-summary .submission-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.fill-summary .fill-responses-inline {
    margin-top: 0.5rem;
    padding-left: 0;
}

/* Footer */
.site-footer {
    background: var(--gray-100);
    color: var(--gray-500);
    font-size: 0.85rem;
    padding: 1rem 0;
    margin-top: auto;
}

.site-footer .container {
    text-align: center;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--white);
    color: var(--gray-700);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    min-width: 250px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    border-left: 4px solid var(--blue-soft);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    border-left-color: #10b981;
}

.toast-error {
    border-left-color: var(--red);
}

.toast-info {
    border-left-color: var(--blue-soft);
}

/* Dropdown Search */
.dropdown-wrapper {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 0.25rem;
}

.dropdown-option {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
}

.dropdown-option:hover {
    background: var(--blue-light);
}

.dropdown-option[style*="display: none"] {
    display: none !important;
}

/* Auth Modal */
.auth-modal {
    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: 10000;
    padding: 1rem;
}

.auth-card {
    max-width: 400px;
    width: 100%;
}

.form-auth label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.form-auth input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

/* BI Dashboard */
.bi-dashboard {
    margin-bottom: 2rem;
}

.bi-dashboard h2 {
    margin-bottom: 1.5rem;
    color: var(--blue-dark);
    font-size: 1.5rem;
}

.bi-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.bi-stat-card {
    background: var(--white);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    text-align: center;
}

.bi-stat-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: var(--gray-500);
    font-weight: 500;
}

.bi-stat-card .stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--blue-dark);
    margin: 0;
}

.bi-logs {
    margin-top: 1rem;
}

.bi-logs h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    color: var(--blue-dark);
}

.logs-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 400px;
    overflow-y: auto;
}

.logs-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.log-time {
    color: var(--gray-500);
    font-family: ui-monospace, monospace;
}

.log-action {
    font-weight: 500;
    color: var(--blue-soft);
}

.log-user {
    color: var(--gray-700);
}

.log-details {
    color: var(--gray-500);
    font-style: italic;
}

/* Checklist Item Cards (Admin) */
.checklist-item-card {
    margin-bottom: 1rem;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.item-title {
    display: block;
    margin-bottom: 0.25rem;
}

.item-type-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: var(--blue-light);
    color: var(--blue-dark);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.item-options {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.item-options h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    color: var(--gray-700);
}

.options-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0 0;
}

.options-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.options-list li:last-child {
    border-bottom: none;
}

/* Setup Page */
.page-setup {
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.setup-wrap {
    width: 100%;
    max-width: 500px;
}

.setup-card {
    text-align: center;
}

.setup-card h1 {
    margin: 0 0 0.5rem 0;
    color: var(--blue-dark);
}

.setup-desc {
    margin: 0 0 1.5rem 0;
    color: var(--gray-500);
}

.domain-link {
    background: var(--gray-100);
    padding: 0.75rem;
    border-radius: var(--radius);
    margin: 1rem 0;
    word-break: break-all;
}

.domain-link code {
    font-family: ui-monospace, monospace;
    color: var(--blue-dark);
}

.form-setup label {
    display: block;
    text-align: left;
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.form-setup input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin: -0.5rem 0 1rem 0;
    text-align: left;
}

/* PWA Install Button */
.btn-install {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-install:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* LabOS Style Enhancements */
.site-header {
    background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 100%);
}

.card {
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(13, 33, 55, 0.12);
}

.btn {
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(13, 33, 55, 0.15);
}

/* Select dropdown */
select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    margin-bottom: 1rem;
    background: var(--white);
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: var(--blue-soft);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.15);
}

/* Responsive */
@media (max-width: 768px) {
    .bi-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .container {
        max-width: 100%;
        padding: 0 1rem;
    }
    
    #toast-container {
        left: 1rem;
        right: 1rem;
        top: auto;
        bottom: 1rem;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
    }
}
