/**
 * IVF Due Date Calculator Styles
 * Tool: ivf-due-date-calculator
 */

.ivfdd-hidden {
    display: none !important;
}

#ivfDueDateCalculator .tool-layout-split {
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
}

#ivfDueDateCalculator .tool-input-panel,
#ivfDueDateCalculator .tool-result-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

#ivfDueDateCalculator .tool-input-panel {
    overflow-x: clip;
}

.ivfdd-input-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.ivfdd-mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 6px;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
    background: #faf9f7;
}

.ivfdd-mode-btn {
    border: 1px solid #e8e4dc;
    background: #fff;
    color: #5f5a56;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ivfdd-mode-btn:hover {
    border-color: #d4c67a;
    color: #2d2a26;
}

.ivfdd-mode-btn.is-active {
    border-color: #d4af37;
    background: linear-gradient(135deg, #d4af37 0%, #b8942d 100%);
    color: #fff;
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.25);
}

.ivfdd-mode-panel {
    display: none;
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(45, 42, 38, 0.06);
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: hidden;
}

.ivfdd-mode-panel.is-active {
    display: block;
}

.ivfdd-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.ivfdd-input-group + .ivfdd-input-group {
    margin-top: 14px;
}

.ivfdd-input-group label {
    font-size: 14px;
    font-weight: 600;
    color: #2d2a26;
}

.ivfdd-date-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    background: #faf9f7;
    box-sizing: border-box;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ivfdd-date-wrap:hover {
    border-color: #d4c67a;
}

.ivfdd-date-wrap:focus-within {
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.ivfdd-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
    display: block;
    padding: 12px 14px;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    background: #faf9f7;
    color: #2d2a26;
    font-size: 15px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ivfdd-date-wrap .ivfdd-input[type="date"] {
    inline-size: 100%;
    width: 100%;
    max-inline-size: 100%;
    max-width: 100%;
    min-inline-size: 0;
    min-width: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none !important;
    padding: 12px 10px 12px 12px;
    background: transparent;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.01em;
    font-size: 16px !important; /* Prevent mobile Safari zoom */
    -webkit-min-logical-width: 0;
}

.ivfdd-date-wrap .ivfdd-input[type="date"]::-webkit-datetime-edit,
.ivfdd-date-wrap .ivfdd-input[type="date"]::-webkit-date-and-time-value,
.ivfdd-date-wrap .ivfdd-input[type="date"]::-webkit-datetime-edit-fields-wrapper {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ivfdd-date-wrap .ivfdd-input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 1;
    margin: 0;
    padding: 0;
}

.ivfdd-input:hover {
    border-color: #d4c67a;
}

.ivfdd-input:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
    background: #fff;
}

.ivfdd-help {
    margin: 0;
    font-size: 12px;
    color: #8b7355;
    line-height: 1.5;
}

.ivfdd-action-row {
    display: flex;
    gap: 8px;
}

.ivfdd-action-row .tool-btn {
    flex: 1;
}

.ivfdd-result-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ivfdd-waiting {
    text-align: center;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 20px;
    color: #8b7355;
}

.ivfdd-waiting i {
    font-size: 28px;
    color: #d4af37;
    display: block;
    margin-bottom: 8px;
}

.ivfdd-waiting p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}

.ivfdd-main-card {
    text-align: center;
    background: linear-gradient(135deg, #fdfbf5 0%, #faf6ec 100%);
    border: 2px solid #d4af37;
    border-radius: 14px;
    padding: 24px 18px;
    box-shadow: 0 2px 12px rgba(212, 175, 55, 0.12);
}

.ivfdd-main-label {
    font-size: 13px;
    color: #8b7355;
    margin-bottom: 6px;
    font-weight: 600;
}

.ivfdd-main-value {
    font-size: 30px;
    color: #b8942d;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.02em;
}

.ivfdd-main-weekday {
    margin-top: 6px;
    font-size: 15px;
    color: #5f5a56;
}

.ivfdd-main-dday {
    margin-top: 10px;
    display: inline-block;
    padding: 6px 14px;
    border-radius: 16px;
    background: #d4af37;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.ivfdd-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.ivfdd-summary-item {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
    padding: 12px;
}

.ivfdd-summary-title {
    font-size: 12px;
    color: #8b7355;
    margin-bottom: 4px;
}

.ivfdd-summary-value {
    font-size: 15px;
    color: #2d2a26;
    font-weight: 600;
    line-height: 1.4;
}

.ivfdd-progress-section,
.ivfdd-chart-section,
.ivfdd-detail-section {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(45, 42, 38, 0.06);
}

.ivfdd-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #2d2a26;
    margin-bottom: 12px;
}

.ivfdd-section-title i {
    color: #d4af37;
}

.ivfdd-progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    color: #5f5a56;
    margin-bottom: 10px;
}

