/* Profile page specific styles to make it fill 90% of viewport width */
#profile-container .profile-section {
    width: 100%;
    max-width: 100%;
    margin: 0 0 10px 0;
    padding: var(--spacing);
    display: flex;
    flex-direction: column;
    min-height: 100px; /* Reduced minimum height */
    flex-shrink: 1; /* Prevent from shrinking */
    position: relative;
    z-index: 1;
    order: 1; /* First in flex layout */
}

#profile-container .content-wrapper {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing);
}

/* Header styling for the profile page */
#profile-container .header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 5px;
   /* background-color: var(--background-color);*/
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#profile-container .ranking-badge {
    position: absolute;
    right: 15px;
    background-color: var(--text-color);
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: bold;
    color: var(--white-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Profile details and table styling */
#profile-container .profile-details {
    width: 100%;
    max-width: 800px; /* Limit maximum width for better readability */
    margin: 0 auto;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

/* Version footer styling */
#profile-container .version-footer {
    width: 100%;
    max-width: 800px;
    margin: 5px auto 0;
    padding: 10px;
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    position: relative;
    z-index: 2; /* Higher z-index to ensure it appears on top */
    order: 3; /* Explicit order in flex layout */
}

.version-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.version-text {
    font-size: 12px;
    color: var(--primary-color);
    font-weight: 500;
    opacity: 0.8;
}

#app-version {
    font-weight: 600;
    color: var(--primary-color);
}

/* Force Update Button Styling */
.force-update-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: var(--white-color);
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.force-update-btn:hover {
    background-color: var(--primaryDark-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.force-update-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.force-update-btn i {
    font-size: 14px;
}

.force-update-btn span {
    font-size: 13px;
}

/* Mobile responsive adjustments for force update button */
@media (max-width: 480px) {
    .force-update-btn {
        padding: 6px 12px;
        font-size: 12px;
        gap: 6px;
    }
    
    .force-update-btn i {
        font-size: 12px;
    }
    
    .force-update-btn span {
        font-size: 12px;
    }
}

#profile-container .profile-table {
    width: 100%;
    background-color: var(--background-color);
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border-collapse: collapse;
}

#profile-container .profile-table th {
    text-align: left;
    padding: 12px 15px;
    background-color: var(--background-color);
    color: var(--text-color);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 14px;
}

#profile-container .profile-table .section-header {
    text-align: left;
    background-color: var(--primary-color);
    color: var(--white-color);
}

#profile-container .profile-table td {
    padding: 5px 15px;
    border-bottom: 1px solid #f0f0f0;
}

#profile-container .profile-table .label {
    font-weight: bold;
    color: #666;
    width: 35%;
}

#profile-container .profile-table .value {
    color: #333;
}

#profile-container .profile-table tr:last-child td {
    border-bottom: none;
}

/* Updated alternating row colors */
#profile-container .profile-table tr:nth-child(odd) {
    background-color: var(--white-color);
}

#profile-container .profile-table tr:nth-child(even) {
    background-color:var(--gray-color);
}

/* Ensure section headers maintain their color */
#profile-container .profile-table tr.section-header {
    background-color: var(--primary-color) !important;
}

/* Add hover effect for better interactivity */
#profile-container .profile-table tr:hover {
    background-color: #f0f0f0;
    transition: background-color 0.2s ease;
}

/* Ensure hover effect doesn't override section headers */
#profile-container .profile-table tr.section-header:hover {
    background-color: var(--primary-color) !important;
}

/* Avatar specific styles for profile page */
#profile-container .profile-summary {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    width: 100%;
    height: auto;
    position: relative;
    z-index: 1;
    clear: both; /* Ensure no float issues */
}

#profile-container .avatar-container {
    width: 120px;
    height: 120px;
    position: relative;
    margin: 0 auto;
    border-radius: 60px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1;
}

#profile-container .avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 3px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Add styling for avatar-overlay */
#profile-container .avatar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    color: white;
    border-radius: 60px;
}

#profile-container .avatar-container:hover .avatar-overlay {
    opacity: 1;
}

#profile-container .avatar-overlay i {
    font-size: 24px;
    margin-bottom: 5px;
}

