:root {
    --primary-color: #0088cc;
    --primary-dark: #006699;
    --secondary-color: #f0f0f0;
    --text-color: #333333;
    --text-light: #666666;
    --success-color: #34c759;
    --warning-color: #ff9500;
    --danger-color: #ff3b30;
    --card-bg: #ffffff;
    --bg-color: #f8f9fa;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -webkit-touch-callout: none;
}

html, body {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    touch-action: pan-y;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    padding: 0;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Popup стили */
.popup-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 15px 25px;
    border-radius: var(--radius);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    font-weight: 500;
    text-align: center;
    min-width: 300px;
    max-width: 90%;
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.popup-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.popup-notification.hide {
    transform: translateX(-50%) translateY(-100px);
    opacity: 0;
}

.popup-notification i {
    font-size: 20px;
    flex-shrink: 0;
}

.popup-notification.success {
    background: linear-gradient(135deg, #34c759, #2aa44f);
}

.popup-notification.error {
    background: linear-gradient(135deg, #ff3b30, #d32f2f);
}

.popup-notification.warning {
    background: linear-gradient(135deg, #ff9500, #e68900);
}

.popup-notification.info {
    background: linear-gradient(135deg, #0088cc, #006699);
}

/* Загрузочный экран - всегда видим сначала */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0088cc, #006699);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-text {
    color: white;
    font-size: 18px;
    font-weight: 600;
    margin-top: 15px;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #0088cc, #006699);
    color: white;
    padding: 10px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* Левая часть с кнопкой и заголовком */
.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0; /* Позволяет содержимому сжиматься */
    flex: 1;
}

/* Кнопка назад */
.back-button {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.back-button:hover {
    opacity: 0.8;
}

/* Заголовок с иконкой */
.page-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0; /* Позволяет тексту ужиматься */
    overflow: hidden;
}

.page-title i {
    font-size: 20px;
    flex-shrink: 0;
}

.page-title h1 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Блок информации о пользователе */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    border: 2px solid rgba(255,255,255,0.5);
    flex-shrink: 0;
}

.user-avatar::before {
    content: attr(data-initials);
    font-size: 14px;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
}

.user-role {
    font-size: 12px;
    opacity: 0.8;
    line-height: 1.2;
    white-space: nowrap;
}

/* Footer */
.footer {
    margin-top: auto;
    padding: 20px;
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    border-top: 1px solid #eee;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
}

.footer-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 13px;
}

.footer-link:hover {
    text-decoration: underline;
}

/* Основной контент - изначально скрыт */
#main-content {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 15px;
    }

    .header-content {
        flex-wrap: nowrap;
    }
    
    .logo h1 {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .user-info {
        width: 100%;
        justify-content: flex-start;
        padding-top: 8px;
        border-top: 1px solid rgba(255,255,255,0.2);
    }
    
    .back-button {
        order: 1;
    }
    
    .page-title {
        order: 2;
        flex: 1; /* Занимает оставшееся пространство */
    }

    .page-title h1 {
        font-size: 16px;
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}