@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-body: #f2efe7;
    --bg-panel: #fdfbf7;
    --bg-panel-hover: #f7f4ed;
    --text-main: #3d3d3d;
    --text-muted: #8c8c8c;
    --accent-purple: #6c5ce7;
    --accent-green: #71a95a;
    --accent-pink: #f48fb1;
    --border-color: #e5e1d7;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
    --radius-lg: 20px;
    --radius-md: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

h1,
h2,
h3 {
    font-family: 'Outfit', sans-serif;
}

/* HEADER */
.app-header {
    height: 70px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-img {
    width: 45px;
    height: 45px;
    border-radius: 12px;
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-text p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    color: var(--accent-purple);
}

.user-avatar img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: var(--shadow-soft);
}

/* MAIN LAYOUT */
.main-layout {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(240px, 280px) 1fr minmax(320px, 380px);
    gap: 20px;
    padding: 10px 30px 20px 30px;
    overflow: hidden;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    min-height: 0;
}

.right-sidebar {
    overflow-y: auto;
}

.right-sidebar .details-panel {
    flex-shrink: 0;
}

.right-sidebar .notes-panel {
    flex: 1;
    min-height: 180px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel {
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    padding: 20px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.panel-header h2 {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* LISTS */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cell-item,
.organelle-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.cell-item:hover,
.organelle-item:hover {
    background: var(--bg-panel-hover);
}

.cell-item.active,
.organelle-item.active {
    background: #e8f5e9;
    border: 1px solid var(--accent-green);
}

.cell-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.cell-info strong {
    display: block;
    font-size: 0.9rem;
}

.cell-info span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* VIEWER AREA */
.content-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.viewer-container {
    flex: 1;
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.viewer-header {
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cell-title h2 {
    font-size: 2.2rem;
    font-weight: 400;
    color: #2c3e50;
}

.cell-title p {
    font-size: 1rem;
    font-style: italic;
    color: var(--text-muted);
}

.viewer-controls-top {
    display: flex;
    gap: 20px;
}

.control-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 5px;
    text-align: center;
    letter-spacing: 1px;
}

.mode-toggles {
    background: #f0f0f0;
    padding: 4px;
    border-radius: 10px;
    display: flex;
    gap: 2px;
}

.mode-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 6px;
    color: #666;
}

.mode-btn.active {
    background: white;
    color: var(--accent-green);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* 3D CANVAS AREA */
#canvas-container {
    flex: 1;
    position: relative;
    background: #fdfbf7;
}

#three-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.navigation-tip {
    position: absolute;
    top: 30px;
    left: 30px;
    background: #fff9c4;
    padding: 15px;
    border-radius: 8px;
    font-size: 0.8rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transform: rotate(-2deg);
    border: 1px solid #fff176;
    z-index: 10;
}

.navigation-tip p {
    margin-bottom: 5px;
}

.viewer-actions-bottom {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10;
}

.action-btn {
    background: white;
    border: 1px solid var(--border-color);
    padding: 8px 15px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.action-btn:hover {
    background: #f5f5f5;
}

.action-btn.primary {
    background: var(--text-main);
    color: white;
    border: none;
}

.action-btn.primary:hover {
    background: #000;
}

.spacer {
    flex: 1;
}

/* BOTTOM PANELS */
.bottom-panels {
    height: 200px;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
}

.microscope-gallery {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.micro-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
}

.micro-card img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid white;
    box-shadow: var(--shadow-soft);
}

.micro-card span {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
}

.add-card {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
}

.add-icon {
    font-size: 1.5rem;
    color: var(--text-muted);
}

/* COMPARE CARD */
.compare-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
}

.compare-icon {
    width: 45px;
    height: 45px;
    background: #f0f0f0;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: var(--shadow-soft);
}

.compare-text {
    text-align: center;
}

.compare-text strong {
    display: block;
    font-size: 0.85rem;
}

.compare-text span {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.vs-badge {
    background: var(--accent-purple);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.open-compare-btn {
    width: 100%;
    padding: 10px;
    background: #f5f5f5;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

/* RIGHT SIDEBAR */
.details-body {
    margin-top: 12px;
    font-size: 0.92rem;
    line-height: 1.7;
    color: #444;
}

.notes-body {
    margin-top: 12px;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #444;
    overflow-y: auto;
    flex: 1;
    padding-right: 4px;
}

.occurrence-panel {
    margin-top: auto;
}

.occ-img {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 10px;
}

.occ-caption {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--text-muted);
}

/* CUSTOM TOGGLE */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--accent-purple);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* COMPARISON MODAL TABS */
.compare-tabs {
    display: flex;
    gap: 4px;
    padding: 16px 20px 0;
    background: #fdfbf7;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.compare-tab {
    padding: 10px 18px;
    border: none;
    background: #f0ece3;
    border-radius: 10px 10px 0 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.compare-tab:hover {
    background: #e8e4db;
    color: var(--text-main);
}

.compare-tab.active {
    background: var(--accent-purple);
    color: white;
}

.compare-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.compare-table th {
    padding: 12px 14px;
    border-bottom: 2px solid #e0dcd4;
    text-align: left;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #faf8f3;
}

.compare-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #f0ece3;
    font-size: 0.88rem;
    color: #444;
    line-height: 1.5;
}

.compare-table tr:hover td {
    background: #faf8f3;
}

.compare-table .feature-name {
    font-weight: 600;
    color: var(--text-main);
    min-width: 120px;
}

.compare-badge-yes {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    background: #e8f5e9;
    color: #2e7d32;
}

.compare-badge-no {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    background: #ffebee;
    color: #c62828;
}

/* ============================================================ */
/* MOBILE RESPONSIVE                                             */
/* ============================================================ */

/* Tablet Yatay & Küçük Masaüstü */
@media (max-width: 1280px) {
    body {
        overflow-y: auto;
        height: auto;
    }

    .main-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 15px;
        padding: 10px 20px 30px;
    }

    .content-area {
        height: 55vh;
        min-height: 400px;
        order: -1;
    }

    .sidebar {
        display: flex;
        overflow-y: visible;
    }

    .left-sidebar {
        order: 1;
        flex-direction: row;
        gap: 15px;
    }

    .left-sidebar .panel {
        flex: 1;
        min-width: 0;
    }

    .right-sidebar {
        order: 2;
    }

    .app-header {
        height: auto;
        padding: 12px 20px;
    }
}

/* Tablet Dikey & Büyük Telefon */
@media (max-width: 768px) {
    .app-header {
        padding: 10px 15px;
    }

    .logo-text h1 {
        font-size: 1.15rem;
    }

    .logo-text p {
        font-size: 0.7rem;
    }

    .logo-img {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 1rem !important;
    }

    .main-layout {
        padding: 8px 12px 30px;
        gap: 12px;
    }

    .content-area {
        height: 50vh;
        min-height: 320px;
    }

    .left-sidebar {
        flex-direction: column;
    }

    .cell-title h2 {
        font-size: 1.4rem;
    }

    .cell-title p {
        font-size: 0.82rem;
    }

    .viewer-header {
        padding: 15px 18px;
    }

    .navigation-tip {
        display: none;
    }

    .viewer-actions-bottom {
        left: 10px;
        right: 10px;
        bottom: 10px;
        gap: 6px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .action-btn {
        padding: 8px 12px;
        font-size: 0.78rem;
        min-height: 44px;
        border-radius: 8px;
    }

    .panel {
        padding: 15px;
        border-radius: 16px;
    }

    .panel-header h2 {
        font-size: 0.78rem;
    }

    .cell-item,
    .organelle-item {
        padding: 10px;
        min-height: 44px;
    }

    .organelle-group-header {
        padding: 10px 12px;
        min-height: 44px;
    }

    .organelle-item.nested {
        padding: 10px 12px 10px 16px;
        min-height: 44px;
    }

    /* Modal Mobil */
    .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
    }

    .modal-header {
        padding: 15px 18px;
    }

    .modal-header h2 {
        font-size: 1rem;
    }

    .compare-tabs {
        padding: 12px 15px 0;
    }

    .compare-tab {
        padding: 8px 14px;
        font-size: 0.75rem;
    }

    .compare-table th,
    .compare-table td {
        padding: 9px 10px;
        font-size: 0.8rem;
    }

    /* Karşılaştırma butonu */
    .compare-panel button {
        min-height: 44px;
    }

    /* Details & Notes */
    .details-body {
        font-size: 0.85rem;
    }

    .notes-body {
        font-size: 0.85rem;
    }
}

/* Küçük Telefon */
@media (max-width: 480px) {
    .app-header {
        padding: 8px 12px;
    }

    .logo {
        gap: 10px;
    }

    .logo-text h1 {
        font-size: 1rem;
    }

    .logo-text p {
        display: none;
    }

    .logo-img {
        width: 32px;
        height: 32px;
        font-size: 0.9rem !important;
    }

    .main-layout {
        padding: 6px 8px 30px;
        gap: 10px;
    }

    .content-area {
        height: 45vh;
        min-height: 280px;
    }

    .cell-title h2 {
        font-size: 1.15rem;
    }

    .cell-title p {
        font-size: 0.75rem;
    }

    .viewer-header {
        padding: 12px 14px;
    }

    .viewer-actions-bottom {
        left: 6px;
        right: 6px;
        bottom: 6px;
        gap: 4px;
    }

    .action-btn {
        padding: 6px 10px;
        font-size: 0.72rem;
        gap: 4px;
    }

    .action-btn .fa-camera {
        margin: 0;
    }

    .action-btn span {
        display: none;
    }

    .panel {
        padding: 12px;
        border-radius: 14px;
    }

    .panel-header {
        margin-bottom: 10px;
    }

    .panel-header h2 {
        font-size: 0.72rem;
    }

    .cell-item,
    .organelle-item {
        padding: 8px;
        gap: 8px;
    }

    .cell-info strong {
        font-size: 0.82rem;
    }

    .cell-info span {
        font-size: 0.7rem;
    }

    /* Modal Küçük Ekran */
    .modal-header {
        padding: 12px 15px;
    }

    .compare-tabs {
        padding: 10px 12px 0;
        gap: 3px;
    }

    .compare-tab {
        padding: 7px 10px;
        font-size: 0.7rem;
    }

    .compare-table th,
    .compare-table td {
        padding: 8px;
        font-size: 0.75rem;
    }

    .compare-table .feature-name {
        min-width: 90px;
    }

    .details-body,
    .notes-body {
        font-size: 0.82rem;
    }
}

/* LOADING OVERLAY */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(242, 239, 231, 0.95);
    /* var(--bg-main) ile uyumlu yarı saydam krem */
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loader-content i {
    font-size: 3.5rem;
    color: var(--accent-purple);
    margin-bottom: 20px;
}

.loader-content h3 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.loader-content p {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
}

/* MODAL STYLES */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.modal-content {
    background: var(--bg-panel);
    width: 850px;
    max-width: 92%;
    max-height: 80vh;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fdfbf7;
}

.modal-header h2 {
    font-size: 1.2rem;
    color: var(--text-main);
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal-btn:hover {
    color: #e74c3c;
}


/* ORGANELLE HIERARCHY (ACCORDION) */
.organelle-group-wrapper {
    margin-bottom: 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: white;
    overflow: hidden;
}

.organelle-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: #f7f4ed;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.organelle-group-header:hover {
    background: #efece4;
}

.organelle-group-header.open {
    background: white;
    border-bottom: 1px solid var(--border-color);
}

.organelle-group-content {
    background: white;
    border-left: 3px solid var(--accent-purple);
    margin-left: 4px;
}

.organelle-item.nested {
    padding: 10px 12px 10px 20px;
    font-size: 0.8rem;
    border-radius: 0;
    border-bottom: 1px solid #f9f9f9;
}

.organelle-item.nested:last-child {
    border-bottom: none;
}

.organelle-item.nested .organelle-dot {
    width: 8px;
    height: 8px;
}

.group-icon {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.organelle-group-header.active {
    background: #e8f5e9;
    border-left: 5px solid var(--accent-green);
    color: var(--accent-green);
}

.organelle-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}