/* Основные стили карточек и секций */
.card {
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    background: none;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-dark);
    display: flex;
    align-items: center;
}

.card-body {
    padding: 1.5rem;
}

.form-actions {
    padding-top: 1rem;
    margin-top: 2rem;
}

.section-subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-dark);
    position: relative;
    padding-bottom: 0.5rem;
}

.section-subtitle::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px;
}

/* Профиль заголовок */
.profile-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.profile-subtitle {
    color: var(--secondary-text-color);
    font-size: 1.1rem;
}

/* Боковая панель профиля */
.profile-sidebar {
    position: sticky;
    top: 100px;
}

.profile-user-info {
    background: var(--profile-bg-gradient);
    color: var(--text-light);
    border-radius: 16px 16px 0 0;
}

.profile-avatar-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: var(--bs-card-border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: bold;
    color: var(--text-light);
    border: 4px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-edit-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--secondary-color);
    border: 2px solid white;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.avatar-edit-btn:hover {
    background: var(--button-hover);
    transform: scale(1.1);
}

.profile-role {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 4px 15px;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.profile-id {
    font-size: 0.875rem;
    opacity: 0.7;
    margin-top: 0.5rem;
}

.profile-nav {
    padding: 1rem 0;
}

.profile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.profile-nav-item {
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    color: var(--text-dark);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border-left: 3px solid transparent;
}

.profile-nav-item i {
    margin-right: 1rem;
    width: 20px;
    text-align: center;
    color: var(--secondary-text-color);
    transition: all 0.3s ease;
}

.profile-nav-item:hover {
    background-color: var(--profile-item-hover);
    color: var(--primary-color);
}

.profile-nav-item:hover i {
    color: var(--primary-color);
}

.profile-nav-item.active {
    background-color: var(--profile-item-hover);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
}

.profile-nav-item.active i {
    color: var(--primary-color);
}

.profile-sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Профиль секции */
.profile-section {
    display: none;
}

.profile-section.active {
    display: block;
}

/* Формы и поля ввода */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: block;
    color: var(--text-dark);
}

.form-control {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem var(--profile-input-focus);
}

.form-select {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    background-position: right 1rem center;
}

.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem var(--profile-input-focus);
}

.password-input-group {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--secondary-text-color);
    cursor: pointer;
}

.password-strength {
    margin-top: 0.5rem;
}

.password-strength .progress {
    height: 6px;
    border-radius: 3px;
    background-color: var(--profile-progress-bg);
}

.password-feedback {
    color: var(--secondary-text-color);
    font-style: italic;
}

/* Кнопки */
.btn {
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--button-hover);
    border-color: var(--button-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 139, 87, 0.25);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 139, 87, 0.25);
}

.btn-outline-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 82, 82, 0.25);
}

