/* Calculator Modal Styles */

.calculator-modal {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.calc-sidebar {
    width: 250px;
    background: #1a1a24;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.calc-nav-item {
    padding: 12px 20px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    border-left: 3px solid transparent;
    transition: all 0.2s;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.calc-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.calc-nav-item.active {
    background: rgba(78, 205, 196, 0.1);
    border-left-color: #4ecdc4;
    color: #4ecdc4;
}

.calc-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: #15151e;
}

.calc-category {
    display: none;
}

.calc-category.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Accordion / Spoiler Styles */
.calc-spoiler {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.calc-spoiler-header {
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.2s;
}

.calc-spoiler-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.calc-spoiler-icon {
    transition: transform 0.3s ease;
    font-size: 12px;
}

.calc-spoiler.open .calc-spoiler-icon {
    transform: rotate(180deg);
}

.calc-spoiler-content {
    padding: 20px;
    display: none;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.calc-spoiler.open .calc-spoiler-content {
    display: block;
    animation: slideDown 0.3s ease;
}

/* Tool Grid - for multiple calculators in a spoiler */
.calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 15px;
}

.calc-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
}

/* Compact form fields in calculator */
.calc-card .form-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.calc-card .form-label {
    margin-bottom: 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    flex: 1;
}

.calc-card .form-input {
    width: 90px;
    padding: 4px 8px;
    font-size: 12px;
    height: 28px;
    flex-shrink: 0;
}

.calc-card select.form-input {
    width: 90px;
    padding: 0px 4px;
}

.calc-card h4 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 13px;
    color: #4ecdc4;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 6px;
}

.calc-result {
    margin-top: 10px;
    padding: 8px;
    background: rgba(78, 205, 196, 0.1);
    border: 1px solid rgba(78, 205, 196, 0.2);
    border-radius: 6px;
    color: #4ecdc4;
    font-weight: bold;
    text-align: center;
    font-size: 14px;
}

.calc-result span {
    font-size: 16px;
    color: #fff;
}

.unit-switch {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Modal layout wrapper */
.calculator-modal-wrapper {
    display: flex;
    height: 100%;
    /* Take remaining height */
    width: 100%;
    margin: 0;
}

/* ---- Favorite Star Button ---- */
.calc-card {
    position: relative;
}

.calc-fav-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.25);
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.2s, transform 0.15s;
    z-index: 2;
}

.calc-fav-btn:hover {
    color: #ffd700;
    transform: scale(1.2);
}

.calc-fav-btn.active {
    color: #ffd700;
}

/* Push h4 to accommodate the star button */
.calc-card h4 {
    padding-right: 24px;
}

/* ---- Mini dashboard cards (favorites / recents) ---- */
.calc-dash-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 18px 12px 14px;
    min-height: 100px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    cursor: pointer;
}

.calc-dash-mini:hover {
    background: rgba(78, 205, 196, 0.08);
    border-color: rgba(78, 205, 196, 0.3);
    transform: translateY(-2px);
}

.calc-mini-icon {
    font-size: 28px;
    margin-bottom: 8px;
    line-height: 1;
}

.calc-dash-mini .calc-fav-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 14px;
}

/* ---- Card highlight when navigating from dashboard ---- */
@keyframes calcCardHighlight {
    0%   { box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.7); }
    70%  { box-shadow: 0 0 0 6px rgba(78, 205, 196, 0.2); }
    100% { box-shadow: none; }
}

.calc-card-highlight {
    animation: calcCardHighlight 1.2s ease forwards;
}