/* moviesonthe.computer - Japanese-Inspired Design */

:root {
    /* Wada Sanzo Colors - Direct, No Gradients */
    --coral: #f48067;
    --cream: #f5ecc2;
    --orange: #f3a257;
    --purple: #bf5892;
    --gray: #b6bfc1;
    --black: #000000;

    /* Semantic colors */
    --primary: var(--coral);
    --secondary: var(--purple);
    --accent: var(--orange);
    --background: var(--cream);
    --surface: #ffffff;
    --text: var(--black);
    --text-muted: #4a4a4a;
    --border: #d4d4d4;
    --star-color: var(--orange);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', YuGothic, Meiryo, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--background);
    font-size: 14px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 500;
    letter-spacing: 0.02em;
}

h2 {
    margin-bottom: 1.5rem;
    color: var(--text);
    font-size: 1.5rem;
    border-bottom: 2px solid var(--black);
    padding-bottom: 0.5rem;
    font-weight: 600;
}

h3 {
    margin-bottom: 0.5rem;
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
}

/* Header & Navigation */
header {
    background: var(--coral);
    color: white;
    padding: 1rem 0;
    border-bottom: 3px solid var(--black);
}

nav {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

nav h1 a {
    color: var(--black);
    text-decoration: none;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 0;
    align-items: center;
}

nav ul li {
    position: relative;
}

nav ul li:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 1rem;
    background: var(--black);
    opacity: 0.3;
}

nav ul li a {
    color: var(--black);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    display: block;
    transition: background-color 0.2s;
    border: 1px solid transparent;
}

nav ul li a:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: var(--black);
}

/* Main Content */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: calc(100vh - 200px);
}

.container {
    max-width: 100%;
}

/* Watch Grid */
.watch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.watch-card {
    background: var(--surface);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.watch-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--black);
}

.watch-card .poster {
    width: 100%;
    display: block;
    aspect-ratio: 2/3;
    object-fit: cover;
    background: var(--gray);
}

.watch-info {
    padding: 0.75rem;
}

.watch-info h3 {
    margin: 0 0 0.25rem 0;
    font-size: 0.875rem;
    line-height: 1.3;
    font-weight: 600;
}

.watch-info h3 a {
    color: var(--text);
    text-decoration: none;
}

.watch-info h3 a:hover {
    color: var(--primary);
}

.year {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: 0;
}

.watched-date {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: 0.5rem 0 0 0;
}

.rating {
    color: var(--star-color);
    font-size: 1rem;
    margin: 0.5rem 0 0 0;
    letter-spacing: 1px;
}

.badge {
    display: inline-block;
    background: var(--purple);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 2px;
    font-size: 0.625rem;
    font-weight: 700;
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comments {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    color: var(--text-muted);
    line-height: 1.4;
    border-left: 2px solid var(--accent);
    padding-left: 0.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text);
    font-size: 0.875rem;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--surface);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--black);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Star Rating */
.star-rating {
    display: flex;
    gap: 0.25rem;
    margin: 0.5rem 0;
}

.star-btn {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    padding: 0;
    transition: transform 0.1s;
}

.star-btn:hover {
    transform: scale(1.1);
}

.star-filled {
    color: var(--star-color);
}

.star-empty {
    color: var(--border);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.625rem 1.5rem;
    border: 1px solid var(--black);
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--coral);
    color: var(--black);
    border-color: var(--black);
}

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

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

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

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 2rem;
}

/* Movie Preview */
.movie-preview {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1.25rem;
    margin-bottom: 2rem;
    display: flex;
    gap: 1.25rem;
}

