/* Napad - Voice to Spec System
   Conservative Design with Custom Palette
   Colors: #5A9CB5 (primary), #FACE68 (accent), #FAAC68 (secondary), #FA6868 (danger)
*/

:root {
    --primary: #5A9CB5;
    --primary-dark: #4a8ca5;
    --accent: #FACE68;
    --secondary: #FAAC68;
    --danger: #FA6868;
    --text: #333;
    --text-light: #666;
    --bg: #f5f5f5;
    --bg-white: #fff;
    --border: #ddd;
    --border-dark: #ccc;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--primary);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    height: 48px;
}

.logo {
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: rgba(0,0,0,0.15);
    letter-spacing: 1px;
}

.logo:hover {
    text-decoration: none;
    background: rgba(0,0,0,0.25);
}

.nav {
    display: flex;
    align-items: stretch;
    margin-left: auto;
}

.nav a {
    display: flex;
    align-items: center;
    color: rgba(255,255,255,0.9);
    padding: 0 16px;
    font-size: 13px;
    border-left: 1px solid rgba(255,255,255,0.15);
}

.nav a:hover {
    color: #fff;
    background: rgba(0,0,0,0.1);
    text-decoration: none;
}

.nav .user-info {
    display: flex;
    align-items: center;
    color: rgba(255,255,255,0.7);
    padding: 0 16px;
    font-size: 12px;
    border-left: 1px solid rgba(255,255,255,0.15);
    gap: 8px;
}

.nav .user-info a {
    padding: 0;
    border: none;
    color: rgba(255,255,255,0.9);
    font-size: 12px;
}

/* Main content */
.main {
    padding: 20px 0;
    background: var(--bg);
    min-height: calc(100vh - 48px);
}

/* Cards */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    margin-bottom: 15px;
}

.card-header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
}

.card-body {
    padding: 15px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

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

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

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

.btn-accent {
    background: var(--accent);
    color: var(--text);
    border-color: var(--accent);
}

.btn-accent:hover {
    background: #e9bd58;
    border-color: #e9bd58;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #e95858;
    border-color: #e95858;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

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

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-dark);
    font-size: 14px;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

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

.form-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 5px;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--bg-white);
    border: 1px solid var(--border);
}

.table th,
.table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 0.3px;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: #f8f9fa;
}

.table .actions {
    white-space: nowrap;
}

/* Project list */
.project-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

a.project-item {
    display: block;
    background: var(--bg-white);
    border: 1px solid var(--border);
    padding: 15px;
    transition: border-color 0.15s, box-shadow 0.15s;
    text-decoration: none;
    color: var(--text);
}

a.project-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.project-item h3 {
    font-size: 15px;
    margin-bottom: 6px;
    color: var(--text);
}

.project-item .project-desc {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
    line-height: 1.4;
}

.project-item .meta {
    font-size: 11px;
    color: var(--text-light);
}

.project-item .level {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    text-transform: uppercase;
    background: var(--bg);
    border: 1px solid var(--border);
    margin-bottom: 8px;
}

.project-item .level-project {
    border-color: var(--primary);
    color: var(--primary);
}

.project-item .level-module {
    border-color: var(--secondary);
    color: var(--secondary);
}

.project-item .level-feature {
    border-color: var(--accent);
    color: #998540;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 15px;
    font-size: 12px;
    color: var(--text-light);
    padding: 8px 12px;
    background: var(--bg-white);
    border: 1px solid var(--border);
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.breadcrumb-item:not(:last-child)::after {
    content: "/";
    color: var(--border-dark);
    font-size: 11px;
}

.breadcrumb a {
    color: var(--text-light);
}

.breadcrumb a:hover {
    color: var(--primary);
}

/* Tags */
.tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    border: 1px solid;
    margin-right: 5px;
    margin-bottom: 5px;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* Recording table */
.recording-table {
    font-size: 13px;
    border: none;
    margin: -15px;
    width: calc(100% + 30px);
}

.recording-table th {
    font-size: 11px;
    white-space: nowrap;
}

.recording-table td {
    vertical-align: middle;
}

.recording-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.recording-name {
    font-weight: 500;
    margin-bottom: 2px;
    word-break: break-all;
}

.recording-summary-cell {
    font-size: 11px;
    color: var(--text-light);
    line-height: 1.3;
}

.recording-row:hover .recording-summary-cell {
    white-space: normal;
}

.recording-status {
    display: inline-block;
    font-size: 10px;
    padding: 2px 6px;
    text-transform: uppercase;
    font-weight: 600;
}

.recording-status.ready {
    background: #d4edda;
    color: #155724;
}

.recording-status.transcribing,
.recording-status.summarizing {
    background: #fff3cd;
    color: #856404;
}

.recording-status.queued {
    background: #e2e3e5;
    color: #383d41;
}

.recording-status.error {
    background: #f8d7da;
    color: #721c24;
}

.table .actions {
    white-space: nowrap;
}

.table .actions .btn {
    padding: 3px 8px;
    font-size: 11px;
}

/* Recorder Bar */
.recorder-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg);
    border: 1px solid var(--border);
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.recorder-bar.recording {
    background: #fff5f5;
    border-color: var(--danger);
}

