/* ==========================================================================
   Last Menstrual Period (LMP) Calculator
   Premium Mobile-Friendly Responsive UI, Cycle Wheel & Pregnancy Timeline Styles
   ========================================================================== */

.lmpc-container {
    --lmpc-primary: #e11d48;
    --lmpc-primary-dark: #be123c;
    --lmpc-primary-light: #fff1f2;
    --lmpc-secondary: #8b5cf6;
    --lmpc-success: #10b981;
    --lmpc-warning: #f59e0b;
    --lmpc-info: #0ea5e9;
    --lmpc-dark: #0f172a;
    --lmpc-card-bg: #ffffff;
    --lmpc-border: #ffe4e6;
    --lmpc-border-subtle: #e2e8f0;
    --lmpc-text: #1e293b;
    --lmpc-muted: #64748b;
    --lmpc-radius: 14px;
    --lmpc-shadow: 0 10px 25px -5px rgba(225, 29, 72, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
    --lmpc-glow: 0 0 0 3px rgba(225, 29, 72, 0.2);

    font-family: inherit;
    color: var(--lmpc-text);
    margin-bottom: 2.5rem;
}

/* Hero Section */
.lmpc-hero {
    background: linear-gradient(135deg, #be123c 0%, #e11d48 50%, #9333ea 100%);
    color: #ffffff;
    padding: 2.2rem 2rem;
    border-radius: var(--lmpc-radius);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 14px 30px rgba(225, 29, 72, 0.25);
    text-align: center;
}

.lmpc-hero::after {
    content: '';
    position: absolute;
    right: -40px;
    bottom: -40px;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.lmpc-hero-title {
    font-size: 1.85rem;
    font-weight: 800;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    letter-spacing: -0.02em;
    text-align: center;
}

.lmpc-hero-subtitle {
    font-size: 0.98rem;
    color: #fff1f2;
    margin: 0 auto;
    max-width: 800px;
    line-height: 1.55;
    text-align: center;
}

/* Tabs */
.lmpc-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: #fff1f2;
    padding: 0.4rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--lmpc-border);
}

.lmpc-tab-btn {
    flex: 1;
    min-width: 170px;
    padding: 0.8rem 1rem;
    border: none;
    background: transparent;
    border-radius: 9px;
    font-weight: 600;
    font-size: 0.92rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.lmpc-tab-btn.active {
    background: #ffffff;
    color: var(--lmpc-primary-dark);
    box-shadow: 0 3px 10px rgba(225, 29, 72, 0.15);
    font-weight: 700;
}

/* Quick Presets Bar */
.lmpc-presets-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.85rem 1rem;
    background: var(--lmpc-primary-light);
    border: 1px dashed #fb7185;
    border-radius: 10px;
}

.lmpc-presets-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--lmpc-primary-dark);
}

.lmpc-preset-chip {
    background: #ffffff;
    border: 1px solid #fecdd3;
    color: #9f1239;
    padding: 0.3rem 0.65rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.lmpc-preset-chip:hover {
    background: var(--lmpc-primary);
    color: #ffffff;
    border-color: var(--lmpc-primary);
}

/* Main Grid Layout */
.lmpc-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 410px;
    gap: 1.75rem;
    align-items: start;
}

@media (max-width: 991px) {
    .lmpc-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Cards */
.lmpc-card {
    background: var(--lmpc-card-bg);
    border: 1px solid var(--lmpc-border-subtle);
    border-radius: var(--lmpc-radius);
    padding: 1.75rem;
    box-shadow: var(--lmpc-shadow);
    margin-bottom: 1.5rem;
}

.lmpc-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--lmpc-border-subtle);
}

.lmpc-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--lmpc-dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lmpc-card-badge {
    font-size: 0.75rem;
    background: var(--lmpc-primary-light);
    color: var(--lmpc-primary-dark);
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-weight: 700;
}

/* Form Fields */
.lmpc-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 640px) {
    .lmpc-form-grid {
        grid-template-columns: 1fr;
    }
}

.lmpc-col-full {
    grid-column: 1 / -1;
}

.lmpc-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.lmpc-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lmpc-label-sub {
    font-size: 0.75rem;
    font-weight: normal;
    color: var(--lmpc-muted);
}

