/* Reset e Variáveis */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #9147ff;
    --primary-dark: #772ce8;
    --primary-light: #a970ff;
    --secondary: #18181b;
    --background: #0e0e10;
    --surface: #18181b;
    --surface-light: #1f1f23;
    --border: #2f2f35;
    --text-primary: #efeff1;
    --text-secondary: #adadb8;
    --text-muted: #868691;
    --success: #00f593;
    --warning: #ffa500;
    --error: #f03a47;
    --twitch: #9147ff;
    
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.6);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background-color: rgba(24, 24, 27, 0.95);
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-classic {
    padding: 10px 20px;
    background: var(--surface-light);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    text-decoration: none;
}

.btn-classic:hover {
    background: var(--border);
    transform: translateY(-2px);
}

.logo {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 36px;
}

.logo-dot {
    color: var(--primary);
}

.tagline {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent; /* Remove destaque azul no mobile */
    user-select: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-filters {
    padding: 10px 20px;
    background: var(--surface-light);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-filters:hover {
    background: var(--border);
}

/* Main Layout */
.main-container {
    padding: 24px 0;
}

.content-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
}

/* Sidebar */
.sidebar {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    height: fit-content;
    position: sticky;
    top: 100px;
    border: 1px solid var(--border);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--surface);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.btn-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 32px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 1;
}

.btn-close:hover {
    color: var(--text-primary);
}

/* Filter Sections */
.filter-section {
    margin-bottom: 24px;
}

.filter-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: var(--border);
    color: var(--text-muted);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    cursor: help;
    transition: var(--transition);
    flex-shrink: 0;
}

.help-icon:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-group span {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Inputs */
.input,
.select {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
}

.input:focus,
.select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(145, 71, 255, 0.1);
}

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

.select-wrapper {
    position: relative;
    margin-bottom: 8px;
}

