/* ================================================================
   musicsocial — central stylesheet
   ================================================================ */

/* ====================== Reset & Base ====================== */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #0f0f0f;
    color: #e0e0e0;
    line-height: 1.5;
}

/* ====================== Typography ====================== */

h1 {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    line-height: 1.2;
}

h2 {
    font-size: 1.25rem;
    font-weight: 400;
    color: #aaa;
    margin-bottom: 0.75rem;
}

a {
    color: #7eb8da;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ====================== Three-Column Layout ====================== */

.site-layout {
    display: grid;
    grid-template-columns: 200px minmax(0, 600px) 280px;
    gap: 1.5rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
    min-height: 100vh;
}

/* ====================== Left Navigation ====================== */

.left-nav {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #1a1a1a;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #e0e0e0;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    transition: color 0.15s;
    margin-bottom: 1.5rem;
}

.logo:hover {
    text-decoration: none;
    color: #fff;
}

.logo-icon {
    flex-shrink: 0;
}

.logo-text {
    white-space: nowrap;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-links a {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 1.05rem;
    font-weight: 400;
    transition: background 0.15s;
}

.nav-links a:hover {
    background: #1a1a1a;
    text-decoration: none;
}

.nav-logout {
    color: #888 !important;
    font-size: 0.9rem !important;
}

/* ====================== Main Content ====================== */

.main-content {
    padding: 1.5rem 0;
    min-width: 0;
}

.container {
    max-width: 600px;
    width: 100%;
}

.container--narrow {
    max-width: 400px;
}

.container--sm {
    max-width: 500px;
}

.container--md {
    max-width: 600px;
}

.container--feed {
    max-width: 600px;
}

.text-center {
    text-align: center;
}

/* ====================== Right Sidebar ====================== */

.right-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 1.5rem 0;
    border-left: 1px solid #1a1a1a;
    padding-left: 1.5rem;
}

/* Search box */
.search-box {
    position: relative;
    margin-bottom: 1.25rem;
}

.search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem 0.75rem;
    border: 1px solid #333;
    border-radius: 20px;
    background: #1a1a1a;
    color: #e0e0e0;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: #1d9bf0;
}

.search-input::placeholder {
    color: #666;
}

.search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    max-height: 360px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.search-results[hidden] {
    display: none;
}

.search-section-label {
    padding: 0.5rem 0.75rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.search-result-item {
    display: block;
    padding: 0.5rem 0.75rem;
    color: #e0e0e0;
    text-decoration: none;
    border-bottom: 1px solid #222;
    transition: background 0.15s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item:focus {
    background: #252525;
}

.search-result-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.search-result-extra {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.1rem;
}

.search-no-results {
    padding: 0.75rem;
    color: #888;
    font-size: 0.85rem;
    text-align: center;
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 500;
    color: #aaa;
    margin-bottom: 0.75rem;
}

.sidebar-artists {
    list-style: none;
    counter-reset: artist-rank;
}

.sidebar-artists li {
    counter-increment: artist-rank;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.35rem 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.sidebar-artists li::before {
    content: counter(artist-rank);
    color: #555;
    font-size: 0.8rem;
    min-width: 1.2rem;
    text-align: right;
}

.sidebar-artists a {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-artists .followers {
    color: #555;
    font-size: 0.8rem;
    white-space: nowrap;
}

/* ====================== Site Footer ====================== */

.site-footer {
    border-top: 1px solid #1a1a1a;
    padding: 1.5rem 1rem;
    text-align: center;
    color: #555;
    font-size: 0.8rem;
}

/* ====================== Page Title ====================== */

.page-title {
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: #999;
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* ====================== Posts ====================== */

.post {
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.6rem;
}

.post-artist-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #222;
}

.post-artist {
    font-size: 1.15rem;
    line-height: 1.2;
}

.post-artist a {
    color: #7eb8da;
    text-decoration: none;
    font-weight: 600;
}

.post-artist a:hover {
    text-decoration: underline;
}

.post-content p {
    margin-bottom: 0.5rem;
}

.post-content a {
    color: #6ea1f7;
}

.post-meta {
    color: #666;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.post-interactions {
    color: #888;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.post-interactions span {
    margin-right: 1rem;
}

.post-actions {
    margin-top: 0.5rem;
}

/* Post-specific: artist name link in single-post pages */
/* ====================== Buttons ====================== */

.btn {
    background: #7eb8da;
    color: #0f0f0f;
    border: none;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    width: 100%;
    transition: background 0.2s;
}

.btn:hover {
    background: #9dcaea;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-logout {
    background: transparent;
    color: #e57373;
    border: 1px solid #e57373;
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(229, 115, 115, 0.1);
}

.like-btn {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0;
    transition: color 0.15s ease;
}

.like-btn:hover {
    color: #e0e0e0;
}

.like-btn.liked {
    color: #e74c6f;
}

.fav-btn {
    background: none;
    border: 1px solid #444;
    color: #e0e0e0;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.fav-btn:hover {
    border-color: #888;
}

.fav-btn.favourited {
    border-color: #e74c6f;
    color: #e74c6f;
}

/* ====================== Forms ====================== */

.field {
    text-align: left;
    margin-bottom: 1.5rem;
}

.field label {
    display: block;
    font-size: 0.8rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.4rem;
}

.input-wrap {
    position: relative;
}

.input-wrap .prefix {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 1rem;
    pointer-events: none;
}

.input-wrap input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1.75rem;
    font-size: 1rem;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    color: #e0e0e0;
    outline: none;
    transition: border-color 0.2s;
}

.input-wrap input:focus {
    border-color: #7eb8da;
}

.input-wrap input.valid {
    border-color: #66bb6a;
}

.input-wrap input.invalid {
    border-color: #e57373;
}

.status-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
}

.hint {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.35rem;
    min-height: 1.1em;
}

.hint.error {
    color: #e57373;
}

.hint.success {
    color: #66bb6a;
}

/* ====================== Cards ====================== */

.card {
    background: #1a1a1a;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card .label {
    color: #999;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
}

.card .value {
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 0.9rem;
    word-break: break-all;
}

.card .row + .row {
    margin-top: 1rem;
}

/* ====================== Lists ====================== */

.artist-list {
    list-style-position: inside;
    padding: 0;
}

.artist-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #1a1a1a;
}

.artist-list .followers {
    color: #666;
    font-size: 0.875rem;
    margin-left: 0.25rem;
}

.plain-list {
    list-style: none;
    padding: 0;
}

.plain-list li {
    padding: 0.4rem 0;
}

.date {
    color: #666;
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

/* ====================== Artist Page ====================== */

.artist-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 0.5rem;
}

.artist-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #2a2a2a;
}

