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

body {
    font-family: Arial, sans-serif;
    background-color: #f9f9f9;
    color: #333;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: white;
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header {
    margin-bottom: 30px;
    border-bottom: 2px solid #000;
    padding-bottom: 15px;
}

h1 {
    font-size: 24px;
    margin-bottom: 15px;
}

.controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.controls label {
    font-weight: bold;
}

.controls input[type="month"],
.controls button {
    padding: 8px 12px;
    border: 1px solid #333;
    border-radius: 2px;
    font-size: 14px;
    background-color: white;
    cursor: pointer;
}

.controls button {
    background-color: #fff;
    font-weight: bold;
    transition: background-color 0.2s;
}

.controls button:hover {
    background-color: #f0f0f0;
}

.controls button:focus {
    outline: 2px solid #333;
    outline-offset: 2px;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tracker-header h2 {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

.tracker-container {
    overflow-x: auto;
}

.tracker-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 12px;
    table-layout: fixed;
}

.tracker-table thead {
    background-color: #f9f9f9;
}

.tracker-table th,
.tracker-table td {
    border: 1px solid #999;
    padding: 2px 4px;
    text-align: center;
    height: 50px;
    vertical-align: middle;
}

.tracker-table th {
    font-weight: bold;
    font-size: 11px;
}

.tracker-table .habit-name {
    text-align: left;
    font-weight: bold;
    width: 150px;
    max-width: 150px;
    padding-left: 8px;
    box-sizing: border-box;
    position: relative;
    white-space: normal;
    word-wrap: break-word;
}

.habit-row .habit-name {
    padding: 0;
    display: flex;
    align-items: center;
}

.habit-label {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 2px;
    cursor: pointer;
    font-size: 14px;
    -webkit-user-select: none;
    user-select: none;
    transition: background-color 0.2s;
    min-height: 32px;
    display: flex;
    align-items: center;
}

.habit-row .habit-label {
    font-size: 14px;
    flex: 1;
    padding: 4px;
    min-height: auto;
    border: none;
    background-color: transparent;
    white-space: normal;
    word-wrap: break-word;
}


.habit-label:hover {
    background-color: #f5f5f5;
}

.habit-label:focus {
    outline: 2px solid #333;
    outline-offset: 2px;
    background-color: #f5f5f5;
}

.habit-label.editing {
    border: 2px solid #333;
    padding: 7px 9px;
    background-color: white;
}

.habit-label input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 14px;
    font-family: Arial, sans-serif;
}

.delete-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    visibility: hidden;
    transition: visibility 0.2s;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.habit-row .delete-btn {
    width: 20px;
    height: 20px;
    font-size: 14px;
    margin-left: 2px;
}

.habit-row:hover .delete-btn {
    visibility: visible;
}

.delete-btn:focus {
    visibility: visible;
    outline: 2px solid #333;
    outline-offset: 2px;
}

.delete-btn:hover {
    transform: scale(1.1);
}

.tracker-table .day-header {
    width: 35px;
    font-size: 10px;
}

.tracker-table .day-number {
    font-size: 10px;
    font-weight: bold;
}

.tracker-table .day-name {
    font-size: 9px;
    color: #666;
}

.tracker-table .weekend {
    border: 2px dashed #333;
}

.tracker-table .checkbox {
    cursor: pointer;
    width: 20px;
    height: 20px;
    margin: 0;
    padding: 0;
    display: block;
    margin: auto;
}

/* Print Styles */
@media print {
    body {
        background-color: white;
        padding: 0;
    }

    .container {
        max-width: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none;
        page-break-after: avoid;
    }

    .header {
        margin-bottom: 20px;
        padding-bottom: 10px;
    }

    h1 {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .controls {
        display: none;
    }

    .habits-container {
        display: none;
    }

    .tracker-container {
        overflow-x: visible;
        page-break-inside: avoid;
    }

    .tracker-table {
        font-size: 11px;
        width: 100%;
    }

    .tracker-table th,
    .tracker-table td {
        padding: 3px 1px;
        height: 20px;
    }

    .tracker-table .habit-name {
        width: 100px;
    }

    .tracker-table .day-header {
        width: 20px;
    }

    .tracker-table .checkbox {
        width: 18px;
        height: 18px;
        border: 1px solid #333;
        background-color: white;
    }
}

/* Landscape orientation preference */
@media print {
    @page {
        size: landscape;
        margin: 10mm;
    }
}
