/* Profile Page Styles - Complete with Mobile Optimizations */

.profile-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Profile Header */
.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e0e0e0;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.profile-avatar, 
.profile-avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-avatar-placeholder {
    background: #4285f4;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
}

.profile-name {
    font-size: 1.5rem;
    margin: 0;
    font-weight: 600;
}

.profile-username {
    color: #666;
    margin: 0.25rem 0;
}

.profile-joined {
    color: #999;
    font-size: 0.9rem;
}

/* Stats */
.profile-stats {
    display: flex;
    gap: 2rem;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.stat-label {
    color: #666;
    font-size: 0.85rem;
}

/* Management Toolbar */
.management-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    align-items: center;
    justify-content: space-between;
}

.toolbar-left {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.toolbar-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.toolbar-search {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

.selection-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.selection-count {
    font-weight: 600;
    color: #666;
    padding-right: 0.5rem;
    border-right: 1px solid #e0e0e0;
}

/* Folders and Songs */
.folders-tree {
    background: white;
}

.folder-item {
    margin-bottom: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    transition: all 0.3s ease;
}

.folder-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.folder-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.folder-item.drag-over {
    background: #e3f2fd;
    border-color: #2196f3;
}

.folder-header {
    display: flex;
    align-items: center;
    padding: 1rem;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.folder-header:hover {
    background-color: #f5f5f5;
}

.folder-toggle {
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
    transition: transform 0.2s;
    color: #666;
}

.folder-toggle.expanded {
    transform: rotate(90deg);
}

.folder-icon {
    font-size: 20px;
    margin-right: 0.75rem;
}

.folder-name {
    flex: 1;
    font-weight: 500;
    font-size: 16px;
    color: #333;
    padding: 0.25rem 0.5rem;
}

.folder-name[contenteditable="true"] {
    background: #f0f0f0;
    border: 1px solid #4285f4;
    border-radius: 4px;
    outline: none;
}

.folder-count {
    color: #666;
    font-size: 14px;
    margin-left: 0.5rem;
}

.folder-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.folder-header:hover .folder-actions {
    opacity: 1;
}

.folder-content {
    padding: 0.5rem;
    animation: slideDown 0.3s ease-out;
}

/* Song Items */
.song-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin: 0.5rem;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: all 0.2s;
}

.song-item:hover {
    background: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.song-item.dragging {
    opacity: 0.5;
    cursor: move;
}

.song-checkbox {
    margin-right: 1rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.song-content {
    flex: 1;
    min-width: 0;
}

.song-title {
    font-weight: 500;
    color: #333;
    text-decoration: none;
    display: block;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-title:hover {
    color: #4285f4;
}

.song-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 13px;
    color: #666;
    flex-wrap: wrap;
}

.language-badge {
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.privacy-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.privacy-badge.public {
    background: #e8f5e9;
    color: #2e7d32;
}

.privacy-badge.private {
    background: #fce4ec;
    color: #c2185b;
}

.views-count {
    color: #666;
    font-size: 13px;
}

.updated-date {
    color: #999;
    font-size: 12px;
}

.song-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.song-item:hover .song-actions {
    opacity: 1;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #4285f4;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #3367d6;
}

.btn-secondary {
    background: white;
    color: #333;
    border: 1px solid #ddd;
}

.btn-secondary:hover:not(:disabled) {
    background: #f5f5f5;
    border-color: #ccc;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
}

.btn-icon {
    padding: 0.25rem;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s;
    border-radius: 4px;
}

.btn-icon:hover {
    transform: scale(1.1);
    background: rgba(0, 0, 0, 0.05);
}

/* Dialogs */
.custom-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.custom-dialog.show {
    display: flex;
}

.dialog-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease-out;
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.dialog-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.dialog-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.dialog-close:hover {
    background: #f5f5f5;
    color: #333;
}

.dialog-body {
    padding: 1.5rem;
}

.dialog-body p {
    margin: 0 0 1rem 0;
    color: #333;
}

.dialog-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

/* Form Elements */
.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

.input-hint {
    font-size: 13px;
    color: #666;
    margin-top: 0.5rem;
}

.warning-text {
    color: #dc3545;
    font-size: 14px;
    margin-top: 0.5rem;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: #333;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 10000;
    max-width: 400px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 2000px;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4285f4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State */
.no-results {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 2rem 0;
}

/* ===== MOBILE RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    /* Container adjustments */
    .profile-container {
        padding: 1rem;
    }
    
    /* Profile header mobile layout */
    .profile-header {
        flex-direction: column;
        text-align: center;
        padding-bottom: 1rem;
    }
    
    .profile-info {
        flex-direction: column;
    }
    
    .profile-avatar,
    .profile-avatar-placeholder {
        width: 60px;
        height: 60px;
    }
    
    .profile-avatar-placeholder {
        font-size: 1.5rem;
    }
    
    .profile-name {
        font-size: 1.25rem;
    }
    
    .profile-username {
        font-size: 0.9rem;
    }
    
    .profile-joined {
        font-size: 0.8rem;
    }
    
    .profile-stats {
        margin-top: 1rem;
        gap: 1.5rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    /* Management toolbar mobile layout */
    .management-toolbar {
        flex-direction: column;
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    .toolbar-left {
        width: 100%;
        justify-content: space-between;
    }
    
    .toolbar-search {
        width: 100%;
        max-width: none;
    }
    
    .search-input {
        padding: 0.4rem 0.75rem;
        font-size: 14px;
    }
    
    .selection-actions {
        width: 100%;
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .selection-count {
        font-size: 13px;
    }
    
    /* Button adjustments for mobile */
    .btn {
        padding: 0.4rem 0.75rem;
        font-size: 13px;
    }
    
    /* Show only icons on mobile toolbar buttons */
    .toolbar-left .btn .icon {
        margin-right: 0;
    }
    
    .toolbar-left .btn span:not(.icon) {
        display: none;
    }
    
    /* Folder adjustments */
    .folder-header {
        padding: 0.75rem;
    }
    
    .folder-toggle {
        width: 20px;
        font-size: 12px;
    }
    
    .folder-icon {
        font-size: 16px;
        margin-right: 0.5rem;
    }
    
    .folder-name {
        font-size: 15px;
        word-break: break-word;
    }
    
    .folder-count {
        font-size: 12px;
    }
    
    .folder-actions {
        opacity: 1; /* Always visible on mobile */
    }
    
    .folder-content {
        padding: 0.25rem;
    }
    
    /* Song item mobile optimizations */
    .song-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.5rem 0.75rem;
        margin: 0.25rem;
    }
    
    .song-item:hover {
        transform: none;
        box-shadow: none;
    }
    
    .song-checkbox {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .song-content {
        width: 100%;
    }
    
    /* Allow title to wrap on mobile */
    .song-title {
        white-space: normal;
        overflow: visible;
        text-overflow: initial;
        line-height: 1.4;
        margin-bottom: 0.5rem;
        word-break: break-word;
        font-size: 14px;
    }
    
    /* Stack meta information vertically */
    .song-meta {
        flex-direction: row;
        align-items: flex-start;
        gap: 0.25rem;
        width: 100%;
    }
    
    .song-meta > * {
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
    }
    
    .language-badge,
    .privacy-badge {
        font-size: 11px;
        padding: 1px 6px;
    }
    
    .views-count,
    .updated-date {
        font-size: 12px;
    }
    
    /* Song actions always visible on mobile */
    .song-actions {
        display: flex;
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
        opacity: 1;
        border-top: 1px solid #f0f0f0;
        padding-top: 0.5rem;
    }
    
    .btn-icon {
        font-size: 14px;
        padding: 0.25rem 0.5rem;
    }
    
    /* Dialog adjustments */
    .dialog-content {
        margin: 0.5rem;
        padding: 1rem;
    }
    
    .dialog-header h3 {
        font-size: 16px;
    }
    
    .dialog-body {
        padding: 1rem;
    }
    
    .dialog-footer {
        padding: 1rem;
        gap: 0.5rem;
        flex-direction: column;
    }
    
    .dialog-footer .btn {
        width: 100%;
    }
    
    /* Toast adjustments */
    .toast {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        font-size: 14px;
        padding: 0.75rem 1rem;
    }
    
    /* Ensure content is not cut off */
    .content-container {
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    .folders-tree {
        width: 100%;
    }
}

/* Very small screens (phones in portrait) */
@media (max-width: 480px) {
    .profile-container {
        padding: 0.5rem;
    }
    
    .profile-header {
        margin-bottom: 1rem;
    }
    
    .management-toolbar {
        padding: 0.5rem;
    }
    
    .folder-header {
        padding: 0.5rem;
    }
    
    .folder-name {
        font-size: 14px;
    }
    
    .song-item {
        padding: 0.4rem 0.5rem;
        margin: 0.2rem;
    }
    
    .song-title {
        font-size: 13px;
    }
    
    .song-meta {
        font-size: 11px;
    }
    
    .btn {
        padding: 0.3rem 0.5rem;
        font-size: 12px;
    }
    
    .btn-icon {
        font-size: 13px;
        padding: 0.2rem 0.4rem;
    }
}