.artist-followers {
    color: #888;
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.artist-actions {
    margin-bottom: 1.5rem;
}

/* Link style for artist page lists */
.artist-page a {
    color: #e0e0e0;
    text-decoration: none;
}

.artist-page a:hover {
    text-decoration: underline;
}

/* ====================== Profile Page ====================== */

.profile-handle {
    color: #999;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.profile-meta {
    color: #999;
    font-size: 0.875rem;
}

.fav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    text-align: center;
}

.fav-item {
    text-decoration: none;
    color: #e0e0e0;
}

.fav-item:hover {
    text-decoration: underline;
}

.fav-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #2a2a2a;
    margin-bottom: 0.4rem;
}

.fav-img-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #222;
    border: 2px solid #2a2a2a;
    margin: 0 auto 0.4rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 1.5rem;
}

.fav-name {
    font-size: 0.85rem;
    display: block;
}

/* ====================== Release Page ====================== */

.byline {
    margin-top: 0.75rem;
    font-size: 1.1rem;
    color: #888;
}

.byline a {
    color: #e0e0e0;
    text-decoration: none;
}

.byline a:hover {
    text-decoration: underline;
}

.release-selector {
    margin-top: 2rem;
}

.release-selector label {
    color: #aaa;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 0.4rem;
}

.release-selector select {
    background: #1a1a1a;
    color: #e0e0e0;
    border: 1px solid #333;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    border-radius: 4px;
    width: 100%;
    max-width: 400px;
}

.tracklist ol {
    padding-left: 1.5rem;
}

.tracklist li {
    padding: 0.35rem 0;
}

.track-length {
    color: #666;
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.medium-title {
    font-size: 1rem;
    color: #666;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

/* ====================== Tag Page ====================== */

.tag-title {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    margin-bottom: 2rem;
}

/* ====================== Feed / Home ====================== */

.feed-section-title {
    font-size: 1.15rem;
    font-weight: 400;
    color: #aaa;
    margin-bottom: 1rem;
}

#loading {
    text-align: center;
    padding: 1.5rem;
    color: #666;
    display: none;
}

#end {
    text-align: center;
    padding: 1rem;
    color: #555;
    font-size: 0.85rem;
    display: none;
}

/* ====================== Utility ====================== */

.empty {
    color: #666;
    text-align: center;
    padding: 3rem 0;
}

.empty a {
    color: #7eb8da;
}