.lmpc-input {
    width: 100%;
    padding: 0.75rem 0.85rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    background: #ffffff;
    border: 1.5px solid var(--lmpc-border-subtle);
    border-radius: 9px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.lmpc-input:focus {
    outline: none;
    border-color: var(--lmpc-primary);
    box-shadow: var(--lmpc-glow);
}

.lmpc-select {
    width: 100%;
    padding: 0.75rem 0.85rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: #0f172a;
    background: #ffffff;
    border: 1.5px solid var(--lmpc-border-subtle);
    border-radius: 9px;
    transition: all 0.2s ease;
    cursor: pointer;
    box-sizing: border-box;
}

.lmpc-select:focus {
    outline: none;
    border-color: var(--lmpc-primary);
    box-shadow: var(--lmpc-glow);
}

/* Right Summary Sticky */
.lmpc-summary-sticky {
    position: sticky;
    top: 20px;
}

.lmpc-summary-card {
    background: #ffffff;
    border: 2px solid var(--lmpc-primary);
    border-radius: var(--lmpc-radius);
    padding: 1.75rem;
    box-shadow: 0 14px 35px -5px rgba(225, 29, 72, 0.15);
}

.lmpc-summary-header {
    text-align: center;
    margin-bottom: 1.25rem;
}

.lmpc-highlight-label {
    font-size: 0.88rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--lmpc-muted);
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.lmpc-highlight-val {
    font-size: 1.95rem;
    font-weight: 800;
    color: var(--lmpc-primary-dark);
    line-height: 1.2;
    margin-bottom: 0.4rem;
}

.lmpc-status-badge {
    font-size: 0.92rem;
    font-weight: 800;
    padding: 0.35rem 0.95rem;
    border-radius: 20px;
    display: inline-block;
    transition: all 0.3s ease;
}

.lmpc-status-fertile { background: #dcfce7; color: #15803d; }
.lmpc-status-ovulation { background: #fef3c7; color: #b45309; }
.lmpc-status-pregnant { background: #fce7f3; color: #be123c; }

/* Visual Stage Cycle Meter */
.lmpc-meter-box {
    margin: 1.25rem 0;
    padding: 1rem;
    background: #fff1f2;
    border-radius: 10px;
    border: 1px solid var(--lmpc-border);
}

.lmpc-meter-track {
    height: 14px;
    border-radius: 7px;
    background: #e2e8f0;
    position: relative;
    overflow: hidden;
    margin: 0.75rem 0 0.45rem 0;
}

.lmpc-meter-fill {
    height: 100%;
    background: linear-gradient(90deg, #e11d48 0%, #8b5cf6 100%);
    border-radius: 7px;
    width: 0%;
    transition: width 0.5s ease;
}

.lmpc-meter-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--lmpc-muted);
}

/* Feature Showcase Grid */
.lmpc-feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.lmpc-feature-card {
    background: #f8fafc;
    border: 1px solid var(--lmpc-border-subtle);
    border-radius: 9px;
    padding: 0.85rem;
    text-align: center;
}

.lmpc-feature-card .lbl {
    font-size: 0.78rem;
    color: var(--lmpc-muted);
    font-weight: 700;
    text-transform: uppercase;
}

.lmpc-feature-card .val {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--lmpc-primary-dark);
    margin-top: 0.2rem;
}

/* Metric Breakdown List */
.lmpc-breakdown-list {
    margin-bottom: 1.5rem;
}

.lmpc-breakdown-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0;
    border-bottom: 1px dashed var(--lmpc-border-subtle);
    font-size: 0.88rem;
}

.lmpc-breakdown-row:last-child {
    border-bottom: none;
}

.lmpc-breakdown-val {
    font-weight: 700;
    color: #0f172a;
}

/* Future Cycles Forecast Table */
.lmpc-forecast-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin-top: 1rem;
}

.lmpc-forecast-table th {
    background: #fff1f2;
    padding: 0.65rem 0.75rem;
    text-align: left;
    font-weight: 700;
    border: 1px solid var(--lmpc-border);
    color: var(--lmpc-primary-dark);
}

.lmpc-forecast-table td {
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--lmpc-border-subtle);
}

.lmpc-forecast-table tr.current-cycle {
    background: #fff1f2;
    font-weight: 700;
}

/* Action Buttons */
.lmpc-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: 1.25rem;
}

.lmpc-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.92rem;
    font-weight: 700;
    border-radius: 9px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.lmpc-btn-print {
    background: #0f172a;
    color: #ffffff;
}

.lmpc-btn-print:hover {
    background: #1e293b;
}

.lmpc-btn-copy {
    background: #fff1f2;
    color: var(--lmpc-primary-dark);
    border: 1px solid #fecdd3;
}

.lmpc-btn-copy:hover {
    background: #ffe4e6;
}

.lmpc-btn-reset {
    background: transparent;
    color: #ef4444;
    font-size: 0.82rem;
    padding: 0.4rem;
}

.lmpc-btn-reset:hover {
    text-decoration: underline;
}

