:root {
    /* Print dimensions */
    --print-width: 48in;
    --print-height: 36in;
    --month-label-width: 0.8in;
    --columns: 32;
    --rows: 12;
}

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

body {
    font-family: Arial, sans-serif;
    padding: 20px;
    background-color: #f5f5f5;
    min-height: 100vh; /* Ensure body takes at least full viewport height */
    display: flex; /* Enable flexbox */
    flex-direction: column; /* Stack children vertically */
}

.calendar-container {
    width: 100%;
    /* margin: 0 auto; /* Removed - not needed for vertical fill */
    background: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    padding: 10px;
    flex-grow: 1; /* Allow container to grow and fill available space */
}

h1 {
    margin: 0;
    text-align: left;
    font-size: clamp(24px, 4vw, 32px);
    color: #0066cc;
}

.calendar {
    display: flex;
    width: 100%;
    flex-grow: 1; /* Allow calendar grid to fill vertical space */
}

.month-labels {
    display: grid;
    grid-template-rows: repeat(12, 1fr);
    width: clamp(40px, 5vw, 60px);
}

.month-name {
    background-color: #0066cc;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(12px, 1.5vw, 14px);
    font-weight: bold;
    border-bottom: 1px solid #fff;
    padding: 8px 4px;
}

.days-grid {
    flex: 1;
    display: grid;
    grid-template-rows: repeat(12, 1fr);
    border: 1px solid #ccc;
    border-left: none;
    min-width: 0; /* Prevent grid overflow */
}

.month-row {
    display: grid;
    grid-template-columns: repeat(31, 1fr);
    border-bottom: 1px solid #ccc;
}

.day {
    border-right: 1px solid #ccc;
    display: flex;
    flex-direction: column;
    padding: 4px;
    position: relative;
    /* aspect-ratio: 1/1; /* Removed to prevent horizontal overflow */
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.day.editable:hover {
    outline: 2px solid #0066cc;
    
}

.day.selected {
    outline: 2px solid #fe6b6b;
    outline-offset: -1px;
}

.day.editable.selected:hover {
    outline: 2px solid #fe6b6b;
    outline-offset: -1px;
}

.custom-text {
    font-size: 11px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% - 8px);
    text-align: center;
    padding: 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
    max-height: 3.6em; /* 3 lines * 1.2 line-height */
}

.date, .day-name {
    z-index: 1;
}

.edit-popup {
    position: fixed;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    display: none;
}

.edit-popup.active {
    display: block;
}

.edit-popup input[type="text"] {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.edit-popup input[type="color"] {
    width: 100%;
    height: 40px;
    margin-bottom: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.edit-popup button {
    padding: 8px 15px;
    margin: 0 5px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.edit-popup button.save {
    background: #0066cc;
    color: white;
}

.edit-popup button.clear {
    background: #ff4444;
    color: white;
}

#editModeToggle {
    background-color: #0066cc;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
    font-weight: 500;
}

#editModeToggle:hover {
    background-color: #0052a3;
}

#editModeToggle.active {
    background-color: #ff4444;
}

#editModeToggle.active:hover {
    background-color: #ff2222;
}

#buyDigitalBtn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
    font-weight: 500;
}

#buyDigitalBtn:hover {
    background-color: #45a049;
}

.public-holiday {
    background-color: #ffebeb !important;
    position: relative;
}

.holiday-indicator {
    position: relative;
    width: 100%;
    height: 100%;
}

.holiday-symbol {
    position: absolute;
    bottom: 2px;
    right: 2px;
    color: #ff6b6b;
    font-size: 12px;
    line-height: 1;
}

.holiday-name {
    position: absolute;
    top: 20px; /* Below date and day name */
    left: 0;
    width: 100%;
    color: #ff6b6b;
    font-size: 9px;
    line-height: 1.1;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 4px;
}

.public-holiday::after {
    display: none;
}

.holiday-indicator {
    z-index: 2;
}

.date, .day-name {
    z-index: 3;
}

.custom-text {
    z-index: 1;
}

.day.selected {
    z-index: 4;
}

.date {
    position: absolute;
    top: 3px;
    left: 4px;
    font-size: clamp(10px, 1.2vw, 12px);
    font-weight: bold;
}

.day-name {
    font-size: clamp(8px, 1vw, 10px);
    color: #666;
    position: absolute;
    top: 4px;
    right: 4px;
}

.weekend {
    background-color: #e6f3ff;
}