.helper-text {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Radio Buttons */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.radio-label:hover {
    background: var(--surface-light);
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Filter Actions */
.filter-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.filter-actions .btn {
    justify-content: center;
}

/* History */
.history-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.history-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.btn-clear-history {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-clear-history:hover {
    color: var(--error);
    background: rgba(240, 58, 71, 0.1);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: var(--surface);
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.history-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 20px 0;
}

.history-item {
    background: var(--surface-light);
    padding: 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.history-item:hover {
    border-color: var(--primary);
    background: var(--border);
}

.history-item:active {
    transform: scale(0.98);
}

.history-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.history-item-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
}

.history-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item-game {
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Stats */
.stats-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.stats-section h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-item {
    background: var(--surface-light);
    padding: 12px;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid var(--border);
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Content Area */
.content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Player */
.player-container {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    min-height: 500px;
}

.twitch-embed {
    width: 100%;
    height: 600px;
    min-height: 500px;
}

.twitch-embed iframe {
    width: 100% !important;
    height: 100% !important;
}

.player-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
}

.placeholder-content {
    text-align: center;
    color: var(--text-secondary);
}

.placeholder-content svg {
    opacity: 0.3;
    margin-bottom: 16px;
}

.placeholder-content h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.placeholder-content p {
    font-size: 14px;
}

/* Stream Info */
.stream-info {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
}

.stream-info-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.streamer-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid var(--primary);
}

.stream-info-details h2 {
    font-size: 20px;
    margin-bottom: 4px;
}

.stream-info-details p {
    font-size: 14px;
    color: var(--text-secondary);
}

.stream-info-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}

.meta-item svg {
    opacity: 0.7;
}

.stream-actions {
    display: flex;
    gap: 12px;
}

/* Stream List */
.stream-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stream-list-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.stream-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.stream-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

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

.stream-card:active {
    transform: translateY(-2px);
}

.stream-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(145, 71, 255, 0.3);
}

.stream-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.stream-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stream-live-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--error);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stream-live-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.stream-viewers {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stream-card-content {
    padding: 12px;
}

.stream-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.stream-card-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.stream-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.stream-card-title {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.stream-card-game {
    font-size: 12px;
    color: var(--text-muted);
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    opacity: 0.3;
    margin-bottom: 16px;
}

/* Loading */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(14, 14, 16, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1001;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--error);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast-icon {
    font-size: 20px;
}

.toast-message {
    flex: 1;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 100%;
        max-width: 400px;
        height: 100vh;
        max-height: 100vh;
        z-index: 200;
        transition: left 0.3s ease;
        border-radius: 0;
        border: none;
        border-right: 1px solid var(--border);
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .sidebar-header .btn-close {
        display: block;
    }
    
    .btn-filters {
        display: flex;
    }
    
    .btn-classic {
        display: none;
    }
    
    .stream-list {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 640px) {
    /* Header - Mobile otimizado */
    .header {
        padding: 12px 0;
    }
    
    .container {
        padding: 0 12px;
    }
    
    .logo {
        font-size: 18px;
        line-height: 1.2;
    }
    
    .logo-icon {
        font-size: 20px;
    }
    
    .tagline {
        font-size: 11px;
    }
    
    .btn-filters {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    /* Sidebar - Mobile */
    .sidebar {
        max-width: 100%;
        padding: 16px;
    }
    
    .sidebar-header h2 {
        font-size: 18px;
    }
    
    .filter-section {
        margin-bottom: 20px;
    }
    
    .filter-label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .help-icon {
        width: 16px;
        height: 16px;
        font-size: 10px;
    }
    
    .input,
    .select {
        padding: 12px;
        font-size: 16px; /* Evita zoom no iOS */
    }
    
    .btn {
        padding: 14px 20px;
        font-size: 15px;
        min-height: 48px; /* Touch target */
    }
    
    .filter-actions .btn {
        padding: 16px;
    }
    
    /* Stats e History - Mobile */
    .stats-section,
    .history-section {
        margin-top: 20px;
        padding-top: 20px;
    }
    
    .stats-section h3,
    .history-header h3 {
        font-size: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .stat-item {
        padding: 10px 8px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .stat-label {
        font-size: 10px;
    }
    
    .history-item {
        padding: 12px;
    }
    
    .history-item-avatar {
        width: 32px;
        height: 32px;
    }
    
    .history-item-name {
        font-size: 14px;
    }
    
    .history-item-game {
        font-size: 12px;
    }
    
    .btn-clear-history {
        padding: 8px;
    }
    
    /* Main content - Mobile */
    .main-container {
        padding: 16px 0;
    }
    
    .content {
        gap: 16px;
    }
    
    /* Player - Mobile otimizado */
    .player-container {
        border-radius: var(--radius);
        margin: 0;
        min-height: 300px;
    }
    
    .twitch-embed {
        height: 400px;
        min-height: 300px;
    }
    
    .placeholder-content h3 {
        font-size: 16px;
        padding: 0 20px;
    }
    
    .placeholder-content p {
        font-size: 13px;
        padding: 0 20px;
    }
    
    /* Stream Info - Mobile */
    .stream-info {
        padding: 16px;
        border-radius: var(--radius);
    }
    
    .stream-info-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .streamer-avatar {
        width: 56px;
        height: 56px;
    }
    
    .stream-info-details h2 {
        font-size: 18px;
    }
    
    .stream-info-details p {
        font-size: 13px;
    }
    
    .stream-info-meta {
        gap: 12px;
        margin-bottom: 16px;
        padding-bottom: 16px;
        flex-wrap: wrap;
    }
    
    .meta-item {
        font-size: 13px;
        min-width: 45%;
    }
    
    .stream-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .stream-actions .btn {
        width: 100%;
        justify-content: center;
        padding: 16px;
    }
    
    /* Stream List - Mobile */
    .stream-list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .stream-list-header h3 {
        font-size: 16px;
    }
    
    .btn-sm {
        padding: 10px 16px;
        width: 100%;
    }
    
    .stream-list {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stream-card {
        border-radius: var(--radius);
    }
    
    .stream-card-content {
        padding: 10px;
    }
    
    .stream-card-avatar {
        width: 28px;
        height: 28px;
    }
    
    .stream-card-name {
        font-size: 13px;
    }
    
    .stream-card-title {
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .stream-card-game {
        font-size: 11px;
    }
    
    /* Empty state - Mobile */
    .empty-state {
        padding: 40px 20px;
    }
    
    .empty-state svg {
        width: 48px;
        height: 48px;
    }
    
    .empty-state p {
        font-size: 13px;
    }
    
    /* Toast - Mobile */
    .toast-container {
        bottom: 16px;
        right: 16px;
        left: 16px;
    }
    
    .toast {
        min-width: auto;
        padding: 12px 16px;
    }
    
    .toast-message {
        font-size: 13px;
    }
    
    /* Loading - Mobile */
    .loading-spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
    }
    
    .loading-overlay p {
        font-size: 13px;
    }
}

/* Extra small devices */
@media (max-width: 375px) {
    .logo {
        font-size: 16px;
    }
    
    .logo-icon {
        font-size: 18px;
    }
    
    .tagline {
        font-size: 10px;
    }
    
    .btn-filters {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .stream-info-header {
        text-align: center;
        align-items: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
