:root {
    --primary-color: #0366d6;
    --secondary-color: #d73a49;
    --text-color: #24292e;
    --light-text: #586069;
    --lighter-text: #6a737d;
    --border-color: #e1e4e8;
    --highlight-bg: #f1f8ff;
    --even-month-bg: #f6f8fa;
    --odd-month-bg: white;
    --boy-prediction: #dbedff;
    --boy-border: #0366d6;
    --girl-prediction: #ffeef0;
    --girl-border: #d73a49;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    --container-width: 1200px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
        sans-serif;
    line-height: 1.5;
    color: var(--text-color);
    font-size: 14px;
    background-color: #f6f8fa;
}

/* Layout system */
.grid {
    display: grid;
}

.flex {
    display: flex;
}

.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 16px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -8px;
}

.col {
    flex: 1 0 0%;
    padding: 0 8px;
}

.col-1-3 {
    flex: 0 0 100%;
    max-width: 100%;
}

.col-2-3 {
    flex: 0 0 100%;
    max-width: 100%;
}

@media (min-width: 768px) {
    .col-1-3 {
        flex: 0 0 33.33333%;
        max-width: 33.33333%;
    }

    .col-2-3 {
        flex: 0 0 66.66667%;
        max-width: 66.66667%;
    }
}

/* Header styles */
.site-header {
    background-color: var(--primary-color);
    width: 100%;
    padding: 16px 0;
    color: white;
    box-shadow: var(--shadow);
}

.site-header h1 {
    margin: 0;
    font-size: 22px;
    text-align: center;
    font-weight: 600;
}

/* Main layout */
.main-container {
    max-width: var(--container-width);
    margin: 16px auto;
    padding: 0 16px;
}

/* Calendar Section */
.calendar-section {
    padding-right: 16px;
}

/* Sidebar Section */
.sidebar-section {
    padding-left: 16px;
}

.sidebar-content {
    height: 100%;
}

.info-text {
    margin-top: 24px;
    padding: 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
}

.info-text h3 {
    color: var(--text-color);
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 600;
}

.info-text ul {
    padding-left: 24px;
    margin-bottom: 16px;
}

.info-text li {
    margin-bottom: 8px;
}

.info-text p {
    margin-bottom: 16px;
}

/* Form styling */
.form {
    background-color: white;
    padding: 16px;
    border: 0px solid var(--border-color);
    border-radius: 6px;
    margin-top: 16px;
}
fieldset {
    border: 0;
}
.form-stacked label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.input-group {
    margin-bottom: 16px;
}

.input-full {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    line-height: 20px;
    transition: border-color 0.15s ease-in-out;
}

.input-full:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.3);
}

select.input-full {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236a737d' viewBox='0 0 12 12'%3E%3Cpath d='M6 8.825c-.2 0-.4-.1-.5-.2l-3.3-3.3c-.3-.3-.3-.8 0-1.1.3-.3.8-.3 1.1 0l2.7 2.7 2.7-2.7c.3-.3.8-.3 1.1 0 .3.3.3.8 0 1.1l-3.3 3.3c-.1.1-.3.2-.5.2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.button {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid rgba(27, 31, 35, 0.15);
    border-radius: 6px;
    background-color: #fafbfc;
    color: var(--text-color);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s ease-in-out;
}

.button-primary {
    background-color: var(--primary-color);
    color: white;
    border-color: rgba(27, 31, 35, 0.15);
    margin-top: 8px;
    width: 100%;
}

.button:hover {
    background-color: #0479ff;
    border-color: rgba(27, 31, 35, 0.15);
}

/* Calendar Container */
.calendar-container {
    margin: 16px 0;
    padding: 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow);
    overflow-x: auto;
    position: relative;
}

/* Month Layout */
.month-row {
    display: flex;
    align-items: stretch;
    margin: 0;
    justify-content: flex-start;
    border-spacing: 0;
    border-collapse: collapse;
}

.month-row .menu-heading {
    padding: 8px;
    font-weight: 600;
    width: 180px;
    min-width: 180px;
    flex: 0 0 180px;
    box-sizing: border-box;
    white-space: normal;
    word-wrap: break-word;
    color: var(--text-color);
}

/* Calendar Day */
.calendar-day {
    position: relative;
    border: 1px solid var(--border-color);
    width: 80px;
    min-width: 80px;
    height: 80px;
    flex: 0 0 80px;
    box-sizing: border-box;
    padding: 0;
}

.text-center {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
}

/* Calendar Elements */
.date-number {
    position: absolute;
    top: 4px;
    left: 6px;
    font-size: 12px;
    color: var(--light-text);
}