/* Download button styles */
.download-options {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

.download-button {
    background-color: #0066cc;
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    font-size: 16px;
}

.download-button:hover {
    background-color: #0052a3;
}

/* Small screens - truncate custom text to prevent squishing */
@media (max-width: 1572px) {
    .custom-text {
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        display: block;
        -webkit-line-clamp: unset;
        -webkit-box-orient: unset;
    }
}

/* Print styles - completely different dimensions */
@media print {
    body {
        padding: 0;
    }

    .calendar-container {
        width: 48in;
        height: 36in;
        max-width: none;
        box-shadow: none;
    }

    h1 {
        font-size: 1.5in;
        padding: 0.3in;
    }

    .month-labels {
        width: 0.8in;
    }

    .month-name {
        font-size: 0.25in;
        padding: 0.1in;
    }

    .day {
        padding: 0.1in;
    }

    .date {
        font-size: 0.2in;
        top: 0.1in;
        left: 0.1in;
    }

    .day-name {
        font-size: 0.15in;
        top: 0.1in;
        right: 0.1in;
    }

    .download-button {
        display: none;
    }

    @page {
        size: 48in 36in;
        margin: 0;
    }

    .public-holiday {
        background-color: #ffebeb !important;
    }

    .public-holiday::after {
        font-size: 0.1in;
        bottom: 0.05in;
        right: 0.05in;
    }
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    gap: 20px;
}

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

#auth-container {
    display: flex;
    align-items: center;
    margin-left: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.user-info span {
    font-weight: 500;
    color: #333;
}

#logoutBtn {
    padding: 6px 12px;
    background-color: #ff4444;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

#logoutBtn:hover {
    background-color: #ff2222;
}

.year-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.year-selector label {
    font-size: 16px;
    font-weight: bold;
    color: #0066cc;
}

.year-selector select {
    padding: 8px 16px;
    font-size: 16px;
    border: 2px solid #0066cc;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
}

.year-selector select:focus {
    outline: none;
    border-color: #004999;
    box-shadow: 0 0 0 2px rgba(0,102,204,0.2);
}

.edit-popup textarea {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: none;
    height: 70px;
    font-family: inherit;
    font-size: 14px;
}

/* Purchase and payment styles */
.purchase-button {
    background-color: #4CAF50;
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    font-size: 16px;
    margin-right: 10px;
}

.purchase-button:hover {
    background-color: #45a049;
}

.payment-success {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.payment-success.active {
    display: flex;
}

.success-content {
    position: relative;
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.close-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-icon:hover {
    color: #333;
    background-color: #f0f0f0;
}

.success-content h2 {
    color: #4CAF50;
    margin-bottom: 1rem;
}

.pdf-download-options {
    display: flex;
    gap: 10px;
    margin-top: 1.5rem;
}

#pdfSizeSelect {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.download-button {
    background-color: #4052b5;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.download-button:hover {
    background-color: #3445a3;
}

.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-indicator p {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.pdf-download-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.user-profile {
    position: relative;
    margin-left: auto;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #0066cc;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    overflow: hidden;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-initial {
    color: white;
    font-size: 18px;
    font-weight: bold;
    display: none;
}

.user-avatar img[src=""] {
    display: none;
}

.user-avatar img[src=""] + .user-initial {
    display: block;
}

.user-dropdown {
    position: absolute;
    top: 45px;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 12px;
    min-width: 200px;
    display: none;
    z-index: 1000;
}

.user-profile.active .user-dropdown {
    display: block;
}

.user-dropdown .user-info {
    display: flex;
    flex-direction: column;
    padding: 0;
    background: none;
    margin-bottom: 12px;
    border-bottom: 1px solid #eee;
    padding-bottom: 12px;
}

.user-dropdown .user-info span {
    margin-bottom: 4px;
}

.user-email {
    font-size: 14px;
    color: #666;
    font-weight: normal;
}

#logoutBtn {
    width: 100%;
    padding: 8px;
    background-color: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

#logoutBtn:hover {
    background-color: #ff4444;
    color: white;
}

#auth-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-left: auto;
}

#downloadPDFContainer {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-left: 10px;
}

#pdfSizeSelect {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    min-width: 120px;
}

#downloadPDFBtn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
    font-weight: 500;
}

#downloadPDFBtn:hover {
    background-color: #45a049;
}

.g_id_signin {
    display: inline-block;
}

.g_id_signin iframe {
    margin: 0 !important;
}

.location-selector {
    display: flex;
    gap: 10px;
    align-items: center;
}

.location-selector select {
    padding: 8px 16px;
    font-size: 14px;
    border: 2px solid #0066cc;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    min-width: 150px;
}

.location-selector select:disabled {
    background-color: #f5f5f5;
    border-color: #ccc;
    cursor: not-allowed;
}

.holiday-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.holiday-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    font-size: 14px;
}

.holiday-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin: 0;
}

.location-selector {
    display: flex;
    gap: 8px;
}

.location-selector select {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    min-width: 120px;
    background-color: white;
}

.location-selector select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

.location-selector select:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0,102,204,0.1);
}

.landing-link {
    font-size: 14px;
    color: #0066cc;
    text-decoration: none;
    margin-left: 10px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.landing-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.website-url {
    text-align: center;
    color: #666;
    font-size: 10px;
    font-weight: 500;
    opacity: 0.8;
} 