/* css/style.css */
:root {
    --bg-main: #0d1117;
    --bg-card: #161b22;
    --bg-header: #010409;
    --border-color: #30363d;
    --text-main: #c9d1d9;
    --text-muted: #8b949e;
    --accent: #58a6ff;
    --success: #238636;
    --danger: #f85149;
    --warning: #f0883e;
    --btn-bg: #21262d;
    --btn-hover: #30363d;
}

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

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
}

/* Global Input Styles */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="url"],
select,
textarea {
    width: 100%;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: #f0f6fc;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: 0.2s;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

/* Checkbox Styling */
input[type="checkbox"] {
    appearance: none;
    width: 1.2rem;
    height: 1.2rem;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

input[type="checkbox"]:checked::after {
    content: "✓";
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
}

/* File Upload Styles */
input[type="file"] {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 6px;
    color: var(--text-main);
    font-size: 0.9rem;
}

input[type="file"]::file-selector-button {
    background: var(--btn-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    margin-right: 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: 0.2s;
}

input[type="file"]::file-selector-button:hover {
    background: var(--btn-hover);
}

/* Card Component */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Header */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: var(--btn-bg);
    color: var(--text-main);
    text-decoration: none;
    transition: 0.2s;
    gap: 0.5rem;
}

.btn:hover {
    background: var(--btn-hover);
    border-color: #8b949e;
}

.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { background: #4a9eff; }
.btn-success { background: var(--success); border-color: var(--success); color: white; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: white; }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.8rem; }

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.tab-button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.tab-button.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

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

/* Podcast List View */
.podcast-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.podcast-list-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    transition: transform 0.2s;
    align-items: center;
    padding: 1rem;
}

.podcast-list-item:hover { transform: translateX(4px); border-color: var(--accent); }

.podcast-list-item img {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 1.5rem;
    flex-shrink: 0;
}

.podcast-list-item .content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.podcast-list-item h3 {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.podcast-list-item p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.podcast-list-item .meta-info {
    display: flex;
    gap: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.podcast-list-item .update-info { color: var(--warning); }
.podcast-list-item .feed-link { 
    background: #010409; 
    padding: 0.25rem 0.5rem; 
    border-radius: 4px; 
    font-family: monospace; 
    color: var(--accent);
}

.podcast-list-item .actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
    margin-left: 1rem;
}

/* User Management & Settings Improvements */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 1rem;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--bg-header);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Player Styles */
.player-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    height: calc(100vh - 300px);
    min-height: 500px;
}

.player-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.player-list { overflow-y: auto; flex: 1; }

.player-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    cursor: pointer;
    border-bottom: 1px solid #1f2937;
    transition: 0.2s;
}

.player-list-item:hover { background: var(--btn-hover); }
.player-list-item.active { background: rgba(88, 166, 255, 0.1); border-left: 4px solid var(--accent); }
.player-list-item img { width: 48px; height: 48px; border-radius: 6px; }

.player-main {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.episodes-list { overflow-y: auto; flex: 1; }

.episode-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #1f2937;
    transition: 0.2s;
}

.episode-item:hover { background: rgba(255,255,255,0.02); }
.ep-title { font-weight: 500; color: #f0f6fc; }
.ep-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }

/* Audio Player Bar */
.audio-player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(22, 27, 34, 0.95);
    backdrop-filter: blur(15px);
    border-top: 1px solid var(--accent);
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    z-index: 1000;
    gap: 2rem;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
}

audio {
    height: 35px;
    flex: 1;
    filter: invert(1) hue-rotate(180deg) brightness(1.5);
}

.now-playing { display: flex; align-items: center; gap: 1rem; min-width: 300px; }
.now-playing img { width: 45px; height: 45px; border-radius: 4px; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; color: var(--text-muted); font-size: 0.9rem; }

/* Result List Styling */
.result-list {
    list-style: none;
    margin-top: 1.5rem;
}

.result-item {
    display: flex;
    gap: 1.5rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1rem;
    align-items: center;
    transition: border-color 0.2s, transform 0.1s;
}

.result-item:hover {
    border-color: var(--accent);
    transform: translateX(4px);
}

.result-item img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.result-item .info {
    flex: 1;
    min-width: 0;
}

.result-item .title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-item .subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.result-item button {
    flex-shrink: 0;
}

/* Embedded / Iframe Mode */
body.embedded {
    background: transparent;
    padding: 0;
    min-height: auto;
}

body.embedded .container {
    max-width: none;
    padding: 0;
}

body.embedded .player-container {
    height: calc(100vh - 80px);
    border-radius: 0;
}

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

@media (max-width: 900px) {
    .player-container { grid-template-columns: 1fr; height: auto; }
    .podcast-list-item { flex-direction: column; align-items: flex-start; }
    .podcast-list-item img { width: 100%; height: 200px; margin-right: 0; margin-bottom: 1rem; }
    .podcast-list-item .actions { margin-left: 0; margin-top: 1rem; width: 100%; justify-content: flex-start; }
}
