/* ==================== SHARED DESIGN SYSTEM ==================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #10b981;
    --secondary-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --info: #3b82f6;
    --info-hover: #2563eb;

    /* Neutrals */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --surface: #1e293b;
    --surface-hover: #334155;

    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    /* Border & Shadow */
    --border: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
}

body {
    background: linear-gradient(135deg, var(--bg-primary) 0%, #0a0f1e 100%);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ==================== AUTH PAGES (Login & Dashboard) ==================== */

.mb1 {
    margin-bottom: 1rem;
}

.mb5 {
    margin-bottom: 0.5rem;
}

.logintext {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.asdasda {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.asdasdaa {
    font-size: 1rem;
}

.bold {
    font-weight: 600;
}

.tc {
    margin-left: auto;
    margin-right: auto;
}

.ctr {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface);
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
    min-width: 350px;
}

.textctr {
    text-align: center;
}

/* Dashboard user info styling */
.textctr .asdasda {
    padding: var(--spacing-lg);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
    display: inline-block;
    min-width: 300px;
}

/* Button Styles */
.login, .login2, .login3 {
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.75rem 1.5rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
    min-width: 200px;
}

.login {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-hover) 100%);
}

.login:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--secondary-hover) 0%, #047857 100%);
}

.login2 {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-hover) 100%);
}

.login2:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--danger-hover) 0%, #b91c1c 100%);
}

.login3 {
    background: linear-gradient(135deg, var(--info) 0%, var(--info-hover) 100%);
}

.login3:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--info-hover) 0%, #1d4ed8 100%);
}

/* Table Styling */
table {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    border-collapse: collapse;
}

table th {
    padding: 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 600;
    text-align: left;
}

table td {
    padding: 12px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

/* ==================== ACTIVATOR PAGE ==================== */

.box {
    background: var(--surface);
    padding: 2rem 2.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 500px;
    margin: 2rem auto;
    text-align: center;
    border: 1px solid var(--border);
    box-sizing: border-box;
}

.box h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    color: var(--text-primary);
}

.box h2 a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-right: 0.5rem;
    transition: color 0.2s;
}

.box h2 a:hover {
    color: var(--primary-light);
}

img.status {
    display: block;
    height: 70px;
    width: 70px;
    margin: 0 auto 1.5rem auto;
    cursor: pointer;
    transition: transform 0.3s ease;
}

img.status:hover {
    transform: scale(1.1);
}

.box form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

input[type="text"].radio_id_entry {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

input[type="text"].radio_id_entry::placeholder {
    color: var(--text-muted);
}

input[type="text"].radio_id_entry:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.button {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-hover) 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--secondary-hover) 0%, #047857 100%);
}

.button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
}

.button:active {
    transform: translateY(0);
}

/* Saved Radios */
.saved-radios-container {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.saved-radios-container h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    text-align: left;
}

#savedRadiosList {
    list-style: none;
    padding: 0;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 8px;
}

.saved-radio-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    transition: all 0.2s;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.saved-radio-item:hover {
    background: var(--surface-hover);
}

.saved-radio-id {
    font-weight: 500;
    cursor: pointer;
    flex: 1;
    color: var(--primary-light);
    text-align: left;
}

.saved-radio-id:hover {
    text-decoration: underline;
}

.saved-radio-date {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0 1rem;
    white-space: nowrap;
}

.delete-radio-button {
    background: var(--danger);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.delete-radio-button:hover {
    background: var(--danger-hover);
}

/* Info Section */
.info {
    margin-top: 1.5rem;
    padding: 0;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--info);
    text-align: left;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s ease;
}

.info.show {
    opacity: 1;
    max-height: 500px;
    padding: 1.25rem;
    margin-top: 1.5rem;
}

.info.hide {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    border-width: 0;
}

.copy-button {
    background: var(--info);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    display: block;
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.copy-button:hover {
    background: var(--info-hover);
}

.response-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

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

.response-key {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.response-value {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-primary);
}

#savedRadiosList::-webkit-scrollbar {
    width: 10px;
}

#savedRadiosList::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 5px;
}