.movie-preview .poster {
    width: 100px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.movie-details {
    flex: 1;
}

.movie-details h3 {
    color: var(--text);
    margin-bottom: 0.25rem;
    font-size: 1.125rem;
}

.movie-details .year {
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.movie-details p {
    color: var(--text-muted);
    line-height: 1.5;
    font-size: 0.875rem;
}

/* Search Results */
.search-results {
    margin-top: 2rem;
}

.results-grid {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.result-card {
    display: flex;
    gap: 1rem;
    background: var(--surface);
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.result-card:hover {
    border-color: var(--black);
}

.poster-small {
    width: 80px;
    height: auto;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.no-poster {
    width: 80px;
    height: 120px;
    background: var(--gray);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.625rem;
    border-radius: 4px;
    text-align: center;
    padding: 0.5rem;
    border: 1px solid var(--border);
}

.result-info {
    flex: 1;
}

.result-info h4 {
    margin: 0 0 0.25rem 0;
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
}

.overview {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0.5rem 0 0.75rem 0;
    line-height: 1.5;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.stat-card {
    background: var(--surface);
    padding: 1.25rem;
    border-radius: 4px;
    text-align: center;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.stat-card:hover {
    border-color: var(--black);
}

.stat-card h3 {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--coral);
    line-height: 1;
}

/* Year Selector */
.year-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.year-selector a {
    padding: 0.375rem 0.875rem;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid var(--border);
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.875rem;
}

.year-selector a:hover {
    border-color: var(--black);
}

.year-selector a.active {
    background: var(--coral);
    color: var(--black);
    border-color: var(--black);
}

/* Activity Stream */
.activity-feed {
    margin-top: 2rem;
}

.activity-item {
    background: var(--surface);
    padding: 1.25rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
}

.activity-item time {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.activity-content {
    margin: 0.75rem 0;
    line-height: 1.5;
    font-size: 0.875rem;
}

.activity-poster {
    max-width: 200px;
    border-radius: 4px;
    margin-top: 0.75rem;
    border: 1px solid var(--border);
}

.activitypub-info {
    background: var(--surface);
    padding: 1.25rem;
    border-radius: 4px;
    margin-top: 2rem;
    border: 1px solid var(--accent);
}

.activitypub-info code {
    display: block;
    background: var(--cream);
    padding: 0.75rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.75rem;
    overflow-x: auto;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 4rem;
    font-size: 0.75rem;
}

/* HTMX Indicators */
.htmx-indicator {
    display: none;
    color: var(--text-muted);
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

/* Date Mode Selector */
.date-mode-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
    font-family: inherit;
    font-weight: 500;
}

.mode-btn:hover {
    border-color: var(--black);
}

.mode-btn.active {
    background: var(--coral);
    color: var(--black);
    border-color: var(--black);
}

.date-input-group {
    margin-top: 0.5rem;
}

.date-input-group input[type="date"],
.date-input-group input[type="number"],
.date-input-group select {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--surface);
    transition: border-color 0.2s;
}

.date-input-group input:focus,
.date-input-group select:focus {
    outline: none;
    border-color: var(--black);
}

.date-input-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Settings Page */
.settings-form {
    background: var(--surface);
    padding: 2rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    max-width: 600px;
    margin: 0 auto;
}

/* Watch Detail */
.watch-detail {
    margin-top: 1rem;
}

.watch-header {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.poster-large {
    width: 250px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.watch-info {
    flex: 1;
}

.watch-info h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
}

.watch-meta {
    background: var(--surface);
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    border: 1px solid var(--border);
}

.watch-meta p {
    margin: 0.5rem 0;
    font-size: 0.875rem;
}

.comments, .overview {
    margin: 1.25rem 0;
}

.comments h3, .overview h3 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.comments p, .overview p {
    font-size: 0.875rem;
    line-height: 1.6;
}

.actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    nav {
        flex-direction: column;
        gap: 1rem;
        padding: 0 1rem;
    }

    nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }

    nav ul li a {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }

    .watch-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }

    .result-card {
        flex-direction: column;
    }

    .poster-small {
        width: 100%;
        max-width: 150px;
    }

    .movie-preview {
        flex-direction: column;
    }

    .movie-preview .poster {
        width: 100%;
        max-width: 180px;
    }

    .watch-header {
        flex-direction: column;
    }

    .poster-large {
        width: 100%;
        max-width: 300px;
    }

    h2 {
        font-size: 1.25rem;
    }

    main {
        padding: 1.5rem 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .year-selector {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state h3 {
    color: var(--text);
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}

.empty-state p {
    margin-bottom: 1.5rem;
    line-height: 1.6;
    font-size: 0.875rem;
}

.empty-state a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.empty-state a:hover {
    text-decoration: underline;
}

/* Settings Display */
.info-text {
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    background-color: var(--cream);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.settings-display {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1.5rem;
}

.setting-item {
    margin-bottom: 1.5rem;
}

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

.setting-item label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-size: 0.875rem;
}

.setting-value {
    padding: 0.75rem;
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.875rem;
}

.setting-item small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Page Header with Year Selector */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.year-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.year-btn {
    padding: 0.5rem 1rem;
    background-color: var(--surface);
    color: var(--text);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

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

.year-btn.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
    font-weight: 600;
}

.year-display {
    padding: 0.5rem 1rem;
    background-color: var(--primary);
    color: white;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Poster Grid */
.poster-grid-container {
    width: 100%;
}

.poster-grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.grid-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-toggle {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background-color: var(--surface);
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: none;
    border-right: 1px solid var(--border);
    cursor: pointer;
    white-space: nowrap;
}

.filter-btn:last-child {
    border-right: none;
}

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

.filter-btn.active {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
}

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

.poster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
    margin: 0;
    padding: 0;
}

.poster-grid-item {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
    border-radius: 2px;
    background-color: var(--gray);
}

.poster-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Print Styles */
@media print {
    @page {
        size: auto;
        margin: 0.5cm;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    .no-print {
        display: none !important;
    }

    header, nav, .container > h2 {
        display: none !important;
    }

    body {
        background-color: white;
        margin: 0;
        padding: 0;
    }

    .poster-grid-container {
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    .poster-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.25rem;
        page-break-inside: avoid;
    }

    .poster-grid-item {
        page-break-inside: avoid;
        border-radius: 0;
    }

    .poster-grid-item img {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
}

/* Responsive adjustments for poster grid */
@media (max-width: 768px) {
    .poster-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.35rem;
    }

    .poster-grid-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .grid-actions {
        width: 100%;
        justify-content: space-between;
    }

    .filter-toggle {
        order: -1;
        width: 100%;
    }

    .filter-btn {
        flex: 1;
        text-align: center;
        padding: 0.75rem 0.5rem;
    }
}
