/* Base */
* { box-sizing: border-box; }
body { font-family: system-ui, -apple-system, sans-serif; margin: 0; line-height: 1.5; color: #1a1a1a; background: #f5f5f5; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 768px) { .container { padding: 0 1.5rem; } }
@media (min-width: 1024px) { .container { padding: 0 2rem; } }

/* Header */
.header { background: #2c3e50; color: #fff; padding: 0.75rem 0; }
.header .container { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
.logo { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.25rem; color: #fff; text-decoration: none; }
.logo:hover { color: #fff; }
.logo-img { display: block; flex-shrink: 0; }
.nav { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; font-size: 0.95rem; }
@media (max-width: 767px) { .nav { gap: 0.5rem; } .nav .user { display: none; } }
.nav a { color: #ecf0f1; text-decoration: none; }
.nav a:hover { text-decoration: underline; }
.nav .user { font-size: 0.9rem; opacity: 0.9; }
.btn { display: inline-block; padding: 0.5rem 1rem; background: #3498db; color: #fff; text-decoration: none; border-radius: 4px; }
.btn:hover { background: #2980b9; }

/* Main */
.main { padding: 1.5rem 0; min-height: 60vh; }

/* Footer */
.footer { background: #34495e; color: #bdc3c7; padding: 1rem 0; margin-top: 2rem; text-align: center; font-size: 0.9rem; }

/* Filters */
.filters { background: #fff; padding: 1rem; border-radius: 8px; margin-bottom: 1.5rem; display: grid; grid-template-columns: 1fr; gap: 0.75rem; align-items: end; }
@media (min-width: 480px) { .filters { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 768px) { .filters { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }
.filter-row { display: flex; flex-direction: column; gap: 0.25rem; }
.filter-row label { font-size: 0.85rem; color: #555; }
.filter-row input, .filter-row select { padding: 0.4rem 0.5rem; border: 1px solid #ddd; border-radius: 4px; }
.filters button { padding: 0.5rem 1rem; background: #3498db; color: #fff; border: none; border-radius: 4px; cursor: pointer; }

/* Project list */
.project-list { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 768px) { .project-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .project-list { grid-template-columns: repeat(3, 1fr); } }
.project-card { background: #fff; padding: 1rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.project-card h2 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.project-card h2 a { color: #2c3e50; text-decoration: none; }
.project-card h2 a:hover { text-decoration: underline; }
.project-card .meta { font-size: 0.85rem; color: #7f8c8d; margin: 0 0 0.25rem; }
.project-card .budget { font-weight: 600; margin: 0 0 0.5rem; }
.project-card .description { font-size: 0.9rem; color: #555; margin: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

/* Pagination */
.pagination { margin-top: 1.5rem; display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; }
.pagination a { color: #3498db; text-decoration: none; }
.pagination a:hover { text-decoration: underline; }

/* Forms (auth, etc.) */
.form-page { max-width: 400px; margin: 0 auto; background: #fff; padding: 1rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
@media (min-width: 768px) { .form-page { padding: 1.5rem; } }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.25rem; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 0.5rem; border: 1px solid #ddd; border-radius: 4px; }
.project-detail { background: #fff; padding: 1.5rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.project-detail .description { white-space: pre-wrap; margin-top: 1rem; }
.responses { list-style: none; padding: 0; }
.responses li { padding: 0.5rem 0; border-bottom: 1px solid #eee; }
.responses form { margin-left: 0.5rem; }
.responses input[type="number"] { width: 100px; margin: 0 0.5rem; }

/* Chat */
.chat-list { display: flex; flex-direction: column; gap: 0.5rem; }
.chat-item { display: block; padding: 1rem; background: #fff; border-radius: 8px; text-decoration: none; color: inherit; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.chat-item:hover { background: #f8f9fa; }
.chat-item .preview { display: block; font-size: 0.9rem; color: #666; margin-top: 0.25rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .date { font-size: 0.8rem; color: #999; }
.chat-item .meta { display: block; font-size: 0.85rem; color: #666; }
.chat-panel { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); overflow: hidden; display: flex; flex-direction: column; max-height: 65vh; }
@media (min-width: 768px) { .chat-panel { max-height: 70vh; } }
.chat-panel .messages { flex: 1; overflow-y: auto; padding: 1rem; min-height: 200px; }
.chat-panel .message { padding: 0.5rem 0; border-bottom: 1px solid #eee; }
.chat-panel .message.own { background: #f0f8ff; margin: 0 -1rem; padding: 0.5rem 1rem; }
.chat-panel .message.delivery { border-left: 3px solid #27ae60; padding-left: 0.5rem; }
.chat-panel .sender { font-weight: 600; margin-right: 0.5rem; }
.chat-panel .time { font-size: 0.8rem; color: #999; margin-left: 0.5rem; }
.chat-panel .badge { font-size: 0.75rem; background: #27ae60; color: #fff; padding: 0.1rem 0.4rem; border-radius: 4px; margin-left: 0.5rem; }
.message-form, .complete-form { display: flex; gap: 0.5rem; padding: 0.75rem; border-top: 1px solid #eee; }
.message-form input[type="text"], .complete-form input[type="text"] { flex: 1; padding: 0.5rem; border: 1px solid #ddd; border-radius: 4px; }
.complete-form { background: #e8f5e9; }
.contract-info { background: #e3f2fd; padding: 0.5rem 1rem; border-radius: 4px; margin-bottom: 1rem; }

/* Contracts */
.contract-list { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 768px) { .contract-list { grid-template-columns: repeat(2, 1fr); } }
.contract-card { background: #fff; padding: 1rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.contract-card h3 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.contract-card form { margin-top: 0.5rem; }
.contract-card button { margin-right: 0.5rem; padding: 0.35rem 0.75rem; cursor: pointer; }
.form-page button[type="submit"] { width: 100%; padding: 0.6rem; background: #27ae60; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 1rem; }
.form-page button[type="submit"]:hover { background: #219a52; }
.form-page .link { margin-top: 1rem; text-align: center; }
.form-page .link a { color: #3498db; text-decoration: none; }
.form-page .error,
.form-error { color: #c0392b; font-size: 0.9rem; margin-bottom: 0.5rem; }
.form-error:empty { display: none; }