.recorder-time {
    font-family: monospace;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    min-width: 50px;
}

.recorder-bar.recording .recorder-time {
    color: var(--danger);
}

.recorder-status {
    font-size: 12px;
    color: var(--text-light);
}

.recorder-sep {
    color: var(--border-dark);
}

.btn-record {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 600;
}

.btn-record:hover {
    background: #e95858;
}

.btn-record.recording {
    background: var(--text);
    border-color: var(--text);
}

.upload-progress {
    display: none;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.upload-progress.visible {
    display: flex;
}

.upload-bar-wrap {
    width: 120px;
    height: 6px;
    background: var(--border);
}

.upload-bar {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width 0.3s;
}

#upload-status {
    font-size: 12px;
    color: var(--text-light);
}

/* Output view */
.output-content {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 20px;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.output-meta {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text-light);
}

/* Alerts */
.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border: 1px solid;
}

.alert-success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.alert-info {
    background: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

/* Login page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

.login-box {
    background: var(--bg-white);
    border: 1px solid var(--border);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    font-size: 24px;
    margin-bottom: 30px;
    color: var(--primary);
    text-align: center;
}

/* Tabs */
.tabs {
    display: flex;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-bottom: none;
    margin-bottom: 0;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    color: var(--text-light);
    font-size: 13px;
    border-right: 1px solid var(--border);
    background: var(--bg);
}

.tab:hover {
    color: var(--text);
    background: var(--bg-white);
}

.tab.active {
    color: var(--primary);
    background: var(--bg-white);
    font-weight: 500;
}

.tab-content {
    display: none;
    background: var(--bg-white);
    border: 1px solid var(--border);
    padding: 15px;
}

.tab-content.active {
    display: block;
}

/* Grid layout for project page */
.project-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
}

.project-main {
    min-width: 0;
}

.project-sidebar {
    min-width: 0;
}

.project-sidebar .card {
    margin-bottom: 10px;
}

.project-sidebar .card-body {
    padding: 12px;
}

.project-sidebar .btn {
    font-size: 12px;
    padding: 6px 12px;
}

@media (max-width: 1000px) {
    .project-layout {
        grid-template-columns: 1fr;
    }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state p {
    margin-bottom: 20px;
}

/* Selection toolbar */
.selection-toolbar {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-white);
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 12px 20px;
    align-items: center;
    gap: 20px;
    z-index: 100;
}

.selection-toolbar.visible {
    display: flex;
}

.selection-info {
    font-weight: 500;
    font-size: 13px;
}

.selection-actions {
    display: flex;
    gap: 10px;
}

/* Inbox section */
.inbox-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.inbox-header {
    margin-bottom: 15px;
    font-size: 14px;
}

#inbox-selection-toolbar {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    margin-bottom: 15px;
    box-shadow: none;
    border: 1px solid var(--primary);
    background: #f0f7fa;
}

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

.modal-overlay.visible {
    display: flex;
}

.modal {
    background: var(--bg-white);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Utilities */
.mb-0 { margin-bottom: 0; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-light); }
.d-flex { display: flex; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.flex-grow { flex-grow: 1; }

/* Chat styles */
.chat-messages {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
    background: var(--bg);
    border: 1px solid var(--border);
    margin-bottom: 15px;
}

.chat-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.chat-placeholder p {
    margin: 5px 0;
}

.chat-message {
    margin-bottom: 15px;
    padding: 10px 15px;
    background: var(--bg-white);
    border: 1px solid var(--border);
}

.chat-message:last-child {
    margin-bottom: 0;
}

.chat-message-user {
    border-left: 3px solid var(--primary);
}

.chat-message-assistant {
    border-left: 3px solid var(--accent);
    background: #fffef5;
}

.chat-message-header {
    font-weight: 600;
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 5px;
    text-transform: uppercase;
}

.chat-message-content {
    line-height: 1.6;
}

.chat-typing .chat-message-content {
    color: var(--text-light);
    font-style: italic;
}

.chat-input-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-recorder {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
}

.chat-recorder .btn-record {
    padding: 6px 12px;
    font-size: 13px;
}

.chat-recorder .recorder-time {
    font-family: monospace;
    font-size: 13px;
    min-width: 45px;
}

.chat-recorder .recorder-status {
    color: var(--text-light);
    font-size: 13px;
}

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

.chat-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 44px;
}

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

.chat-input-wrapper .btn {
    align-self: flex-end;
    height: 44px;
}