.ivfdd-progress-track {
    position: relative;
    width: 100%;
    height: 16px;
    border-radius: 999px;
    background: #e8e4dc;
    overflow: visible;
}

.ivfdd-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, #f5c542 0%, #d4af37 55%, #b8942d 100%);
    transition: width 0.4s ease;
}

.ivfdd-progress-marker {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #d4af37;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.3);
    transition: left 0.4s ease;
    z-index: 2;
}

.ivfdd-progress-labels {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #8b7355;
}

.ivfdd-chart-wrap {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
}

.ivfdd-chart-wrap canvas {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    max-height: 220px;
}

.ivfdd-chart-fallback {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #e8e4dc;
    background: #faf9f7;
    font-size: 12px;
    color: #8b7355;
    line-height: 1.5;
}

.ivfdd-table-wrap {
    overflow-x: auto;
}

.ivfdd-detail-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 0;
    table-layout: fixed;
}

.ivfdd-detail-table th,
.ivfdd-detail-table td {
    border: 1px solid #e8e4dc;
    padding: 10px 12px;
    text-align: left;
    font-size: 13px;
    color: #2d2a26;
    word-break: break-word;
}

.ivfdd-detail-table th {
    background: #faf9f7;
    font-weight: 700;
}

.ivfdd-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ivfdd-actions .tool-btn {
    flex: 1;
    min-width: 180px;
}

.ivfdd-download-btn {
    white-space: nowrap;
}

/* Excel button guard (UI-guard marker) */
.ivfdd-actions .tool-btn-excel {
    color: #fff;
    background: #59ab79;
    border-color: #59ab79;
}

.ivfdd-actions .tool-btn-excel:hover {
    color: #fff;
    background: #4f9f70;
    border-color: #4f9f70;
}

.ivfdd-result-disclaimer {
    display: flex;
    gap: 8px;
    padding: 12px;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
    background: #faf9f7;
    color: #5f5a56;
    font-size: 12px;
    line-height: 1.55;
}

.ivfdd-result-disclaimer i {
    color: #d4af37;
    margin-top: 1px;
    flex-shrink: 0;
}

/* Readability for in-description reference links */
.tool-description a[href*="http"] {
    word-break: break-word;
}

@media (max-width: 900px) {
    #ivfDueDateCalculator .tool-layout-split {
        grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
    }

    .ivfdd-input-group input:not([type="radio"]):not([type="checkbox"]),
    .ivfdd-input-group select {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .ivfdd-main-value {
        font-size: 26px;
    }

    .ivfdd-summary-grid {
        grid-template-columns: 1fr 1fr;
    }

    .ivfdd-chart-wrap {
        height: 200px;
    }

    .ivfdd-chart-wrap canvas {
        max-height: 200px;
    }
}

@media (max-width: 768px) {
    #ivfDueDateCalculator .tool-layout-split {
        grid-template-columns: 1fr;
    }

    .ivfdd-mode-switch {
        grid-template-columns: 1fr;
    }

    .ivfdd-action-row {
        flex-direction: column;
    }

    .ivfdd-summary-grid {
        grid-template-columns: 1fr;
    }

    .ivfdd-actions {
        flex-direction: column;
    }

    .ivfdd-actions .tool-btn {
        min-width: 0;
        width: 100%;
    }

    .ivfdd-main-card {
        padding: 20px 14px;
    }

    .ivfdd-main-value {
        font-size: 22px;
    }

    .ivfdd-chart-wrap {
        height: 180px;
    }

    .ivfdd-chart-wrap canvas {
        max-height: 180px;
    }

    .ivfdd-detail-table th,
    .ivfdd-detail-table td {
        font-size: 12px;
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .ivfdd-input-section,
    .ivfdd-mode-panel,
    .ivfdd-input-group {
        max-width: 100%;
        overflow-x: hidden;
    }

    .ivfdd-mode-btn {
        font-size: 13px;
        padding: 9px 10px;
    }

    .ivfdd-input {
        font-size: 14px;
        padding: 11px 12px;
    }

    .ivfdd-date-wrap .ivfdd-input[type="date"] {
        font-size: 16px !important;
        padding: 11px 8px 11px 10px !important;
    }

    .ivfdd-main-value {
        font-size: 20px;
    }

    .ivfdd-summary-value {
        font-size: 14px;
    }

    .ivfdd-progress-labels {
        font-size: 10px;
    }

    .ivfdd-chart-wrap {
        height: 170px;
    }

    .ivfdd-chart-wrap canvas {
        max-height: 170px;
    }

    .ivfdd-detail-table th,
    .ivfdd-detail-table td {
        font-size: 11px;
        padding: 7px 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ivfdd-mode-btn,
    .ivfdd-progress-fill,
    .ivfdd-progress-marker {
        transition: none !important;
    }
}