.error-msg {
    color: #e57373;
    margin-top: 1rem;
}

.links {
    margin-top: 2rem;
}

.links a {
    color: #7eb8da;
    text-decoration: none;
}

.links a:hover {
    text-decoration: underline;
}

.actions {
    margin-top: 1.5rem;
}

.actions form {
    display: inline;
}

/* ====================== YouTube Previews ====================== */

.yt-preview {
    margin-top: 0.75rem;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.yt-thumb {
    position: relative;
    cursor: pointer;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.yt-thumb-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.yt-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.15s ease;
}

.yt-thumb:hover .yt-play {
    opacity: 0.9;
}

.yt-thumb:hover .yt-play path:first-child {
    fill: #e00;
    fill-opacity: 1;
}

.yt-preview--playing {
    aspect-ratio: 16 / 9;
}

.yt-embed {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* ====================== OG Link Cards ====================== */

.og-card {
    margin-top: 0.75rem;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    overflow: hidden;
    background: #1a1a1a;
}

.og-card--loading {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 0.8rem;
}

.og-card--loading::after {
    content: 'Loading preview\2026';
}

.og-card-link {
    display: flex;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}

.og-card-link:hover {
    background: #222;
    text-decoration: none;
}

.og-card-img {
    width: 120px;
    min-height: 120px;
    object-fit: cover;
    flex-shrink: 0;
    background: #222;
}

.og-card-body {
    padding: 0.75rem 1rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
}

.og-card-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #e0e0e0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.og-card-desc {
    font-size: 0.8rem;
    color: #888;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.og-card-site {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ====================== Login Modal ====================== */

.modal[hidden] {
    display: none !important;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.modal-dialog {
    position: relative;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 2rem;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal-dialog h3 {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    color: #e0e0e0;
}

.modal-dialog p {
    margin: 0 0 1.5rem;
    color: #999;
    font-size: 0.9rem;
    line-height: 1.5;
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
}

.modal-close:hover {
    color: #e0e0e0;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background 0.15s ease;
}

.btn--primary {
    background: #7eb8da;
    color: #111;
}

.btn--primary:hover {
    background: #9ccbe5;
    text-decoration: none;
}

.btn--secondary {
    background: #333;
    color: #e0e0e0;
}

.btn--secondary:hover {
    background: #444;
    text-decoration: none;
}

/* ====================== Responsive ====================== */

@media (max-width: 900px) {
    .site-layout {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 0;
    }

    .left-nav {
        position: static;
        height: auto;
        flex-direction: row;
        align-items: center;
        gap: 1rem;
        padding: 0.75rem 1rem;
        border-right: none;
        border-bottom: 1px solid #1a1a1a;
        overflow-x: auto;
    }

    .logo {
        margin-bottom: 0;
    }

    .nav-links {
        flex-direction: row;
        gap: 0;
    }

    .nav-links a {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .main-content {
        padding: 1.25rem 1rem;
    }

    .right-sidebar {
        position: static;
        height: auto;
        border-left: none;
        border-top: 1px solid #1a1a1a;
        padding: 1.25rem 1rem;
    }

    .sidebar-artists {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0 1rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.6rem;
    }

    .left-nav {
        gap: 0.5rem;
        padding: 0.5rem 0.75rem;
    }

    .logo-text {
        display: none;
    }

    .nav-links a {
        padding: 0.35rem 0.5rem;
        font-size: 0.8rem;
    }

    .main-content {
        padding: 1rem 0.75rem;
    }

    .post {
        padding: 0.75rem;
    }

    .release-selector select {
        max-width: 100%;
    }

    .artist-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .fav-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }

    .fav-img,
    .fav-img-placeholder {
        width: 56px;
        height: 56px;
    }

    .fav-name {
        font-size: 0.75rem;
    }

    .og-card-link {
        flex-direction: column;
    }

    .og-card-img {
        width: 100%;
        min-height: 0;
        max-height: 160px;
    }

    .sidebar-artists {
        grid-template-columns: 1fr;
    }
}

/* Admin */
.admin-section {
    margin-bottom: 2rem;
}

.admin-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.admin-section-desc {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #222;
}

.admin-table th {
    color: #aaa;
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-table td a {
    color: #7eb8da;
    text-decoration: none;
}

.admin-table td a:hover {
    text-decoration: underline;
}

.col-num {
    text-align: right;
}

.mono {
    font-family: monospace;
    font-size: 0.8rem;
    color: #999;
}

.empty-state {
    color: #888;
    font-size: 0.9rem;
    padding: 1rem 0;
}
