/* style.css - Calculator Specific Styles */

/* Input Styles */

/* Input Styles */
.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .input-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group.full-width {
    grid-column: 1 / -1;
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input[type="number"], select {
    width: 100%;
    box-sizing: border-box;
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: var(--font-family);
    transition: border-color 0.15s, box-shadow 0.15s;
    background-color: #fafafa;
}

input[type="number"]:focus, select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background-color: #fff;
}

.hint-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Canvas Styles */
.visualization-section {
    display: flex;
    flex-direction: column;
}

.canvas-container {
    width: 100%;
    aspect-ratio: 4/3;
    background-color: #eef2f6;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-box {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.color-box.boards { background-color: #c29c76; }
.color-box.joists { background-color: #9ca3af; }
.color-box.beams { background-color: #60a5fa; }

/* Results Styles */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.results-header h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-primary:active, .btn-excel:active {
    transform: translateY(1px);
}

.btn-primary.success {
    background-color: var(--success-color);
}

.btn-excel {
    background-color: #107c41;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn-excel:hover {
    background-color: #0c5e31;
}

.warnings-container, .tips-container {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.tips-container {
    background-color: #eff6ff;
    border-left: 4px solid var(--accent-color);
    color: #1e3a8a;
}

.warnings-container {
    background-color: #fef2f2;
    border-left: 4px solid var(--danger-color);
    color: #991b1b;
}

.hidden {
    display: none;
}

.warning-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.warning-item:last-child {
    margin-bottom: 0;
}

/* Material Output Formatting */
.result-group {
    margin-bottom: 1.5rem;
}

.compact-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.compact-table th, .compact-table td {
    padding: 0.75rem 1rem;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.compact-table th:first-child, .compact-table td:first-child {
    text-align: left;
}

.compact-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background-color: #f8fafc;
    border-top: 1px solid var(--border-color);
}

.compact-table tr:hover {
    background-color: #f9fafb;
}

.compact-table td strong {
    color: var(--primary-color);
    font-weight: 600;
}

.mt-1 {
    margin-top: 1.5rem;
}

/* Layout restructuring */
.main-layout {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 992px) {
    .main-layout {
        display: grid;
        grid-template-columns: 1fr 400px;
        align-items: start;
    }
}

.left-panel, .right-panel {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.tips-list {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--text-secondary);
    line-height: 1.6;
}
.tips-list li {
    margin-bottom: 0.5rem;
}

/* Fieldset Grouping */
.input-fieldset {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: #fff;
}

.input-fieldset legend {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-color);
    padding: 0 0.5rem;
}

.input-fieldset:last-child {
    margin-bottom: 0;
}

/* Layer Toggles */
.layer-btn {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.layer-btn:hover {
    background-color: #f3f4f6;
}

.layer-btn.active {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Fullscreen Modal */
.visualization-section.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    margin: 0;
    border-radius: 0;
    width: 100vw;
    height: 100vh;
    overflow: auto;
    display: flex;
    flex-direction: column;
    padding: 1rem 2rem;
}

.visualization-section.fullscreen-modal .canvas-container {
    flex: 1;
    height: auto;
    aspect-ratio: auto; /* Let it stretch */
}

/* Update input grid for smaller right panel */
@media (min-width: 768px) {
    .right-panel .input-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Tooltip Styles */
.copy-tooltip {
    position: absolute;
    bottom: 120%; /* Position above the button */
    right: 0;
    width: 250px;
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.4;
    text-align: left;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 50;
    pointer-events: none;
}

/* Little triangle pointing down */
.copy-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 30px; /* Align with the button center roughly */
    border-width: 6px;
    border-style: solid;
    border-color: var(--primary-color) transparent transparent transparent;
}

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