/* Gear Generator - 齒輪產生器 CSS */

/* ======= Layout ======= */
.gear-app {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 70px); /* minus nav height */
    overflow: hidden;
    background: #f8f9fa;
}

.gear-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 12px;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    height: 44px;
    flex-shrink: 0;
    z-index: 100;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-title {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
}

#project-title {
    width: 160px;
    font-size: 0.85rem;
}

.animation-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.rpm-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    margin: 0;
}

.rpm-label input {
    width: 60px;
}

.save-status {
    font-size: 0.75rem;
    color: #6c757d;
}

/* ======= Main Area ======= */
.gear-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ======= Canvas ======= */
.gear-canvas-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #f0f0f0;
}

#gear-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

#gear-canvas:active {
    cursor: grabbing;
}

.canvas-controls {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
    background: rgba(255,255,255,0.9);
    border-radius: 6px;
    padding: 4px 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.canvas-toggles {
    display: flex;
    gap: 8px;
    font-size: 0.75rem;
    margin-left: 8px;
}

.canvas-toggles label {
    display: flex;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    white-space: nowrap;
}

.cut-preview-toggle {
    background: #fff3cd;
    padding: 1px 6px !important;
    border-radius: 4px;
    border: 1px solid #ffc107;
    font-weight: 500;
}

.cut-preview-toggle:has(input:checked) {
    background: #ffc107;
    color: #000;
}

#sel-theme {
    width: 80px;
    font-size: 0.75rem;
    margin-left: 4px;
}

/* ======= Right Panel ======= */
.gear-panel {
    width: 280px;
    flex-shrink: 0;
    overflow-y: auto;
    background: #fff;
    border-left: 1px solid #dee2e6;
    font-size: 0.85rem;
}

.panel-section {
    border-bottom: 1px solid #eee;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: #f1f3f5;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.panel-body {
    padding: 8px 10px;
}

.panel-body label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    gap: 6px;
    font-size: 0.8rem;
}

.panel-body label .form-control,
.panel-body label .form-select {
    width: 120px;
    flex-shrink: 0;
}

/* ======= Gear List ======= */
.gear-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 140px;
    overflow-y: auto;
}

.gear-list li {
    display: flex;
    align-items: center;
    padding: 4px 10px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.gear-list li:hover {
    background: #e8f4fd;
}

.gear-list li.active {
    background: #cce5ff;
    font-weight: 600;
}

.gear-list li .gear-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    flex-shrink: 0;
}

.gear-list li .gear-info {
    flex: 1;
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ======= Calc Results ======= */
.calc-results div {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 0.78rem;
    border-bottom: 1px dotted #eee;
}

.calc-results span {
    font-weight: 600;
    font-family: monospace;
}

/* ======= Unit Toggle ======= */
.unit-toggle {
    display: flex;
    gap: 12px;
    margin-bottom: 6px;
    padding: 2px 0;
}

.unit-toggle label {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.78rem;
    cursor: pointer;
    justify-content: flex-start;
    margin-bottom: 0;
}

/* ======= Gear Box Info ======= */
#box-info div {
    padding: 1px 0;
    font-size: 0.78rem;
}

#section-gearbox .panel-body label:has(input[type="checkbox"]) {
    justify-content: flex-start;
    gap: 4px;
}

/* ======= Canvas Themes ======= */
.gear-canvas-wrapper.theme-light {
    background: #ffffff;
}

.gear-canvas-wrapper.theme-blueprint {
    background: #1a3a54;
}

.gear-canvas-wrapper.theme-dark {
    background: #1e1e1e;
}

/* ======= Projects Modal ======= */
#projects-list .project-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.1s;
}

#projects-list .project-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

#projects-list .project-card h6 {
    font-size: 0.9rem;
    margin-bottom: 4px;
}

#projects-list .project-card small {
    color: #6c757d;
}

.project-card .project-thumbnail {
    width: 100%;
    height: 80px;
    object-fit: contain;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 6px;
}

.project-card .project-actions {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

/* ======= Responsive ======= */
@media (max-width: 768px) {
    .gear-main {
        flex-direction: column;
    }

    .gear-panel {
        width: 100%;
        max-height: 40vh;
        border-left: none;
        border-top: 1px solid #dee2e6;
    }

    .gear-canvas-wrapper {
        flex: 1;
        min-height: 40vh;
    }

    .toolbar-center {
        display: none;
    }

    #project-title {
        width: 100px;
    }
}

@media (max-width: 480px) {
    .gear-toolbar {
        flex-wrap: wrap;
        height: auto;
        padding: 4px 8px;
    }

    .toolbar-left {
        order: 1;
        flex: 1;
    }

    .toolbar-right {
        order: 2;
    }
}
