/**
 * Стилі для сайту - Варіант 8
 * Лабораторна робота №1 + №2 + №3
 */

/* Базові стилі */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

/* Контейнер сторінки */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Загальні стилі блоків */
.block {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.block:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.block h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.2em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

.block p {
    color: #555;
    text-align: justify;
}

/* Блок 1 - Верхній з текстом X */
.block-1 {
    background: linear-gradient(90deg, #667eea, #764ba2);
    color: white;
    text-align: center;
    font-size: 1.3em;
    font-weight: 500;
    padding: 25px;
}

/* Центральна частина - Grid Layout для варіанту 8 */
.main-content {
    display: grid;
    grid-template-columns: 200px 1fr 250px;
    grid-template-rows: auto auto auto;
    gap: 15px;
}

/* Блок 2 - Ліва вертикальна секція (меню) */
.block-2 {
    grid-column: 1;
    grid-row: 1 / 4;
    background: linear-gradient(180deg, #f8f9fa, #e9ecef);
    min-height: 400px;
}

/* Блок 3 - Верхній правий */
.block-3 {
    grid-column: 3;
    grid-row: 1;
    background: linear-gradient(135deg, #fff5f5, #fed7d7);
}

/* Блок 4 - Під блоком 3 */
.block-4 {
    grid-column: 3;
    grid-row: 2;
    background: linear-gradient(135deg, #f0fff4, #c6f6d5);
}

/* Блок 5 - Центральний великий блок */
.block-5 {
    grid-column: 2;
    grid-row: 1 / 3;
    background: linear-gradient(135deg, #fffaf0, #feebc8);
    min-height: 250px;
}

/* Блок 6 - Під блоком 4 */
.block-6 {
    grid-column: 3;
    grid-row: 3;
    background: linear-gradient(135deg, #ebf8ff, #bee3f8);
}

/* Блок 7 - Нижній з текстом Y */
.block-7 {
    background: linear-gradient(90deg, #2d3748, #4a5568);
    color: white;
    text-align: center;
    padding: 20px;
    font-size: 0.95em;
}

/* Стилі меню */
.main-menu ul {
    list-style: none;
}

.main-menu li {
    margin-bottom: 5px;
}

.main-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    text-decoration: none;
    color: #333;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.main-menu a:hover {
    background: linear-gradient(90deg, #667eea, #764ba2);
    color: white;
    transform: translateX(5px);
}

.main-menu li.active a {
    background: linear-gradient(90deg, #667eea, #764ba2);
    color: white;
}

.menu-icon {
    font-size: 1.2em;
}

.menu-text {
    font-weight: 500;
}

/* Стилі для списків */
.styled-list {
    padding-left: 25px;
    margin: 15px 0;
}

.styled-list li {
    margin-bottom: 8px;
    color: #555;
}

.styled-list.unordered {
    list-style-type: disc;
}

.styled-list.ordered {
    list-style-type: decimal;
}

/* Стилі для галереї */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.gallery-item {
    text-align: center;
}

.gallery-item img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.gallery-item img:hover {
    transform: scale(1.05);
}

.gallery-item p {
    margin-top: 10px;
    font-weight: 500;
    color: #333;
}

/* Стилі для карти зображення */
.image-map-container {
    text-align: center;
    margin: 20px 0;
}

.image-map-container img {
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

/* Стилі для контактів */
.contact-info {
    margin-top: 15px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 10px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
}

.contact-icon {
    font-size: 1.3em;
}

/* Стилі для посилань */
.styled-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.styled-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Адаптивність */
@media (max-width: 992px) {
    .main-content {
        grid-template-columns: 180px 1fr 200px;
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }
    
    .block-2 {
        grid-column: 1;
        grid-row: auto;
        min-height: auto;
    }
    
    .block-3,
    .block-4,
    .block-5,
    .block-6 {
        grid-column: 1;
        grid-row: auto;
    }
    
    .main-menu ul {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }
    
    .main-menu li {
        margin-bottom: 0;
    }
}

/* Блок з номером */
.block-number {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 0.8em;
    color: #999;
    font-weight: bold;
}

.block {
    position: relative;
}

/* =============================================
   ЛАБОРАТОРНА РОБОТА №2 + №3 - Стилі для інтерактивності
   ============================================= */

/* Підсвічування редагованих елементів */
.editable-hover {
    outline: 2px dashed #667eea !important;
    outline-offset: 2px;
    cursor: pointer;
    background-color: rgba(102, 126, 234, 0.1) !important;
    transition: all 0.2s ease;
}

/* Форма редагування */
.edit-form {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-form-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
}

.edit-form-container {
    position: relative;
    background: white;
    border-radius: 16px;
    padding: 25px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: formAppear 0.3s ease;
}

@keyframes formAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.edit-form-title {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.3em;
    text-align: center;
}

.edit-form-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.3s ease;
}

.edit-form-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.edit-form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.edit-btn {
    flex: 1;
    min-width: 100px;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.edit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.edit-btn-save {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
}

.edit-btn-save:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

.edit-btn-cancel {
    background: linear-gradient(135deg, #fc8181, #f56565);
    color: white;
}

.edit-btn-cancel:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.4);
}

.edit-btn-reset {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.edit-btn-reset:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.edit-form-hint {
    margin-top: 15px;
    text-align: center;
    color: #718096;
    font-size: 0.85em;
}

/* Сповіщення */
.notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.95em;
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

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

.notification-success {
    background: linear-gradient(135deg, #48bb78, #38a169);
}

.notification-info {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.notification-error {
    background: linear-gradient(135deg, #fc8181, #f56565);
}

/* Індикатор завантаження */
.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-indicator.loading-show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

.loading-indicator span {
    color: #667eea;
    font-weight: 500;
}

/* Панель статистики */
.stats-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.stats-toggle {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    margin-left: auto;
}

.stats-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.stats-content {
    position: absolute;
    bottom: 60px;
    right: 0;
    background: white;
    border-radius: 12px;
    padding: 20px;
    min-width: 320px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.stats-content-show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.stats-content h4 {
    margin-bottom: 15px;
    color: #333;
    text-align: center;
    font-size: 1.1em;
}

.stats-section {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e2e8f0;
}

.stats-section h5 {
    color: #667eea;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.stats-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
}

.stats-item.stats-total {
    border-top: 2px solid #667eea;
    margin-top: 10px;
    padding-top: 10px;
    font-weight: bold;
}

.stats-label {
    color: #718096;
    font-size: 0.85em;
}

.stats-value {
    color: #333;
    font-weight: 600;
    font-size: 0.85em;
}

.stats-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.stats-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.3s ease;
    color: white;
}

.stats-btn-danger {
    background: linear-gradient(135deg, #fc8181, #f56565);
}

.stats-btn-info {
    background: linear-gradient(135deg, #4299e1, #3182ce);
}

.stats-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Адаптивність */
@media (max-width: 576px) {
    .edit-form-container {
        width: 95%;
        padding: 20px;
    }
    
    .edit-form-buttons {
        flex-direction: column;
    }
    
    .edit-btn {
        width: 100%;
    }
    
    .stats-content {
        right: -10px;
        min-width: 280px;
    }
    
    .stats-actions {
        flex-direction: column;
    }
}