.gender-icon {
    position: absolute;
    top: 0px;
    right: 6px;
    font-size: 14px;
}

.fertility-percentage {
    position: absolute;
    top: 50%;
    left: 56%;
    transform: translate(-50%, -50%);
    font-size: 13px;
    padding: 4px;
    font-weight: 500;
}

.fertility-percentage[data-value="10"] {
    font-weight: normal;
    color: #666666;
}

.fertility-percentage[data-value="20"] {
    font-weight: normal;
    color: #333333;
}

.fertility-percentage[data-value="30"] {
    font-weight: 500;
    color: #000000;
}

.fertility-percentage[data-value="54"] {
    font-weight: 600;
    color: #000000;
}

/* Moon Display */
.img-container {
    position: absolute;
    bottom: 4px;
    left: -1px;
    right: -1px;
    height: 24px;
    text-align: center;
    overflow: visible;
}

.img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    position: absolute;
}

.moon-first-day .img {
    transform: translateX(0);
}

.moon-second-day .img {
    transform: translateX(0);
}

/* Visual States */
.odd-month {
    background-color: var(--odd-month-bg);
}

.even-month {
    background-color: var(--even-month-bg);
}

.background-highlight {
    background-color: var(--highlight-bg);
}

.background-highlight .date-number {
    color: var(--primary-color);
    font-weight: 600;
}

.border-primary {
    border: 2px solid var(--boy-border);
}

.border-secondary {
    border: 2px solid var(--secondary-color);
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.modal[style*="flex"] {
    opacity: 1;
}

.modal-content {
    background: white;
    padding: 24px;
    border-radius: 6px;
    text-align: center;
    max-width: 90%;
    margin: 0 auto;
    transform: translateY(20px);
    transition: transform 0.2s ease-out;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.modal[style*="flex"] .modal-content {
    transform: translateY(0);
}

.modal-calculate {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.modal-calculate[style*="flex"] {
    opacity: 1;
}

.modal-calculate .modal-content {
    transform: translateY(0);
}

.modal-form {
    background: white;
    padding: 24px;
    border-radius: 6px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.menu-list-bordered {
    list-style: none;
    padding: 0;
    margin: 24px 0;
}

.menu-list-bordered .menu-item {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.menu-list-bordered .menu-item::before {
    content: "✓";
    color: var(--primary-color);
    margin-right: 8px;
    font-weight: bold;
}

.menu-list-bordered .menu-item:last-child {
    border-bottom: none;
}

.heading {
    margin: 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
}

.heading-primary {
    color: var(--primary-color);
    font-size: 24px;
    font-weight: 700;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* For mobile view, sidebar should be above calendar */
    .sidebar-section {
        order: -1;
        padding: 0 0 16px 0;
    }

    .calendar-section {
        padding-right: 0;
    }

    .calendar-day {
        width: 60px;
        min-width: 60px;
        height: 60px;
        flex: 0 0 60px;
    }

    .month-row .menu-heading {
        width: 120px;
        min-width: 120px;
        flex: 0 0 120px;
        font-size: 13px;
    }

    .modal-content {
        padding: 16px;
    }
}

/* Обновленные CSS правила для новых значений вероятности зачатия */
.fertility-percentage[data-value="30"] {
    font-weight: 600;
    color: #000000;
}

.fertility-percentage[data-value="20"] {
    font-weight: 500;
    color: #000000;
}

.fertility-percentage[data-value="15"] {
    font-weight: 500;
    color: #222222;
}

.fertility-percentage[data-value="8"] {
    font-weight: normal;
    color: #333333;
}

.fertility-percentage[data-value="2"] {
    font-weight: normal;
    color: #666666;
}

/* Добавить к существующим стилям */

.subtitle {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
    font-weight: normal;
}

.legend-section {
    margin-top: 24px;
    padding: 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.legend-section h3 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.legend-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.legend-color {
    width: 45px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #000;
    flex-shrink: 0;
}

.period-icon {
    font-size: 16px;
    width: 22px;
    text-align: center;
}

.male-marker {
    color: var(--primary-color);
    font-size: 18px;
    width: 22px;
    text-align: center;
}

.female-marker {
    color: var(--secondary-color);
    font-size: 18px;
    width: 22px;
    text-align: center;
}

.warning-box {
    margin-top: 20px;
    padding: 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
}

.warning-box strong {
    color: #856404;
}

.info-text ul {
    margin: 10px 0;
    padding-left: 20px;
}

.info-text ul li {
    margin: 5px 0;
    font-size: 13px;
}

@media (max-width: 768px) {
    .legend-grid {
        grid-template-columns: 1fr;
    }

    .subtitle {
        font-size: 12px;
    }
}