/* Переключатели */
.form-check-input {
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-switch .form-check-input:focus {
    box-shadow: 0 0 0 0.25rem var(--profile-input-focus);
}

/* Настройки безопасности */
.security-section, .notification-section, .appearance-section, .api-section, .advanced-section {
    padding-bottom: 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.security-section:last-child, .notification-section:last-child, 
.appearance-section:last-child, .api-section:last-child, .advanced-section:last-child {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: none;
}

.session-list {
    margin-top: 1rem;
}

.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.session-item:hover {
    background-color: var(--profile-card-hover);
    border-color: var(--primary-color);
}

.session-info {
    display: flex;
    align-items: center;
}

.session-info i {
    font-size: 1.5rem;
    margin-right: 1rem;
    color: var(--primary-color);
}

.session-details {
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    margin-top: 0.25rem;
}

.session-details span {
    margin-right: 1rem;
}

/* Настройки уведомлений */
.notification-options {
    padding-left: 2rem;
}

/* Настройки внешнего вида */
.theme-selector, .color-scheme-selector {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.theme-option, .color-option {
    flex: 1;
    min-width: 120px;
}

.theme-option input, .color-option input {
    display: none;
}

.theme-card, .color-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-card:hover, .color-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-sm);
}

.theme-option input:checked + .theme-card,
.color-option input:checked + .color-card {
    border-color: var(--primary-color);
    background-color: var(--profile-item-hover);
}

.theme-preview, .color-preview {
    height: 100px;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
}

.light-theme-preview {
    background: linear-gradient(to bottom, #FFFFFF 0%, #F8F9FD 100%);
}

.dark-theme-preview {
    background: linear-gradient(to bottom, #1a2c38 0%, #293742 100%);
}

.system-theme-preview {
    background: linear-gradient(to right, #FFFFFF 0%, #FFFFFF 50%, #1a2c38 50%, #1a2c38 100%);
}

.default-color {
    background: var(--profile-bg-gradient);
}

.blue-color {
    background: linear-gradient(135deg, #4a90e2 0%, #5ca8ff 100%);
}

.purple-color {
    background: linear-gradient(135deg, #7b68ee 0%, #9b59b6 100%);
}

.orange-color {
    background: linear-gradient(135deg, #ff7f50 0%, #ffa07a 100%);
}

/* История активности */
.activity-filters {
    background-color: rgba(248, 249, 253, 0.6);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.activity-timeline {
    margin-top: 2rem;
}

.activity-day {
    margin-bottom: 2rem;
}

.activity-date {
    font-weight: 600;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.activity-item {
    display: flex;
    margin-bottom: 1.5rem;
    position: relative;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    color: white;
}

.login-icon {
    background-color: var(--primary-color);
}

.user-icon {
    background-color: var(--info);
}

.settings-icon {
    background-color: var(--warning-color);
}

.content-icon {
    background-color: var(--accent-color);
}

.activity-content {
    flex: 1;
    background-color: #fff;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.activity-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.activity-title {
    font-weight: 600;
}

.activity-time {
    color: var(--secondary-text-color);
    font-size: 0.85rem;
}

.activity-details {
    font-size: 0.95rem;
}

.load-more-container {
    margin-top: 2rem;
}

/* API настройки */
.api-key-item, .webhook-item {
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.api-key-item:hover, .webhook-item:hover {
    background-color: var(--profile-card-hover);
    border-color: var(--primary-color);
}

.api-key-value {
    display: flex;
    align-items: center;
    margin: 0.5rem 0;
}

.api-key-value input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.api-key-value button {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    height: 100%;
    padding: 0.75rem 1rem;
}

.api-key-meta, .webhook-meta {
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    margin-top: 0.5rem;
}

.api-key-meta span, .webhook-meta span {
    margin-right: 1rem;
}

.webhook-url {
    word-break: break-all;
    font-family: monospace;
    padding: 0.5rem;
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    margin: 0.5rem 0;
}

/* Расширенные настройки */
.danger-zone {
    color: var(--error-color);
}

/* Модальное окно аватара */
.avatar-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.avatar-upload-label:hover {
    border-color: var(--primary-color);
    background-color: var(--profile-card-hover);
}

.avatar-upload-label i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.avatar-upload-input {
    display: none;
}

.avatar-preview-container {
    text-align: center;
}

#avatarPreview {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
}

.avatar-initials-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 54px;
    font-weight: bold;
    color: white;
    margin: 0 auto;
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.icon-option {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background-color: #f0f0f0;
    transition: all 0.3s ease;
    font-size: 1.5rem;
}

.icon-option:hover, .icon-option.active {
    background-color: var(--primary-color);
    color: white;
}

/* Адаптивность */
@media (max-width: 991px) {
    .profile-sidebar {
        position: static;
        margin-bottom: 2rem;
    }
    
    .profile-nav-list {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .profile-nav-item {
        flex: 1 0 auto;
        text-align: center;
        padding: 0.75rem;
        border-left: none;
        border-bottom: 3px solid transparent;
    }
    
    .profile-nav-item i {
        margin-right: 0.5rem;
    }
    
    .profile-nav-item.active {
        border-left: none;
        border-bottom: 3px solid var(--primary-color);
    }
}

@media (max-width: 767px) {
    .profile-header {
        text-align: center;
    }
    
    .profile-header .col-md-4 {
        margin-top: 1rem;
    }
    
    .theme-selector, .color-scheme-selector {
        flex-direction: column;
    }
    
    .session-item {
        flex-direction: column;
    }
    
    .session-actions {
        margin-top: 1rem;
    }
    
    .api-key-item, .webhook-item {
        flex-direction: column;
    }
    
    .api-key-actions, .webhook-actions {
        margin-top: 1rem;
    }
}

/* Темная тема */
[data-theme="dark"] {
    --bg-light: var(--bg-dark);
    --text-dark: var(--text-light);
    --border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .card {
    background-color: rgba(26, 44, 56, 0.8);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

[data-theme="dark"] .activity-content {
    background-color: rgba(26, 44, 56, 0.8);
}

[data-theme="dark"] .activity-filters {
    background-color: rgba(26, 44, 56, 0.5);
}

[data-theme="dark"] .avatar-upload-label {
    background-color: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .icon-option {
    background-color: rgba(255, 255, 255, 0.1);
}


.modal-exit.active {
    display: flex;
    opacity: 1;
    animation: showModal 0.3s;
}
.modal-exit {
    display: none;
    width: 100%;
    height: 100%;
    background-color: var(--bs-border-color-translucent);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    display: none;
    animation: hideModal 0.3s;
}

.close-modal-ex {
    cursor: pointer;
}

.modal-dialog {
    padding: 20px;
    max-width: 400px;
    height: auto;
    border-radius: 10px;
    background-color: #fff;
}
.modal-footer {
    gap: 10px;
}

@keyframes showModal {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes hideModal {
    0% {
        opacity: 1;
        display: flex;
    }
    90% {
        opacity: 0;
        display: flex;
    }
    100% {
        opacity: 0;
        display: none;
    }
}