@media (max-width: 640px) {
    .lmpc-hero {
        padding: 1.25rem 1rem;
    }
    .lmpc-hero-title {
        font-size: 1.35rem;
    }
    .lmpc-card {
        padding: 1.1rem 0.85rem;
    }
    .lmpc-tabs {
        flex-direction: column;
    }
    .lmpc-tab-btn {
        width: 100%;
        min-width: 100%;
    }
    .lmpc-presets-bar {
        padding: 0.65rem 0.75rem;
    }
    .lmpc-preset-chip {
        font-size: 0.78rem;
        padding: 0.35rem 0.5rem;
    }
    .lmpc-feature-grid {
        grid-template-columns: 1fr;
    }
    .lmpc-forecast-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    .lmpc-highlight-val {
        font-size: 1.6rem;
    }
    .lmpc-btn {
        font-size: 0.85rem;
        padding: 0.75rem 0.85rem;
    }
}

@media (max-width: 420px) {
    .lmpc-hero-title {
        font-size: 1.15rem;
        flex-direction: column;
        gap: 0.35rem;
    }
    .lmpc-hero-subtitle {
        font-size: 0.85rem;
    }
    .lmpc-highlight-val {
        font-size: 1.4rem;
    }
}

/* Print Area */
@media print {
    body * {
        visibility: hidden;
    }
    #lmpc-print-area, #lmpc-print-area * {
        visibility: visible;
    }
    #lmpc-print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 25px;
        background: #ffffff;
        color: #000000;
    }
    .lmpc-actions, .lmpc-tabs, .lmpc-presets-bar {
        display: none !important;
    }
}

/* ==========================================================================
   Dark Mode Support (TulBD Unified Dark Theme)
   ========================================================================== */
[data-theme="dark"] .lmpc-container,
.dark-theme .lmpc-container,
body.dark-theme .lmpc-container {
    --lmpc-primary: #f43f5e;
    --lmpc-primary-dark: #fb7185;
    --lmpc-border: #334155;
    --lmpc-border-subtle: #1e293b;
    --lmpc-muted: #94a3b8;
    color: #f8fafc;
}