#profile-container .avatar-overlay span {
    font-size: 14px;
    font-weight: bold;
}

/* Delete account container styling */
#profile-container .account-actions {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

#profile-container .delete-account-container {
    width: 45px;
    height: 45px;
    background-color: #f5f5f5;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

#profile-container .delete-account-container i {
    color: #f44336;
    font-size: 20px;
    transition: all 0.2s ease;
}

#profile-container .delete-account-container:hover {
    background-color: #ffebee;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

#profile-container .delete-account-container:hover i {
    color: #d32f2f;
}

#profile-container .action-overlay {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

#profile-container .delete-account-container:hover .action-overlay {
    opacity: 1;
}

/* Modal styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background-color: var(--background-color);
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: scale(1);
    transition: transform 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    color: white;
    font-size: 18px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s ease;
}

.close-btn:hover {
    color: var(--error-color);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 15px;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid #eee;
}

.file-input-container {
    text-align: center;
    margin-bottom: 20px;
}

.file-input-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.file-input-label:hover {
    background-color: var(--primaryDark-color);
}

.file-name {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-color);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primaryDark-color);
}

.btn-primary:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.error-message {
    color: var(--error-color);
    font-size: 12px;
    margin-top: 10px;
    padding: 8px;
    background-color: #ffebee;
    border-radius: 4px;
}

.avatar-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.avatar-modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.avatar-modal {
    background-color: var(--background-color);
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: scale(1);
    transition: transform 0.3s ease;
}

.avatar-modal-overlay.hidden .avatar-modal {
    transform: scale(0.9);
}

.avatar-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.avatar-modal-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 18px;
}

.close-avatar-modal {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s ease;
}

.close-avatar-modal:hover {
    color: var(--error-color);
}

.avatar-modal-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.avatar-preview-container {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    border-radius: 60px;
    overflow: hidden;
    border: 3px solid var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#avatar-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-input-container {
    margin-bottom: 20px;
    text-align: center;
}

.file-input-label {
    display: inline-block;
    padding: 10px 15px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.file-input-label:hover {
    background-color: #3d8b40;
}

.file-input {
    display: none;
}

.file-requirements {
    margin-top: 10px;
    font-size: 12px;
    color: #666;
}

.file-name {
    margin-top: 5px;
    font-size: 14px;
    color: #333;
    font-weight: bold;
}

.avatar-error {
    color: var(--error-color);
    font-size: 14px;
    text-align: center;
    margin-top: 10px;
    padding: 8px;
    background-color: #ffebee;
    border-radius: 4px;
}

.avatar-error.hidden {
    display: none;
}

.avatar-modal-footer {
    padding: 15px;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid #eee;
}

.upload-avatar-btn {
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.upload-avatar-btn:hover:not(:disabled) {
    background-color: #3d8b40;
}

.upload-avatar-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Delete modal specific styles */
.delete-warning {
    text-align: center;
}

.warning-icon {
    font-size: 48px;
    color: var(--warning-color);
    margin-bottom: 15px;
}

.delete-warning h4 {
    margin-bottom: 15px;
    color: var(--error-color);
}

.delete-warning p {
    margin-bottom: 15px;
    color: #333;
}

.delete-warning ul {
    text-align: left;
    margin: 15px 0;
    padding-left: 20px;
}

.delete-warning li {
    margin-bottom: 5px;
}

.delete-modal-footer {
    justify-content: space-between;
}

.cancel-delete-btn {
    padding: 10px 20px;
    background-color: #f5f5f5;
    color: #333;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.cancel-delete-btn:hover {
    background-color: #e0e0e0;
}

