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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Nav */
nav {
    background: #1a1a2e;
    padding: 1rem 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    text-decoration: none;
}

.nav-links a {
    color: #aab;
    text-decoration: none;
    margin-left: 2rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: #fff;
}

/* Main */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

h1 {
    margin-bottom: 1.5rem;
    color: #1a1a2e;
}

/* Flash messages */
.flash {
    padding: 0.8rem 1.2rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.flash.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Form */
.search-form {
    background: #fff;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    color: #555;
}

.form-group-wide {
    grid-column: 1 / -1;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1a1a2e;
}

/* Tags input */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    min-height: 42px;
    cursor: text;
    transition: border-color 0.2s;
}

.tags-container:focus-within {
    border-color: #1a1a2e;
}

.tags-container input {
    border: none !important;
    outline: none;
    padding: 0.2rem;
    flex: 1;
    min-width: 120px;
    font-size: 0.95rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #1a1a2e;
    color: #fff;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}

.tag-remove {
    background: none;
    border: none;
    color: #aab;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    margin-left: 0.1rem;
}

.tag-remove:hover {
    color: #fff;
}

/* Buttons */
.btn {
    background: #1a1a2e;
    color: #fff;
    border: none;
    padding: 0.7rem 2rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn:hover {
    background: #16213e;
}

.btn-danger {
    background: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

thead {
    background: #1a1a2e;
    color: #fff;
}

th {
    padding: 0.8rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

tbody tr:hover {
    background: #f8f9ff;
}

td a {
    color: #1a1a2e;
    font-weight: 500;
}

td a:hover {
    color: #e94560;
}

/* Saved page */
.saved-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.saved-header h1 {
    margin-bottom: 0;
}

.empty {
    text-align: center;
    color: #888;
    padding: 3rem;
    font-size: 1.1rem;
}

/* Save / Delete buttons */
.btn-save {
    background: none;
    border: 1px solid #1a1a2e;
    color: #1a1a2e;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-save:hover:not(.saved) {
    background: #1a1a2e;
    color: #fff;
}

.btn-save.saved {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
    cursor: default;
}

.btn-delete {
    background: none;
    border: 1px solid #dc3545;
    color: #dc3545;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-delete:hover {
    background: #dc3545;
    color: #fff;
}

.inline-form {
    display: inline;
}

/* Results */
.results {
    margin-top: 1rem;
}

.results h2 {
    margin-bottom: 1rem;
    color: #1a1a2e;
}
