:root {
    --primary-color: #4CAF50;
    --primary-light: #e0f7e9;
    --secondary-color: #2ecc71;
    --accent-color: #ff9900;
    --danger-color: #ff6b6b;
    --text-color: #333;
    --light-text-color: #fff;
    --bg-color: #f5f6fa;
    --card-bg-color: #fff;
    --border-color: #ddd;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --error-color: #e74c3c;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    background-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><g fill="%23000000" fill-opacity="0.01"><rect x="50" width="50" height="50"/><rect y="50" width="50" height="50"/></g></svg>');
}

.container {
    max-width: 1200px;
    margin: auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeInDown 0.8s ease-out;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

header p {
    font-size: 1.1rem;
    color: #666;
}

.layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
}

.card {
    background-color: var(--card-bg-color);
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 15px;
    box-shadow: 0 10px 20px var(--shadow-color);
    transition: transform 0.3s, box-shadow 0.3s;
    animation: fadeInUp 0.5s ease-out forwards;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12);
}

.card h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

label {
    display: block;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input[type="date"],
input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-family: var(--font-family);
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.error-message {
    color: var(--error-color);
    background-color: #fdd;
    border: 1px solid var(--error-color);
    border-radius: 8px;
    padding: 10px;
    margin-top: 1rem;
    font-size: 0.9rem;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

button {
    width: 100%;
    padding: 14px;
    margin-top: 1.5rem;
    border-radius: 8px;
    border: none;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: var(--light-text-color);
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

#result {
    font-weight: 500;
    line-height: 1.6;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

#calendar-month-year {
    font-size: 1.2rem;
    font-weight: 600;
}

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.day-of-week {
    text-align: center;
    font-weight: 600;
    color: #999;
    font-size: 0.9rem;
}

.day {
    padding: 14px 0;
    text-align: center;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    transition: transform 0.2s, background-color 0.3s;
}

.day:hover {
    transform: scale(1.1);
}

.level-0 { background: var(--primary-light); }
.level-1 { background: #b2f2c8; }
.level-2 { background: #ffe066; }
.level-3 { background: #ffa94d; }
.level-4 { background: var(--danger-color); color: var(--light-text-color); }

.menses { border: 3px solid var(--accent-color); }
.today { outline: 3px solid #333; }

.chart {
    display: flex;
    align-items: flex-end;
    height: 160px;
    gap: 8px;
}

.bar {
    flex: 1;
    background-color: var(--primary-color);
    border-radius: 4px;
    transition: height 0.4s ease-in-out;
}

.info-section {
    margin-top: 2rem;
}

.tab-nav {
    display: flex;
    gap: 10px;
    margin-bottom: -1px;
}

.tab-button {
    padding: 12px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    background-color: var(--bg-color);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-button.active {
    background-color: var(--card-bg-color);
    border-color: var(--border-color) var(--border-color) var(--card-bg-color);
}

.tab-button:not(.active):hover {
    background-color: #e9e9e9;
}

.tab-content {
    display: none;
    animation: fadeInUp 0.5s ease-out forwards;
}

.legend {
    list-style: none;
    padding: 0;
}

.legend li {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.color-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    margin-right: 10px;
}

.menses-legend { border: 3px solid var(--accent-color); }

.warning, .info-box, .danger-box {
    padding: 12px;
    border-radius: 10px;
    margin-top: 1rem;
}

.warning { background-color: #fff3cd; }
.info-box { background-color: #f1f3f5; }
.danger-box { background-color: #ffe3e3; }

@media(max-width: 768px){
    .layout {
        grid-template-columns: 1fr;
    }
    header h1 {
        font-size: 2rem;
    }
    .tab-button {
        padding: 10px 15px;
        font-size: 1rem;
    }
}
