/* ==========================================================================
   Основные стили для Didu Dashboard
   ========================================================================== */

/* Сброс стилей */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

button {
    border: none;
    background: none;
    cursor: pointer;
}

/* ==========================================================================
   Стили для страницы входа/регистрации
   ========================================================================== */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-form {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.login-form h1 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 28px;
    font-weight: 600;
}

.login-form .subtitle {
    text-align: center;
    margin-bottom: 30px;
    color: #666;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    border-radius: 4px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-primary {
    background-color: #667eea;
    color: #fff;
    border: 1px solid #667eea;
}

.btn-primary:hover {
    background-color: #5a6fd8;
    border-color: #5a6fd8;
}

.btn-block {
    width: 100%;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}

.login-footer a {
    color: #667eea;
    font-weight: 500;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* Алерты */
.alert {
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 14px;
}

.alert-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

/* ==========================================================================
   Основной интерфейс дашборда
   ========================================================================== */

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Верхняя панель */
.top-header {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    height: 60px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 20px;
}

.header-left .app-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.header-right {
    position: relative;
}

.user-menu {
    position: relative;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.user-menu-toggle:hover {
    background-color: #f5f5f5;
}

.username {
    font-weight: 500;
    color: #333;
}

.user-role {
    font-size: 12px;
    color: #666;
}

.dropdown-arrow {
    font-size: 10px;
    color: #999;
    transition: transform 0.2s ease;
}

.user-menu-toggle.active .dropdown-arrow {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1001;
    display: none;
}

.user-menu-dropdown.show {
    display: block;
}

.user-menu-dropdown ul {
    padding: 8px 0;
}

.user-menu-dropdown li {
    padding: 0;
}

.user-menu-dropdown li.divider {
    height: 1px;
    background: #e5e5e5;
    margin: 8px 0;
}

.user-menu-dropdown a {
    display: block;
    padding: 8px 16px;
    color: #333;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.user-menu-dropdown a:hover {
    background-color: #f5f5f5;
}

/* Основной контент */
.main-content {
    display: flex;
    margin-top: 60px;
    min-height: calc(100vh - 60px);
}

/* Левая панель */
.sidebar {
    width: 250px;
    background: #f8f9fa;
    border-right: 1px solid #e5e5e5;
    padding: 20px 0;
    position: fixed;
    left: 0;
    top: 60px;
    bottom: 0;
    overflow-y: auto;
}

.sidebar-nav {
    width: 100%;
}

.nav-menu {
    padding: 0;
}

.nav-item {
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background-color: #e9ecef;
    color: #007bff;
}

.nav-item.active > .nav-link {
    background-color: #007bff;
    color: #fff;
}

.nav-icon {
    margin-right: 12px;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.nav-text {
    flex: 1;
}

.nav-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.nav-toggle.expanded .nav-arrow {
    transform: rotate(180deg);
}

.nav-submenu {
    display: none;
    background: #e9ecef;
}

.nav-submenu.show {
    display: block;
}

.nav-subitem {
    margin: 0;
}

.nav-sublink {
    display: flex;
    align-items: center;
    padding: 8px 20px 8px 52px;
    color: #555;
    font-size: 13px;
    transition: all 0.2s ease;
}

.nav-sublink:hover {
    background-color: #dee2e6;
    color: #007bff;
}

.nav-subitem.active .nav-sublink {
    background-color: #007bff;
    color: #fff;
}

/* Область контента */
.content-area {
    flex: 1;
    margin-left: 250px;
    padding: 20px;
}

.page-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e5e5;
}

.page-title {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.page-description {
    color: #666;
    font-size: 16px;
}

/* Карточки */
.card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    margin-bottom: 20px;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid #e5e5e5;
    background: #f8f9fa;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 20px;
    border-top: 1px solid #e5e5e5;
    background: #f8f9fa;
}

/* Таблицы */
.table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.table tr:hover {
    background-color: #f5f5f5;
}

/* Кнопки в таблицах */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: #fff;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.btn-success {
    background-color: #28a745;
    border-color: #28a745;
    color: #fff;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

/* Формы */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-col {
    flex: 1;
}

.form-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
    text-align: right;
}

/* Статусы */
.status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background-color: #d4edda;
    color: #155724;
}

.status-inactive {
    background-color: #f8d7da;
    color: #721c24;
}

/* Заглушки */
.placeholder-content {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.placeholder-content h3 {
    margin-bottom: 15px;
    color: #333;
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.3;
}

/* Подвал */
.app-footer {
    background: #f8f9fa;
    border-top: 1px solid #e5e5e5;
    padding: 20px 0;
    margin-top: auto;
}

.footer-content {
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .content-area {
        margin-left: 0;
    }

    .main-content.sidebar-open .sidebar {
        transform: translateX(0);
    }
}

/* Утилиты */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #666; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none; }