/* Homepage Layout - Inline Tools */
.calc-tools-wrapper {
    display: grid;
    grid-template-columns: 220px 1fr 280px;
    gap: 1.5rem;
    align-items: start;
    justify-content: center;
}

/* Left sidebar - tools */
.tools-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    position: sticky;
    top: 5rem;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.tool-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-dim);
}

.tool-card.active {
    border-color: var(--accent);
    background: rgba(212, 165, 116, 0.08);
}

.tool-card-icon {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(212, 165, 116, 0.08);
    border-radius: var(--radius);
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.tool-card-icon svg {
    width: 1.2rem;
    height: 1.2rem;
    stroke: #d4a574;
    transition: stroke 0.2s ease;
}

.tool-card:hover .tool-card-icon svg {
    stroke: #e8c49a;
}

.tool-card:hover .tool-card-icon {
    background: rgba(212, 165, 116, 0.18);
}

.tool-card-content h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.1rem;
    text-align: left;
}

.tool-card-content p {
    font-size: 0.68rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.tool-card.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Center - main tool area */
.tool-main-area {
    min-height: 400px;
}

.tool-header {
    margin-bottom: 1rem;
}

.tool-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.tool-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Right sidebar */
.right-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 5rem;
}

.right-sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.right-sidebar-card h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.right-sidebar-card .article-link {
    display: block;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.2s ease;
}

.right-sidebar-card .article-link:last-child {
    border-bottom: none;
}

.right-sidebar-card .article-link:hover {
    padding-left: 0.25rem;
}

.right-sidebar-card .article-link h4 {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.15rem;
    line-height: 1.3;
}

.right-sidebar-card .article-link p {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.sleep-fact {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    font-style: italic;
}

.sleep-fact-source {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.68rem;
    color: var(--text-muted);
    font-style: normal;
}

/* Responsive */
@media (max-width: 1100px) {
    .calc-tools-wrapper {
        grid-template-columns: 200px 1fr;
    }
    .right-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .calc-tools-wrapper {
        grid-template-columns: 1fr;
    }
    .tools-sidebar {
        position: static;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    .tool-card-content p {
        display: none;
    }
}

@media (max-width: 480px) {
    .tools-sidebar {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Ad slots (hidden for now) */
.ad-slot,
.product-section {
    display: none;
}

/* Compact calculator layout */
.calc-card .calc-main {
    display: flex;
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.calc-card .calc-time-input {
    flex: 1 1 60%;
    text-align: center;
}

.calc-card .age-selector {
    flex: 1 1 35%;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.calc-card .age-selector label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.calc-card .age-selector select {
    flex: 1;
}

@media (max-width: 560px) {
    .calc-card .calc-main {
        flex-direction: column;
    }
    .calc-card .calc-time-input,
    .calc-card .age-selector {
        flex: 1 1 100%;
    }
}

/* Age tabs with ranges - vertical layout */
.age-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.age-tab {
    display: flex;
    justify-content: space-between;
    gap: 0;
    padding: 0.35rem 0.8rem;
    align-items: center;
    border-radius: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.age-tab:hover {
    border-color: var(--accent-dim);
}

.age-tab.active {
    background: rgba(212, 165, 116, 0.15);
    border-color: var(--accent);
}

.age-tab-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
}

.age-tab-range {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.age-tab.active .age-tab-label {
    color: var(--accent);
}

.age-tab.active .age-tab-range {
    color: var(--accent-dim);
}

/* Age selector layout */
.age-selector {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.age-selector label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Latency row layout fix */
.latency-row {
    width: 100%;
}

.latency-row-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.latency-label {
    white-space: nowrap;
    flex-shrink: 0;
}

.latency-row-inner input[type="range"] {
    flex: 1;
    min-width: 0;
}

.latency-value {
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 3rem;
    text-align: right;
}