[data-theme="dark"] .lmpc-hero,
.dark-theme .lmpc-hero,
body.dark-theme .lmpc-hero {
    background: linear-gradient(135deg, #1e1b4b 0%, #311333 50%, #4c0519 100%);
    border-color: #4c1d2e;
}

[data-theme="dark"] .lmpc-hero-title,
.dark-theme .lmpc-hero-title,
body.dark-theme .lmpc-hero-title {
    color: #ffffff;
}

[data-theme="dark"] .lmpc-hero-subtitle,
.dark-theme .lmpc-hero-subtitle,
body.dark-theme .lmpc-hero-subtitle {
    color: #fecdd3;
}

[data-theme="dark"] .lmpc-tabs,
.dark-theme .lmpc-tabs,
body.dark-theme .lmpc-tabs {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .lmpc-tab-btn,
.dark-theme .lmpc-tab-btn,
body.dark-theme .lmpc-tab-btn {
    color: #94a3b8;
}

[data-theme="dark"] .lmpc-tab-btn:hover,
.dark-theme .lmpc-tab-btn:hover,
body.dark-theme .lmpc-tab-btn:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .lmpc-tab-btn.active,
.dark-theme .lmpc-tab-btn.active,
body.dark-theme .lmpc-tab-btn.active {
    background: #0f172a;
    color: #fb7185;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .lmpc-presets-bar,
.dark-theme .lmpc-presets-bar,
body.dark-theme .lmpc-presets-bar {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .lmpc-presets-label,
.dark-theme .lmpc-presets-label,
body.dark-theme .lmpc-presets-label {
    color: #cbd5e1;
}

[data-theme="dark"] .lmpc-preset-chip,
.dark-theme .lmpc-preset-chip,
body.dark-theme .lmpc-preset-chip {
    background: #0f172a;
    border-color: #334155;
    color: #f8fafc;
}

[data-theme="dark"] .lmpc-preset-chip:hover,
.dark-theme .lmpc-preset-chip:hover,
body.dark-theme .lmpc-preset-chip:hover {
    background: #4c0519;
    border-color: #f43f5e;
    color: #fecdd3;
}

[data-theme="dark"] .lmpc-card,
.dark-theme .lmpc-card,
body.dark-theme .lmpc-card {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .lmpc-card-title,
.dark-theme .lmpc-card-title,
body.dark-theme .lmpc-card-title {
    color: #f8fafc;
}

[data-theme="dark"] .lmpc-card-subtitle,
.dark-theme .lmpc-card-subtitle,
body.dark-theme .lmpc-card-subtitle {
    color: #94a3b8;
}

[data-theme="dark"] .lmpc-label,
.dark-theme .lmpc-label,
body.dark-theme .lmpc-label {
    color: #cbd5e1;
}

[data-theme="dark"] .lmpc-input,
.dark-theme .lmpc-input,
body.dark-theme .lmpc-input {
    background: #0f172a;
    border-color: #334155;
    color: #f8fafc;
}

[data-theme="dark"] .lmpc-input:focus,
.dark-theme .lmpc-input:focus,
body.dark-theme .lmpc-input:focus {
    border-color: #f43f5e;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.25);
}

[data-theme="dark"] .lmpc-input option,
.dark-theme .lmpc-input option,
body.dark-theme .lmpc-input option {
    background: #0f172a;
    color: #f8fafc;
}

[data-theme="dark"] .lmpc-range-val,
.dark-theme .lmpc-range-val,
body.dark-theme .lmpc-range-val {
    color: #fb7185;
}

[data-theme="dark"] .lmpc-highlight-box,
.dark-theme .lmpc-highlight-box,
body.dark-theme .lmpc-highlight-box {
    background: linear-gradient(135deg, #311333 0%, #4c0519 100%);
    border-color: #701a35;
}

[data-theme="dark"] .lmpc-highlight-val,
.dark-theme .lmpc-highlight-val,
body.dark-theme .lmpc-highlight-val {
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .lmpc-highlight-sub,
.dark-theme .lmpc-highlight-sub,
body.dark-theme .lmpc-highlight-sub {
    color: #fecdd3;
}

[data-theme="dark"] .lmpc-feature-card,
.dark-theme .lmpc-feature-card,
body.dark-theme .lmpc-feature-card {
    background: #0f172a;
    border-color: #334155;
}

[data-theme="dark"] .lmpc-feature-card .lbl,
.dark-theme .lmpc-feature-card .lbl,
body.dark-theme .lmpc-feature-card .lbl {
    color: #94a3b8;
}

[data-theme="dark"] .lmpc-feature-card .val,
.dark-theme .lmpc-feature-card .val,
body.dark-theme .lmpc-feature-card .val {
    color: #fb7185;
}

[data-theme="dark"] .lmpc-breakdown-row,
.dark-theme .lmpc-breakdown-row,
body.dark-theme .lmpc-breakdown-row {
    border-color: #334155;
    color: #cbd5e1;
}

[data-theme="dark"] .lmpc-breakdown-val,
.dark-theme .lmpc-breakdown-val,
body.dark-theme .lmpc-breakdown-val {
    color: #f8fafc;
}

[data-theme="dark"] .lmpc-meter-track,
.dark-theme .lmpc-meter-track,
body.dark-theme .lmpc-meter-track {
    background: #334155;
}

[data-theme="dark"] .lmpc-meter-labels,
.dark-theme .lmpc-meter-labels,
body.dark-theme .lmpc-meter-labels {
    color: #94a3b8;
}

[data-theme="dark"] .lmpc-forecast-table th,
.dark-theme .lmpc-forecast-table th,
body.dark-theme .lmpc-forecast-table th {
    background: #311333;
    border-color: #4c1d2e;
    color: #fecdd3;
}

[data-theme="dark"] .lmpc-forecast-table td,
.dark-theme .lmpc-forecast-table td,
body.dark-theme .lmpc-forecast-table td {
    background: #0f172a;
    border-color: #334155;
    color: #cbd5e1;
}

[data-theme="dark"] .lmpc-forecast-table tr.current-cycle td,
.dark-theme .lmpc-forecast-table tr.current-cycle td,
body.dark-theme .lmpc-forecast-table tr.current-cycle td {
    background: rgba(244, 63, 94, 0.15);
    color: #ffffff;
    border-color: #f43f5e;
}

[data-theme="dark"] .lmpc-btn-print,
.dark-theme .lmpc-btn-print,
body.dark-theme .lmpc-btn-print {
    background: #334155;
    color: #f8fafc;
}

[data-theme="dark"] .lmpc-btn-print:hover,
.dark-theme .lmpc-btn-print:hover,
body.dark-theme .lmpc-btn-print:hover {
    background: #475569;
}

[data-theme="dark"] .lmpc-btn-copy,
.dark-theme .lmpc-btn-copy,
body.dark-theme .lmpc-btn-copy {
    background: #311333;
    border-color: #701a35;
    color: #fecdd3;
}

[data-theme="dark"] .lmpc-btn-copy:hover,
.dark-theme .lmpc-btn-copy:hover,
body.dark-theme .lmpc-btn-copy:hover {
    background: #4c0519;
}
