/**
 * АкваСбор - Главные стили приложения
 */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a5f7a 0%, #159895 100%);
    color: #333;
    min-height: 100vh;
    padding: 10px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #002B36 0%, #004D61 100%);
    color: white;
    padding: 20px 15px;
    text-align: center;
}

.logo {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 8px;
    color: #57C5B6;
}

.tagline {
    font-size: 1rem;
    opacity: 0.9;
}

.navigation {
    display: flex;
    overflow-x: auto;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.navigation::-webkit-scrollbar {
    display: none;
}

.nav-btn {
    flex: 0 0 auto;
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.nav-btn:hover {
    background: #e9ecef;
}

.nav-btn.active {
    background: white;
    color: #159895;
    border-bottom-color: #159895;
}

.content-section {
    display: none;
    padding: 20px 15px;
    min-height: 400px;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

h2 {
    color: #002B36;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #57C5B6;
    font-size: 1.4rem;
}

h3 {
    color: #004D61;
    margin: 20px 0 12px;
    font-size: 1.2rem;
}

h4 {
    color: #004D61;
    margin: 15px 0 10px;
    font-size: 1.1rem;
}

/* Модальные окна */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 12px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* Фото галерея */
.photo-upload {
    margin: 20px 0;
    padding: 20px;
    border: 2px dashed #57C5B6;
    border-radius: 8px;
    text-align: center;
    background: #f8fdff;
    transition: background 0.3s;
    cursor: pointer;
}

.photo-upload.dragover {
    background: #e8f5e8;
    border-color: #4CAF50;
}

.photo-upload input {
    display: none;
}

.upload-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #57C5B6;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    margin: 10px;
    font-weight: 500;
    border: none;
    transition: background 0.3s;
}

.upload-btn:hover {
    background: #45a89a;
}

.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.photo-item:hover img {
    transform: scale(1.05);
}

.photo-delete {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(244, 67, 54, 0.8);
    color: white;
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-delete:hover {
    background: rgba(244, 67, 54, 1);
}

/* Заметки */
.notes-section {
    margin: 20px 0;
}

.note-input {
    width: 100%;
    min-height: 100px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.note-input:focus {
    border-color: #57C5B6;
    outline: none;
}

.notes-list {
    margin-top: 15px;
}

.note-item {
    background: #f8f9fa;
    border-left: 4px solid #57C5B6;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 0 6px 6px 0;
}

.note-date {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.note-text {
    line-height: 1.5;
}

/* Тесты воды */
.test-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.test-card {
    background: #f8fdff;
    border: 2px solid #57C5B6;
    border-radius: 8px;
    padding: 20px;
}

.test-card h4 {
    color: #004D61;
    margin-bottom: 15px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.test-input-group {
    margin-bottom: 15px;
}

.test-input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #004D61;
}

.test-input-group input, .test-input-group select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.test-input-group input:focus, .test-input-group select:focus {
    border-color: #57C5B6;
    outline: none;
}

.test-info {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    line-height: 1.3;
}

.test-result {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

.test-result.good {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.test-result.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.test-result.danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Совместимость видов */
.species-selector {
    margin: 20px 0;
}

.species-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.species-card {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.species-card:hover {
    border-color: #57C5B6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.species-card.selected {
    border-color: #57C5B6;
    background: #f8fdff;
}

.species-card h4 {
    color: #004D61;
    margin-bottom: 8px;
}

.species-info {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

/* Совместимость */
.compatibility-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.compatibility-matrix {
    margin: 20px 0;
    overflow-x: auto;
}

.compatibility-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 600px;
}

.compatibility-table th,
.compatibility-table td {
    padding: 8px 12px;
    text-align: center;
    border: 1px solid #ddd;
}

.compatibility-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #004D61;
    position: sticky;
    top: 0;
}

.compat-excellent {
    background: #d4edda;
    color: #155724;
}

.compat-good {
    background: #d1ecf1;
    color: #0c5460;
}

.compat-caution {
    background: #fff3cd;
    color: #856404;
}

.compat-poor {
    background: #f8d7da;
    color: #721c24;
}

/* Калькуляторы */
.calculator-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.calc-card {
    background: white;
    border: 2px solid #57C5B6;
    border-radius: 8px;
    padding: 20px;
}

.calc-input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.calc-input-group {
    margin-bottom: 15px;
}

.calc-input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #004D61;
}

.calc-input-group input,
.calc-input-group select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.calc-input-group input:focus,
.calc-input-group select:focus {
    border-color: #57C5B6;
    outline: none;
}

.calc-result {
    background: #e8f5e8;
    border: 2px solid #4CAF50;
    border-radius: 6px;
    padding: 15px;
    margin-top: 15px;
}

.calc-result h5 {
    color: #2e7d32;
    margin-bottom: 10px;
}

/* Азотный цикл */
.nitrogen-stages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stage-card {
    background: white;
    border: 2px solid #57C5B6;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.stage-number {
    display: inline-block;
    width: 40px;
    height: 40px;
    background: #57C5B6;
    color: white;
    border-radius: 50%;
    line-height: 40px;
    font-weight: bold;
    margin-bottom: 15px;
}

.stage-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

/* Карточки информации */
.info-card {
    background: #f0f8ff;
    border: 1px solid #b0d4f1;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

.info-card h4 {
    color: #1976d2;
    margin-bottom: 10px;
}

.warning-card {
    background: #fff3e0;
    border: 1px solid #ffb74d;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

.warning-card h4 {
    color: #f57c00;
    margin-bottom: 10px;
}

.parameter-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
}

.parameter-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #159895;
}

.expert-advice {
    background: #e8f5e8;
    border-left: 4px solid #4CAF50;
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 6px 6px 0;
}

.expert-advice h4 {
    color: #2e7d32;
    margin-bottom: 8px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.expert-advice p {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 8px;
}

.expert-source {
    font-size: 12px;
    color: #558b2f;
    font-style: italic;
}

.research-card {
    background: #fff8e1;
    border-left: 4px solid #ffa726;
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 6px 6px 0;
}

.research-card h4 {
    color: #e65100;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Списки */
.tips-list {
    list-style: none;
    padding: 0;
}

.tips-list li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    position: relative;
    padding-left: 25px;
}

.tips-list li:before {
    content: "💡";
    position: absolute;
    left: 0;
}

/* Timeline */
.timeline {
    position: relative;
    padding: 20px 0;
    margin: 20px 0;
}

.timeline-item {
    position: relative;
    padding: 20px;
    margin-bottom: 20px;
    background: white;
    border: 2px solid #57C5B6;
    border-radius: 8px;
    margin-left: 30px;
}

.timeline-item:before {
    content: "";
    position: absolute;
    left: -30px;
    top: 25px;
    width: 15px;
    height: 15px;
    background: #57C5B6;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 0 2px #57C5B6;
}

.timeline-item:after {
    content: "";
    position: absolute;
    left: -23px;
    top: 40px;
    width: 2px;
    height: calc(100% + 20px);
    background: #57C5B6;
}

.timeline-item:last-child:after {
    display: none;
}

.day-label {
    font-weight: bold;
    color: #159895;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

/* Изображения */
.section-image {
    width: 100%;
    max-width: 800px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    margin: 20px auto;
    display: block;
    transition: transform 0.3s;
}

.section-image:hover {
    transform: scale(1.02);
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.image-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.image-card img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform 0.3s;
}

.image-card:hover img {
    transform: scale(1.05);
}

.image-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: white;
    padding: 15px;
    font-size: 14px;
    font-weight: 500;
}

/* Кнопки */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s;
    margin: 5px;
}

.btn-primary {
    background: #159895;
    color: white;
}

.btn-primary:hover {
    background: #128285;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #57C5B6;
    color: white;
}

.btn-secondary:hover {
    background: #45a89a;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-success {
    background: #4CAF50;
    color: white;
}

.btn-success:hover {
    background: #45a049;
}

.btn-info {
    background: #2196F3;
    color: white;
}

.btn-info:hover {
    background: #1976D2;
}

/* Toast уведомления */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #323232;
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
    font-size: 14px;
    max-width: 90%;
}

.toast.show {
    opacity: 1;
}

/* Прелоадер */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a5f7a 0%, #159895 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
}

.preloader-logo {
    font-size: 3rem;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.preloader-text {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.preloader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.preloader.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #57C5B6);
    transition: width 0.3s ease;
}

/* Аквариумы */
.aquariums-management {
    margin: 20px 0;
}

.aquariums-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.aquarium-card {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s;
    position: relative;
    cursor: pointer;
}

.aquarium-card:hover {
    border-color: #57C5B6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.aquarium-card.active {
    border-color: #57C5B6;
    background: #f8fdff;
}

.aquarium-card h4 {
    color: #004D61;
    margin-bottom: 8px;
}

.aquarium-info {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.aquarium-actions {
    margin-top: 10px;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

/* История */
.history-entries {
    margin: 20px 0;
}

.history-entry {
    background: white;
    border: 2px solid #57C5B6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.history-entry:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateX(5px);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.history-date {
    font-weight: bold;
    color: #159895;
}

.history-type {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 4px;
    background: #e3f2fd;
    color: #1976d2;
}

.history-content {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* Фильтрация */
.filter-type-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.filter-type-card {
    background: linear-gradient(135deg, #f8fdff 0%, white 100%);
    border: 2px solid #ddd;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.filter-type-card:before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(135deg, transparent, rgba(87, 197, 182, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.5s;
}

.filter-type-card:hover:before {
    left: 100%;
}

.filter-type-card:hover {
    border-color: #57C5B6;
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.filter-type-card.selected {
    border-color: #57C5B6;
    background: linear-gradient(135deg, #f8fdff 0%, #e8f5f5 100%);
    box-shadow: 0 4px 15px rgba(87, 197, 182, 0.2);
}

.filter-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    display: inline-block;
    transition: transform 0.3s;
}

.filter-type-card:hover .filter-icon {
    transform: scale(1.1);
}

/* Освещение */
.lighting-stages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.lighting-stage {
    background: white;
    border: 2px solid #ff9800;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
}

.lighting-stage:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 152, 0, 0.2);
}

.light-spectrum {
    display: flex;
    height: 30px;
    border-radius: 15px;
    overflow: hidden;
    margin: 15px 0;
    border: 2px solid #ddd;
}

.spectrum-segment {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
}

.spectrum-red { background: #f44336; }
.spectrum-orange { background: #ff9800; }
.spectrum-yellow { background: #ffeb3b; }
.spectrum-green { background: #4caf50; }
.spectrum-blue { background: #2196f3; }
.spectrum-violet { background: #9c27b0; }

.lighting-product {
    background: white;
    border: 2px solid #ff9800;
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.lighting-product:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(255, 152, 0, 0.2);
}

.equipment-image {
    width: 100%;
    max-width: 300px;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin: 15px auto;
    display: block;
    border: 2px solid #57C5B6;
}

/* Адаптивность */
@media (max-width: 768px) {
    .test-grid {
        grid-template-columns: 1fr;
    }

    .species-grid {
        grid-template-columns: 1fr;
    }

    .photo-gallery {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .navigation {
        padding: 0 10px;
    }

    .nav-btn {
        padding: 10px 15px;
        font-size: 13px;
    }

    .calc-input-row {
        grid-template-columns: 1fr;
    }

    .nitrogen-stages {
        grid-template-columns: 1fr;
    }

    .timeline-item {
        margin-left: 20px;
    }

    .timeline-item:before {
        left: -20px;
    }

    .timeline-item:after {
        left: -13px;
    }

    .image-grid {
        grid-template-columns: 1fr;
    }
}