.confirm-delete-btn {
    padding: 10px 20px;
    background-color: var(--error-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.confirm-delete-btn:hover {
    background-color: #d32f2f;
}

.confirm-delete-btn:disabled {
    background-color: #ffcdd2;
    cursor: not-allowed;
}

/* Media query adjustments */
@media (max-width: 768px) {
    #profile-container .profile-section {
        padding: calc(var(--spacing) / 2);
    }

    #profile-container .content-wrapper {
        padding: calc(var(--spacing) / 2);
    }

    #profile-container .profile-details {
        max-width: 100%;
    }
    
    #profile-container .profile-table {
        width: 99%;
        max-width: 99%;
    }
    
    #profile-container .profile-table td,
    #profile-container .profile-table th {
        padding: 18px 10px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    #profile-container .profile-section {
        padding: calc(var(--spacing) / 2);
    }

    #profile-container .profile-table {
        margin: 0;
        border-radius: 4px;
    }
    
    #profile-container .profile-table {
        width: 90%;
        max-width: 90%;
    }
    
    #profile-container .profile-table td,
    #profile-container .profile-table th {
        padding: 6px 8px;
        font-size: 13px;
    }
    
    #profile-container .profile-table .label {
        width: 40%;
    }
    
    #profile-container .avatar-container {
        width: 100px;
        height: 100px;
    }
    
    #profile-container .account-actions {
        right: 10px;
    }
    
    #profile-container .delete-account-container {
        width: 40px;
        height: 40px;
    }
    
    .avatar-modal {
        width: 95%;
    }
    
    .avatar-modal-header,
    .avatar-modal-content,
    .avatar-modal-footer {
        padding: 12px;
    }
    
    .avatar-preview-container {
        width: 100px;
        height: 100px;
    }
    
    #profile-container .header {
        padding: 10px;
    }
    
    #profile-container .back-button {
        left: 10px;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    #profile-container .back-button i {
        font-size: 18px;
    }
    
    #profile-container .ranking-badge {
        right: 10px;
        padding: 4px 8px;
        font-size: 12px;
    }
}

/* Ensure this only affects the profile page */
#profile-container {
    width: 100%;
    max-width: 100%;
    position: absolute; /* Keep absolute for proper stacking */
    overflow-y: auto; /* Allow scrolling */
    display: flex;
    flex-direction: column;
}

/* Ensure the header stays at the top */
#profile-container .header.subpage {
    position: relative;
    flex-shrink: 0; /* Prevent header from shrinking */
    z-index: 10;
}

/* Adjust inner container positioning to flow after header */
#profile-container > .container {
    position: relative; /* Use relative positioning for inner container */
    flex: 1; /* Take remaining space */
    height: auto; /* Let height be determined by content */
    overflow-y: visible; /* Allow content to overflow if needed */
    display: flex;
    flex-direction: column;
    gap: 15px; /* Reduced gap between profile section and version footer */
    padding-bottom: 20px; /* Reduced bottom padding */
    align-items: stretch; /* Ensure children take full width */
}

/* Notification Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin-right: 10px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: var(--background-color);
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-color, #2196F3);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

.notification-status {
    font-size: 14px;
    color: var(--text-color, #333);
    vertical-align: middle;
}

.notification-status.connected {
    color: var(--primary-color);
}

.notification-status.disconnected {
    color: #f44336;
}

.notification-status.connecting {
    color: #FFC107;
}

/* Edit Profile Modal Overlay Styles (now within profile container) */
#edit-profile-modal.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* semi-transparent background */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999; /* ensure it is above all other content in profile */
}

#edit-profile-modal.hidden {
    display: none !important;
}

#edit-profile-modal .modal-content {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.18);
    padding: 32px 24px 24px 24px;
    min-width: 320px;
    max-width: 90vw;
    width: 100%;
    max-width: 400px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

#edit-profile-modal h2 {
    margin-top: 0;
    margin-bottom: 18px;
    font-size: 1.4rem;
    text-align: center;
}

#edit-profile-modal .form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

#edit-profile-modal label {
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: #333;
}

#edit-profile-modal input[type="text"] {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
}

#edit-profile-modal .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

#edit-profile-modal button {
    padding: 8px 18px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    background: var(--primary-color, #1976d2);
    color: #fff;
    transition: background 0.2s;
}

#edit-profile-modal #cancel-edit-profile {
    background: #f5f5f5;
    color: #333;
}

#edit-profile-modal #cancel-edit-profile:hover {
    background: #e0e0e0;
}

#edit-profile-modal #save-edit-profile:hover {
    background: #125ea2;
}

#edit-profile-modal .error-message {
    color: #d32f2f;
    margin-top: 10px;
    font-size: 0.95rem;
    text-align: center;
} 