#savedRadiosList::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
}

#savedRadiosList::-webkit-scrollbar-thumb:hover {
    background: var(--surface-hover);
}

/* ==================== PLAYER PAGE ==================== */

body {
    padding-bottom: 120px;
}

header {
    background: var(--surface);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

header h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
}

header h1 a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-right: 0.5rem;
    transition: color 0.2s;
    -webkit-text-fill-color: var(--text-secondary);
}

header h1 a:hover {
    color: var(--primary-light);
    -webkit-text-fill-color: var(--primary-light);
}

/* Sort Controls */
.sort-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-controls label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

#sort-select {
    font-family: inherit;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 8px 12px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

#sort-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#sort-select option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Search Styles */
.search-container {
    flex: 0 0 300px;
    max-width: 300px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    z-index: 1;
}

#search-input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: 25px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

#search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#search-input::placeholder {
    color: var(--text-muted);
}

.clear-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: none;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.clear-btn svg {
    width: 14px;
    height: 14px;
}

.clear-btn.show {
    display: block;
}

/* Main Content */
main#channel-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto 2rem;
}

.hidden {
    display: none;
}

#search-results h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}

.genre-section, .sort-section {
    margin-bottom: 3rem;
}

.genre-section h2, .sort-section h2 {
    font-size: 1.6rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.channel-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.channel-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--info) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.channel-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.channel-card:hover::before {
    opacity: 0.1;
}

.channel-card.playing {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

.channel-card.playing::before {
    opacity: 0.15;
}

.channel-card > * {
    position: relative;
    z-index: 1;
}

.channel-card img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background-color: var(--bg-tertiary);
    transition: transform 0.3s ease;
}

.channel-card:hover img {
    transform: scale(1.05);
}

.channel-card .channel-title {
    margin: 1rem 0 0.3rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.channel-card .channel-genre {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.channel-card .channel-number {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    font-size: 0.875rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    z-index: 2;
    backdrop-filter: blur(4px);
    box-shadow: var(--shadow-sm);
}

.error {
    color: var(--danger);
    text-align: center;
    padding: 2rem;
    font-size: 1.1rem;
}

.img-error {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3e%3cpath d='M9 18V5l12-2v13'/%3e%3ccircle cx='6' cy='18' r='3'/%3e%3ccircle cx='18' cy='16' r='3'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 45%;
}

/* Player Footer */
#player {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 90px;
    background: linear-gradient(135deg, var(--surface) 0%, var(--bg-secondary) 100%);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    box-sizing: border-box;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-xl);
    z-index: 200;
}

#player-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    flex: 1;
}

#player-logo {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    object-fit: contain;
    background-color: var(--bg-tertiary);
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}

#player-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex: 1;
}

#player-title {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
    color: var(--text-primary);
}

#player-artist {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#channel-title {
    font-size: 0.75rem;
    color: var(--primary-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

#player-controls {
    display: flex;
    align-items: center;
}

#play-pause-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

#play-pause-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

#play-pause-btn:active {
    transform: scale(0.95);
}

#play-pause-btn svg {
    width: 24px;
    height: 24px;
}

#audio-player {
    display: none;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .header-controls {
        justify-content: space-between;
    }

    .search-container {
        flex: 1;
        max-width: none;
    }
}

@media (max-width: 768px) {
    .header-controls {
        flex-direction: column;
        gap: 1rem;
    }

    .search-container {
        flex: 1;
        max-width: 100%;
    }

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

    main#channel-container {
        padding: 1rem;
    }

    #player {
        padding: 0 1rem;
    }

    body {
        padding-bottom: 100px;
    }

    .ctr {
        min-width: auto;
        width: 90%;
        max-width: 400px;
        padding: 2rem 1.5rem;
    }

    .box {
        padding: 1.5rem;
        margin: 1rem auto;
        width: calc(100% - 2rem);
        max-width: 500px;
    }
}

@media (max-width: 480px) {
    .channel-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    header {
        padding: 1rem;
    }

    .logintext {
        font-size: 2rem;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus styles for accessibility */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

button:focus-visible,
.channel-card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}