body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh; /* Fallback for older browsers */
    min-height: 100dvh;
    padding: 1rem;
}

.controls {
    margin-bottom: 2rem;
    background: #fff;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.date-picker-group,
.text-input-group {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Allow inputs to grow and fill space */
}

#start-date-input,
#target-date-input,
#company-name-input,
#project-name-input,
#activity-name-input {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

input.invalid {
    border-color: #e74c3c; /* A clear red for errors */
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

#download-btn {
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#download-btn:hover {
    background-color: #0056b3;
}

#download-btn:disabled {
    background-color: #6c757d; /* A grey color for disabled state */
    cursor: not-allowed;
}

/* This is the main card styling */
#card-container {
    max-width: 450px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    margin-bottom: 2rem; /* Add space at the bottom */
}

.card-header {
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.logo {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    margin-right: 15px;
    flex-shrink: 0;
}

.header-text {
    display: flex;
    flex-direction: column;
}

.company-name {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0;
}

.project-name {
    font-size: 1.1rem;
    margin: 2px 0;
    font-weight: 500;
    opacity: 0.9;
}

.countdown-title {
    font-size: 0.9rem;
    margin: 0;
    opacity: 0.8;
}

.period-container {
    margin-top: 6px;
}

.period-line {
    font-size: 0.9rem; /* Slightly larger font size */
    margin: 2px 0 0 0;
    opacity: 0.9;
    font-weight: 500;
}

.card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    text-align: center;
    width: 100%;
    padding-top: 10px;
}

.stat-value {
    display: block;
    font-size: 2.2rem;
    font-weight: bold;
}

.stat-label {
    font-size: 0.8rem;
    opacity: 0.9;
    text-transform: uppercase;
}

/* --- Responsive Design --- */
@media (max-width: 600px) {
    body {
        padding: 0.5rem;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        max-width: 450px;
    }

    .card-header {
        flex-direction: column;
        text-align: center;
    }

    .logo {
        margin-right: 0;
        margin-bottom: 1rem;
    }

    .stat-value {
        font-size: 1.8rem;
    }
}

/* --- Force Desktop View for Download --- */
/* This class will be added via JS to override responsive styles during image capture */
.force-desktop-view {
    /* Ensure the card has a fixed width for the capture */
    width: 450px !important;
    max-width: 450px !important;
}

.force-desktop-view .card-header {
    flex-direction: row !important;
    text-align: left !important;
}

.force-desktop-view .logo {
    margin-right: 15px !important;
    margin-bottom: 0 !important;
}
