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

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #6b7280;
    --success: #10b981;
    --danger: #ef4444;
    --bg: #f9fafb;
    --bg-card: #ffffff;
    --text: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Navigation */
.nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text);
    background: var(--bg);
}

.nav-link.active {
    color: var(--primary);
    background: #eef2ff;
}

.nav-user {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

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

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

.btn-secondary:hover {
    background: var(--border);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
}

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

.btn-icon.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

input[type="text"],
input[type="password"],
input[type="date"] {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Login page */
.login-container {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.login-container h1 {
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.login-form {
    text-align: left;
}

.error-message {
    background: #fef2f2;
    color: var(--danger);
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

/* Report container */
.report-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Date navigation */
.date-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.date-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.date-input {
    width: auto;
    font-size: 1rem;
    padding: 0.5rem;
    cursor: pointer;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-primary {
    background: #eef2ff;
    color: var(--primary);
}

/* Report editor */
.report-editor {
    position: relative;
}

.report-textarea {
    width: 100%;
    min-height: 400px;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.75;
    resize: vertical;
    transition: border-color 0.2s;
}

.report-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.report-textarea.readonly {
    background: var(--bg);
    color: var(--text-muted);
    cursor: not-allowed;
}

.save-status {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.status-saving {
    color: var(--primary);
}

.status-saved {
    color: var(--success);
}

.status-error {
    color: var(--danger);
}

.readonly-notice {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Others page */
.others-container {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.users-sidebar {
    background: var(--bg);
    padding: 1.5rem;
    border-right: 1px solid var(--border);
}

.users-sidebar h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.user-list {
    list-style: none;
}

.user-link {
    display: block;
    padding: 0.5rem 0.75rem;
    margin: 0.25rem 0;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: all 0.2s;
}

.user-link:hover {
    background: var(--bg-card);
}

.user-link.active {
    background: var(--primary);
    color: white;
}

.no-users {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.report-view {
    padding: 1.5rem;
}

.viewing-user {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.report-content-view {
    margin-top: 1rem;
}

.report-text {
    white-space: pre-wrap;
    line-height: 1.75;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
    min-height: 200px;
}

.report-meta {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.no-report {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg);
    border-radius: var(--radius);
}

.select-user-prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--text-muted);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .nav {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .container {
        padding: 1rem;
    }

    .others-container {
        grid-template-columns: 1fr;
    }

    .users-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .user-list {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .user-link {
        margin: 0;
    }

    .date-nav {
        flex-wrap: wrap;
    }

    .report-textarea {
        min-height: 300px;
    }
}
