/* Apple HIG - Modern UI Kit */
:root {
    /* Light Theme Colors (Apple Design) */
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #fafafa;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #86868b;
    --separator: rgba(0, 0, 0, 0.1);
    --accent: #007aff;
    --accent-hover: #0051d5;
    --surface: rgba(255, 255, 255, 0.7);
    --surface-hover: rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --blur-bg: rgba(255, 255, 255, 0.8);
}

.dark-theme {
    --bg-primary: #000000;
    --bg-secondary: #1c1c1e;
    --bg-tertiary: #2c2c2e;
    --text-primary: #ffffff;
    --text-secondary: #ebebf5;
    --text-tertiary: #98989d;
    --separator: rgba(255, 255, 255, 0.1);
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --surface: rgba(28, 28, 30, 0.7);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --blur-bg: rgba(28, 28, 30, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.container {
    display: flex;
    height: 100vh;
    flex-direction: column;
}

/* Tema Toggle - Sağ Üst Köşe */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--separator);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
}

.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
    background: var(--surface-hover);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.icon-sun, .icon-moon {
    position: absolute;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.light-theme .icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.light-theme .icon-moon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.dark-theme .icon-sun {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.dark-theme .icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 0.5px solid var(--separator);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 0.5px solid var(--separator);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-title .icon {
    color: var(--accent);
}

.sidebar-title h2 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.rooms-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
}

.room-item {
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.room-item:hover {
    background: var(--surface-hover);
}

.room-item.active {
    background: var(--accent);
    color: #ffffff;
}

.room-item.active h4,
.room-item.active .room-meta {
    color: #ffffff;
}

.room-item h4 {
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.room-item .room-meta {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-bottom: 90px;
    overflow-y: auto;
}

.content-wrapper {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.top-bar {
    padding: 40px 32px 24px;
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 0.5px solid var(--separator);
}

.top-bar-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.page-title {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.1;
}

.add-music-section {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
    pointer-events: none;
}

.search-input {
    flex: 1;
    padding: 12px 16px 12px 44px;
    background: var(--bg-secondary);
    border: 0.5px solid var(--separator);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

/* Buttons */
.btn-primary {
    padding: 12px 20px;
    background: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    padding: 10px 18px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 0.5px solid var(--separator);
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-secondary:hover {
    background: var(--surface-hover);
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon:hover {
    background: var(--surface-hover);
}

.btn-icon:active {
    transform: scale(0.95);
}

/* Playlist Section */
.playlist-section {
    padding: 24px 32px 40px;
}

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-title {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.song-count {
    font-size: 15px;
    color: var(--text-secondary);
}

.playlist {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.playlist-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 10px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 0.5px solid transparent;
}

.playlist-item:hover {
    background: var(--surface-hover);
    transform: translateX(4px);
}

.playlist-item.playing {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

.playlist-item.playing .song-title,
.playlist-item.playing .song-number {
    color: #ffffff;
}

.song-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.song-number {
    width: 24px;
    font-size: 15px;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
}

.song-title {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.playlist-item:hover .playlist-actions {
    opacity: 1;
}

.btn-play {
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    color: var(--text-secondary);
    border: 0.5px solid var(--separator);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-play:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    transform: scale(1.05);
}

.btn-play:active {
    transform: scale(0.95);
}

.btn-delete {
    padding: 8px 12px;
    background: transparent;
    color: var(--text-secondary);
    border: 0.5px solid var(--separator);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-delete:hover {
    background: rgba(255, 59, 48, 0.1);
    border-color: #ff3b30;
    color: #ff3b30;
}

.empty-playlist {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
    font-size: 17px;
}

/* Player Bar */
.player-bar {
    position: fixed;
    bottom: 0;
    left: 260px;
    right: 0;
    height: 90px;
    background: var(--blur-bg);
    border-top: 0.5px solid var(--separator);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    z-index: 999;
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.player-content {
    display: flex;
    align-items: center;
    padding: 0 32px;
    gap: 32px;
    height: 100%;
}

.player-info {
    flex: 1;
    min-width: 200px;
}

.current-song-info .song-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-play-pause {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--text-primary);
    color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-play-pause:hover {
    transform: scale(1.1);
}

.btn-play-pause:active {
    transform: scale(0.95);
}

.player-volume {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 150px;
    color: var(--text-secondary);
}

.player-volume input[type="range"] {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--separator);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.player-volume input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.player-volume input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#youtubePlayer {
    display: none;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-backdrop {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border-radius: 20px;
    min-width: 400px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 0.5px solid var(--separator);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 24px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 0.5px solid var(--separator);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-secondary);
}

.modal-input::placeholder {
    color: var(--text-tertiary);
}

.modal-footer {
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-close {
    color: var(--text-secondary);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--separator);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .main-content {
        margin-left: 240px;
    }
    
    .player-bar {
        left: 240px;
    }
}

/* Responsive - Mobile (Apple Music Style) */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .theme-toggle {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
    }
    
    /* Sidebar - Mobilde Overlay */
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: var(--shadow-lg);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    /* Main Content - Full Width Mobilde */
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .content-wrapper {
        max-width: 100%;
    }
    
    .top-bar {
        padding: 16px 16px 12px;
        position: relative;
    }
    
    .page-title {
        font-size: 28px;
        margin-bottom: 16px;
    }
    
    .add-music-section {
        flex-direction: column;
        gap: 12px;
    }
    
    .search-container {
        width: 100%;
    }
    
    .btn-primary {
        width: 100%;
        justify-content: center;
    }
    
    .playlist-section {
        padding: 16px;
    }
    
    .section-header {
        margin-bottom: 16px;
    }
    
    .section-title {
        font-size: 22px;
    }
    
    .playlist-item {
        padding: 14px 12px;
    }
    
    .song-info {
        gap: 12px;
    }
    
    .song-number {
        width: 20px;
        font-size: 14px;
    }
    
    .song-title {
        font-size: 15px;
    }
    
    .playlist-actions {
        opacity: 1; /* Mobilde her zaman görünür */
        gap: 6px;
    }
    
    .btn-play {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }
    
    .btn-delete {
        padding: 6px 10px;
        font-size: 12px;
        min-height: 36px;
    }
    
    /* Player Bar - Mobilde Full Width */
    .player-bar {
        left: 0;
        height: auto;
        min-height: 80px;
        padding: 12px 0;
        border-top: 0.5px solid var(--separator);
    }
    
    .player-content {
        padding: 0 12px;
        gap: 12px;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        min-height: 56px;
    }
    
    .player-info {
        min-width: 0;
        flex: 1 1 100%;
        order: 1;
        max-width: 100%;
    }
    
    .current-song-info {
        overflow: hidden;
    }
    
    .current-song-info .song-title {
        font-size: 14px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        display: block;
    }
    
    .player-controls {
        gap: 8px;
        flex-shrink: 0;
        order: 2;
        flex: 0 0 auto;
        display: flex;
        align-items: center;
    }
    
    .btn-control {
        width: 40px;
        height: 40px;
        min-width: 40px;
        flex-shrink: 0;
    }
    
    .btn-play-pause {
        width: 44px;
        height: 44px;
        min-width: 44px;
        flex-shrink: 0;
    }
    
    .player-volume {
        display: none; /* Mobilde ses kontrolü gizli */
    }
    
    /* Modal - Mobilde Full Screen */
    .modal-content {
        min-width: calc(100% - 32px);
        margin: 16px;
        border-radius: 16px;
    }
    
    .modal-header {
        padding: 20px 20px 0;
    }
    
    .modal-header h3 {
        font-size: 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 0 20px 20px;
        flex-direction: column-reverse;
    }
    
    .modal-footer .btn-primary,
    .modal-footer .btn-secondary {
        width: 100%;
    }
}

/* Mobil Hamburger Menu Button */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 10001;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 0.5px solid var(--separator);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .mobile-menu-toggle:hover {
        background: var(--surface-hover);
    }
    
    .mobile-menu-toggle:active {
        transform: scale(0.95);
    }
}

/* Touch-friendly minimum sizes */
@media (max-width: 768px) {
    button,
    .btn-icon,
    .room-item {
        min-height: 44px;
    }
    
    input[type="text"],
    .search-input {
        min-height: 44px;
    }
}
