/* style.css */

/* --- Глобальные переменные и сброс стилей --- */
:root {
    --background-color: #f5f5f7;
    --card-background: #ffffff;
    --text-color: #1d1d1f;
    --secondary-text-color: #86868b;
    --accent-color: #007aff;
    --border-color: #d2d2d7;
    --success-color: #34c759;
    --font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Общие стили для страниц входа и регистрации --- */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.auth-card {
    background: var(--card-background);
    padding: 2.5rem 3rem;
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 480px;
    text-align: center;
}

.auth-card h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.auth-card p {
    color: var(--secondary-text-color);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.form-group {
    text-align: left;
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.input-field, .textarea-field {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    font-family: var(--font-family);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-field:focus, .textarea-field:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

.textarea-field {
    min-height: 120px;
    resize: vertical;
}

.drag-drop-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.drag-drop-area:hover {
    border-color: var(--accent-color);
    background-color: #fbfbfb;
}

.drag-drop-area p {
    margin: 0;
    color: var(--secondary-text-color);
}

.btn {
    display: inline-block;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background-color: var(--accent-color);
    color: white;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
    text-align: center;
}
.auth-card .btn {
    width: 100%;
}

.btn:hover {
    background-color: #0070e0;
}

.auth-link {
    display: block;
    margin-top: 1.5rem;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

/* Стили для flash-сообщений */
.alert {
    padding: 12px 16px;
    margin-bottom: 1rem;
    border-radius: 12px;
    text-align: left;
    font-size: 0.95rem;
}
.alert-danger {
    color: #a3243a;
    background-color: #fce8eb;
}
.alert-warning {
    color: #8c5d00;
    background-color: #fff6e0;
}
.alert-success {
    color: #00632b;
    background-color: #e3f5e9;
}


/* --- Стили для личного кабинета дизайнера (dashboard.html) --- */
.app-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    grid-template-rows: 60px 1fr;
    height: 100vh;
    overflow: hidden; /* Предотвращаем прокрутку всего layout */
}

.app-header {
    grid-column: 1 / 3;
    background: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.app-header .logo {
    font-size: 1.5rem;
    font-weight: 600;
}

.app-header .user-profile {
    display: flex;
    align-items: center;
    gap: 16px;
}
.app-header .user-profile a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #e0e0e0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
}

.sidebar {
    background: var(--card-background);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Добавляем прокрутку для сайдбара */
}

.sidebar-search {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-search input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: none;
    background-color: var(--background-color);
}
.sidebar-search input:focus {
    outline: none;
}

.chat-list {
    list-style: none;
    overflow-y: auto;
    flex-grow: 1;
}

.chat-item {
    display: flex;
    padding: 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}
.chat-item:hover {
    background-color: var(--background-color);
}
.chat-item.active {
    background-color: #e5f1ff;
}

.chat-item .info {
    flex-grow: 1;
    overflow: hidden;
}
.chat-item .title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-item .last-message {
    color: var(--secondary-text-color);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.main-content {
    display: flex;
    flex-direction: column;
    background: #fdfdfd;
    overflow: hidden; /* Предотвращаем внутреннюю прокрутку */
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--card-background);
    flex-shrink: 0;
}
.chat-header .project-title {
    font-size: 1.2rem;
    font-weight: 600;
}
.chat-header .details {
    display: flex;
    gap: 1.5rem;
    color: var(--secondary-text-color);
}

.chat-messages {
    flex-grow: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word; /* Добавляем перенос слов */
}
.message.incoming {
    background-color: #eef0f2;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.message.outgoing {
    background-color: var(--accent-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.message.system {
    background: transparent;
    color: var(--secondary-text-color);
    font-size: 0.85rem;
    text-align: center;
    align-self: center;
    padding: 4px 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.chat-input {
    display: flex;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background-color: var(--card-background);
    gap: 12px;
    flex-shrink: 0;
}

.chat-input textarea {
    flex-grow: 1;
    border: none;
    resize: none;
    font-family: var(--font-family);
    font-size: 1rem;
    background: transparent;
    padding-top: 8px;
}
.chat-input textarea:focus {
    outline: none;
}
.chat-input .icon-btn {
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--secondary-text-color);
}


/* --- Стили для админ-панели (admin.html) --- */
.admin-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    height: 100vh;
}

.admin-sidebar {
    background-color: #2c2c2e;
    color: #f5f5f7;
    padding: 24px;
    display: flex;
    flex-direction: column;
}
.admin-sidebar .logo {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: white;
}
.admin-nav {
    list-style: none;
}
.admin-nav li a {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    color: #e0e0e0;
    border-radius: 8px;
    transition: background-color 0.2s, color 0.2s;
    font-weight: 500;
    margin-bottom: 4px;
}
.admin-nav li a:hover {
    background-color: #444;
}
.admin-nav li a.active {
    background-color: var(--accent-color);
    color: white;
}

.admin-main {
    padding: 2rem;
    overflow-y: auto;
}
.admin-main h1 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}
.stat-card {
    background-color: var(--card-background);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.stat-card .value {
    font-size: 2.2rem;
    font-weight: 600;
}
.stat-card .label {
    color: var(--secondary-text-color);
    font-size: 0.9rem;
}

.content-block {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: 12px;
}

.content-block h2 {
    margin-bottom: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    overflow-x: auto; /* Для мобильных устройств */
    display: block;    /* Для мобильных устройств */
}
.data-table th, .data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap; /* Предотвращаем перенос в ячейках */
}
.data-table th {
    font-weight: 600;
    color: var(--secondary-text-color);
    font-size: 0.85rem;
    text-transform: uppercase;
}
.data-table tbody tr:last-child td {
    border-bottom: none;
}
.data-table .status {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    background-color: #eef0f2;
}

/* --- Стили для Лендинга (landing.html) --- */

.landing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    position: absolute;
    width: 100%;
    z-index: 10;
}

.landing-header .logo {
    font-size: 1.5rem;
    font-weight: 600;
}

.landing-nav a {
    text-decoration: none;
    color: #2c2c2e;
    margin-left: 24px;
    font-weight: 500;
    transition: color 0.2s;
}
.landing-nav a:hover {
    color: var(--text-color);
}

.btn-secondary {
    padding: 10px 20px;
    border-radius: 20px;
    background-color: #eef0f2;
    color: var(--text-color);
    font-weight: 600;
    transition: background-color 0.2s;
}
.btn-secondary:hover {
    background-color: #dcdfe3;
}
.btn-primary {
    padding: 10px 20px;
    border-radius: 20px;
    background-color: var(--accent-color);
    color: white;
    font-weight: 600;
    transition: background-color 0.2s;
}
.btn-primary:hover {
    background-color: #0070e0;
}

.hero-section {
    background-color: var(--background-color);
    text-align: center;
    padding: 160px 20px 100px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-section h1 {
    font-size: 4rem;
    font-weight: 700;
    max-width: 800px;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.hero-section p {
    font-size: 1.5rem;
    color: var(--secondary-text-color);
    max-width: 700px;
    line-height: 1.5;
    margin-bottom: 2.5rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap; /* Добавляем перенос кнопок */
    justify-content: center; /* Центрируем кнопки */
    gap: 10px; /* Добавляем отступ */
}

.hero-actions a {
    text-decoration: none;
    display: inline-block;
    margin: 0; /* Убираем старый margin */
    font-size: 1rem;
}

.content-section {
    padding: 80px 5%;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    background-color: var(--background-color);
}

.content-section h2 {
    font-size: 2.8rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.content-section .subtitle {
    font-size: 1.2rem;
    color: var(--secondary-text-color);
    max-width: 700px;
    margin: 0 auto 4rem auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    text-align: left;
}

.feature-card {
    background-color: var(--card-background);
    padding: 2rem;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.feature-card .icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    background-color: #e5f1ff;
    color: var(--accent-color);
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.feature-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--secondary-text-color);
    line-height: 1.6;
}

.cta-section {
    background-color: var(--card-background);
    text-align: center;
    padding: 80px 20px;
}
.cta-section h2 {
    font-size: 2.8rem;
    max-width: 600px;
    margin: 0 auto 1.5rem auto;
}
.cta-section p {
    margin-bottom: 2rem;
    color: var(--secondary-text-color);
}

.landing-footer {
    text-align: center;
    padding: 40px 20px;
    font-size: 0.9rem;
    color: var(--secondary-text-color);
    background-color: var(--background-color);
}

.footer-contacts {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem 2rem;
}
.footer-contacts p {
    margin: 0;
}
.footer-contacts a {
    color: var(--secondary-text-color);
    text-decoration: none;
    transition: color 0.2s;
}
.footer-contacts a:hover {
    color: var(--accent-color);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.modal {
    background-color: var(--card-background);
    padding: 2.5rem;
    border-radius: 18px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}
.modal-overlay.active .modal {
    transform: scale(1);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.modal-header h2 {
    font-size: 1.8rem;
    margin: 0;
}
.close-button {
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--secondary-text-color);
}
.modal-body p {
    line-height: 1.7;
    color: var(--secondary-text-color);
}

/* --- ИСПРАВЛЕННЫЙ БЛОК: Адаптивность (Responsive Styles) --- */
@media (max-width: 768px) {

    /* --- Общие страницы (вход, регистрация) --- */
    .auth-container {
        padding: 1rem;
    }
    .auth-card {
        padding: 2rem 1.5rem;
    }

    /* --- Лендинг (ИСПРАВЛЕНО ЗДЕСЬ) --- */
    .landing-header {
        position: relative; /* Убираем absolute, чтобы хедер занимал свое место в потоке */
        flex-direction: column; /* Ставим лого и навигацию друг под друга */
        gap: 15px; /* Добавляем отступ между лого и навигацией */
        padding: 20px 15px; /* Корректируем отступы */
    }

    .landing-nav {
        display: flex; /* Делаем сами кнопки гибким контейнером */
        gap: 10px; /* Добавляем расстояние между кнопками */
        width: 100%;
        justify-content: center;
    }

    .landing-nav a {
        margin-left: 0; /* Убираем старый отступ, т.к. используем gap */
        font-size: 0.9rem;
    }

    .btn-primary, .btn-secondary {
        padding: 8px 16px;
    }

    .hero-section {
        /* Уменьшаем верхний отступ, т.к. хедер больше не absolute */
        padding: 60px 15px 60px 15px; 
    }

    .hero-section h1 {
        font-size: 2.5rem; /* Уменьшаем шрифт */
    }
    .hero-section p {
        font-size: 1.1rem; /* Уменьшаем шрифт */
    }

    .content-section {
        padding: 60px 15px;
    }
    .content-section h2, .cta-section h2 {
        font-size: 2rem; /* Уменьшаем шрифт */
    }
    .features-grid {
        grid-template-columns: 1fr; /* Карточки в одну колонку */
    }

    .cta-section {
        padding: 60px 15px;
    }

    /* --- Личный кабинет и Админ-панель --- */
    .app-layout, .admin-layout {
        grid-template-columns: 1fr; /* Все в одну колонку */
        grid-template-rows: auto 1fr; /* Хедер/сайдбар по содержимому, остальное - на всю высоту */
        height: 100vh;
        width: 100vw;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        height: auto; /* Высота по содержимому */
    }
    
    .admin-sidebar {
        height: auto;
        padding: 1rem;
        flex-direction: row; /* Элементы в ряд */
        align-items: center;
        overflow-x: auto; /* Горизонтальная прокрутка если не влезает */
        -ms-overflow-style: none;  /* IE and Edge */
        scrollbar-width: none;  /* Firefox */
    }
    .admin-sidebar::-webkit-scrollbar {
        display: none; /* Скрываем скроллбар для Chrome, Safari, Opera */
    }
    .admin-sidebar .logo {
        margin-bottom: 0;
        margin-right: auto; /* Лого слева, меню справа */
    }
    .admin-nav {
        display: flex;
        gap: 8px;
    }
    .admin-nav li a {
        margin-bottom: 0;
        white-space: nowrap;
    }

    .app-header {
        grid-column: 1 / 2; /* Занимает одну колонку */
        padding: 0 16px;
    }
    .app-header .user-profile span {
        display: none; /* Скрываем текст "Привет, ..." */
    }
    .app-header .user-profile {
        gap: 12px;
    }
    
    .chat-header {
        padding: 12px 16px;
    }
    .chat-header .details {
        flex-direction: column; /* Детали в столбец */
        align-items: flex-end;
        gap: 0.25rem;
        font-size: 0.8rem;
    }
    .chat-header .project-title {
        font-size: 1rem;
    }

    .chat-messages {
        padding: 16px;
    }

    .chat-input {
        padding: 12px 16px;
    }

    .message {
        max-width: 90%; /* Сообщения могут быть шире */
    }
    
    .modal {
        padding: 1.5rem;
    }
    .modal-header h2 {
        font-size: 1.4rem;
    }
}