/* CSS Variables for Safe Areas */
:root {
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Settings Container */
.settings-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: 0;
    background: #E5E5E5;
    padding-top: var(--safe-area-top);
    padding-bottom: var(--safe-area-bottom);
}

/* Header */
.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: #E5E5E5;
    position: sticky;
    top: 0;
    z-index: 100;
    padding-top: calc(20px + var(--safe-area-top));
}

.back-btn {
    width: 44px;
    height: 44px;
    background: #CECECE;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    text-decoration: none;
    flex-shrink: 0;
}

.back-btn:hover {
    background: #b8b8b8;
    transform: scale(1.05);
}

.back-btn img {
    width: 20px;
    height: 20px;
    opacity: 0.8;
}

.page-title {
    font-family: 'Unbounded', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: #282828;
    margin: 0;
    text-align: center;
    flex: 1;
}

.header-placeholder {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

/* Main Content */
.settings-main {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Settings Sections */
.settings-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.section-title {
    font-family: 'Unbounded', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #282828;
    margin: 0;
    padding: 0 10px;
}

/* User Info Card */
.user-info-card {
    background: #F8F8F8;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

.user-avatar {
    width: 60px;
    height: 60px;
    background: #CECECE;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-avatar img {
    width: 30px;
    height: 30px;
    opacity: 0.7;
}

.user-details {
    flex: 1;
}

.user-details h2 {
    font-family: 'Unbounded', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: #282828;
    margin: 0 0 5px 0;
}

.user-details p {
    font-family: 'Unbounded', sans-serif;
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

.user-email {
    font-size: 0.8rem !important;
    color: #888 !important;
    margin-top: 2px !important;
}

.edit-profile-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: #CECECE;
    border: none;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.edit-profile-btn:hover {
    background: #b8b8b8;
    transform: scale(1.1);
}

.edit-profile-btn img {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

/* Settings List */
.settings-list {
    background: #FFFFFF;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Setting Item */
.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(206, 206, 206, 0.5);
    background: #FFFFFF;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    border: none;
    width: 100%;
    cursor: pointer;
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item.clickable:hover {
    background: #F5F5F5;
}

.setting-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.setting-title {
    font-family: 'Unbounded', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: #282828;
    margin-bottom: 2px;
}

.setting-description {
    font-family: 'Unbounded', sans-serif;
    font-size: 0.75rem;
    color: #666;
}

/* Icons */
.setting-icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #CECECE;
    transition: .3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.toggle-input:checked + .toggle-slider {
    background-color: #5E7B00;
}

.toggle-input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Logout Button */
.logout-btn {
    width: 100%;
    background: #FFFFFF;
    border: 2px solid #e74c3c;
    border-radius: 15px;
    padding: 16px 20px;
    font-family: 'Unbounded', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #e74c3c;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.logout-btn:hover {
    background: #e74c3c;
    color: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.logout-btn:active {
    transform: translateY(0);
}

.logout-btn img {
    width: 20px;
    height: 20px;
}

/* App Info */
.app-info {
    text-align: center;
    margin-top: 20px;
    padding: 20px;
}

.app-version {
    font-family: 'Unbounded', sans-serif;
    font-size: 0.9rem;
    color: #282828;
    margin-bottom: 5px;
}

.app-copyright {
    font-family: 'Unbounded', sans-serif;
    font-size: 0.8rem;
    color: #666;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: #FFFFFF;
    border-radius: 20px;
    padding: 25px;
    max-width: 450px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalAppear 0.3s ease-out;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #E5E5E5;
}

.modal-header h3 {
    font-family: 'Unbounded', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: #282828;
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #282828;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.close-modal:hover {
    background-color: #f0f0f0;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.modal-button {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-family: 'Unbounded', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.modal-button.primary {
    background: #5E7B00;
    color: white;
}

.modal-button.primary:hover {
    background: #4a6100;
    transform: translateY(-1px);
}

.modal-button.secondary {
    background: #CECECE;
    color: #282828;
}

.modal-button.secondary:hover {
    background: #b8b8b8;
    transform: translateY(-1px);
}

.modal-button.danger {
    background: #e74c3c;
    color: white;
}

.modal-button.danger:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

/* Password Requirements */
.password-requirements {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    border-left: 4px solid #5E7B00;
}

.password-requirements p {
    font-family: 'Unbounded', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: #282828;
    margin: 0 0 8px 0;
}

.password-requirements ul {
    margin: 0;
    padding-left: 20px;
}

.password-requirements li {
    font-family: 'Unbounded', sans-serif;
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 3px;
}

/* Info Sections */
.info-section {
    padding: 15px;
    background: #F8F8F8;
    border-radius: 12px;
}

.info-section h4 {
    font-family: 'Unbounded', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #282828;
    margin: 0 0 12px 0;
}

.info-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
}

.info-label {
    font-family: 'Unbounded', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    color: #666;
}

.info-value {
    font-family: 'Unbounded', sans-serif;
    font-size: 0.8rem;
    color: #282828;
    text-align: right;
    max-width: 60%;
    word-break: break-all;
}

/* Textarea Container */
.textarea-container {
    align-items: flex-start;
}

.textarea-container img {
    margin-top: 3px;
}

/* Responsive Design */
@media (max-width: 480px) {
    .settings-header {
        padding: 15px;
        padding-top: calc(15px + var(--safe-area-top));
    }
    
    .settings-main {
        padding: 0 15px 15px;
        gap: 20px;
    }
    
    .user-info-card {
        padding: 15px;
    }
    
    .setting-item {
        padding: 12px 15px;
    }
    
    .modal {
        padding: 15px;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-button {
        width: 100%;
    }
}

@media (max-width: 360px) {
    .user-avatar {
        width: 50px;
        height: 50px;
    }
    
    .user-avatar img {
        width: 25px;
        height: 25px;
    }
    
    .user-details h2 {
        font-size: 1.1rem;
    }
}

/* Scrollbar styling */
.settings-main::-webkit-scrollbar {
    width: 4px;
}

.settings-main::-webkit-scrollbar-track {
    background: transparent;
}

.settings-main::-webkit-scrollbar-thumb {
    background: #CECECE;
    border-radius: 2px;
}

.settings-main::-webkit-scrollbar-thumb:hover {
    background: #b8b8b8;
}

.modal-content::-webkit-scrollbar {
    width: 4px;
}

.modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #CECECE;
    border-radius: 2px;
}

/* Safe area support */
@supports (padding: max(0px)) {
    .settings-container {
        padding-top: max(0px, var(--safe-area-top));
        padding-bottom: max(0px, var(--safe-area-bottom));
    }
    
    .settings-header {
        padding-top: max(20px, calc(20px + var(--safe-area-top)));
    }
}