:root {
    --border-color: #000;
    --header-bg: #fff;
    --hover-color: #f0f0f0;
    --weekend-hatch: repeating-linear-gradient(
        45deg,
        #ffffff,
        #ffffff 5px,
        #e0e0e0 5px,
        #e0e0e0 10px
    );
    /* Import main theme variables manually if needed, or rely on inheritance */
    --primary-color: #4f46e5;
    --danger-color: #ef4444;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: #f1f5f9; /* Slate 100 to match app theme better */
    color: #1e293b;
    font-size: 14px;
    /* display: block;  Removed to allow flex layout from global CSS */
}

/* Ensure the sticky header works */
.main-header {
    position: sticky;
    top: 0;
    z-index: 1000;
}

.page-container {
    width: 210mm; /* A4 width */
    min-height: 297mm;
    margin: 24px auto;
    background: white;
    padding: 10mm;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); /* shadow-md */
    border-radius: 8px; /* radius */
}

.sheet-header {
    text-align: center;
    margin-bottom: 10px;
}

.company-info {
    border-bottom: 2px solid #000;
    padding-bottom: 5px;
    margin-bottom: 5px;
}

#company-input {
    width: 100%;
    border: none;
    font-weight: bold;
    font-size: 14px;
    text-align: center;
    font-family: inherit;
    color: inherit;
    background: transparent;
}

#company-input:focus {
    outline: 2px solid var(--primary-color);
    border-radius: 4px;
}

.sheet-title {
    font-size: 20px;
    font-weight: 700;
    margin: 10px 0;
    text-transform: uppercase;
}

.employee-name {
    font-size: 18px;
    font-weight: 700;
    margin: 10px 0;
}

.employee-name input {
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    border: none;
    border-bottom: 1px dashed #ccc;
    width: 300px;
    background: transparent;
    color: inherit;
}

.employee-name input:focus {
    outline: none;
    border-bottom-color: var(--primary-color);
}

.meta-row {
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

.meta-row.space-between {
    justify-content: space-between;
}

.meta-row.align-bottom {
    align-items: flex-end;
}

.month-selector {
    font-size: 16px;
    font-weight: 600;
}

.signature-placeholder {
    border-top: 1px solid #000;
    padding-top: 4px;
    width: 200px;
    text-align: center;
}

/* Updated Buttons */
.controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 20px 0;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-family: inherit;
}

.btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.btn.primary:hover {
    background-color: #4338ca; /* Indigo 700 */
}

.btn.secondary {
    background-color: #64748b;
    color: white;
}

.btn.secondary:hover {
    background-color: #475569;
}

.btn.danger {
    background-color: var(--danger-color);
    color: white;
}

.btn.danger:hover {
    background-color: #dc2626;
}

/* Event Palette */
.event-palette {
    margin: 20px 0;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

.event-palette h3 {
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
}

.palette-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.draggable-event {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: grab;
    background: white;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.draggable-event:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.draggable-event i {
    width: 16px;
    text-align: center;
}

/* Event Colors */
.event-holiday, .row-holiday { background-color: #fee2e2 !important; border-color: #fca5a5; }
.event-paid-leave, .row-paid-leave { background-color: #dbeafe !important; border-color: #93c5fd; }
.event-sick-leave, .row-sick-leave { background-color: #fef9c3 !important; border-color: #fde047; }
.event-missing, .row-missing { background-color: #f3f4f6 !important; border-color: #d1d5db; }
.event-reset { background-color: #fff; border-color: #ccc; }

.event-holiday i { color: #dc2626; }
.event-paid-leave i { color: #2563eb; }
.event-sick-leave i { color: #ca8a04; }
.event-missing i { color: #4b5563; }
.event-reset i { color: #64748b; }

/* Table Styles */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

th, td {
    border: 1px solid var(--border-color);
    padding: 4px;
    text-align: center;
    vertical-align: middle;
}

th {
    background-color: var(--header-bg);
    font-weight: 600;
}

.col-day { width: 40px; }
.col-day-name { width: 40px; }
.col-hours { width: 50px; }
.col-break { width: 50px; }
.col-time { width: 60px; }
.col-signo { width: 80px; }

/* Weekend Style */
.weekend {
    background: var(--weekend-hatch);
}

/* Today Highlight */
.today {
    outline: 2px solid var(--primary-color);
    position: relative;
    z-index: 1;
}

/* Inputs in table */
.time-input {
    width: 100%;
    border: none;
    text-align: center;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    padding: 2px;
}

.time-input:focus {
    outline: 2px solid var(--primary-color);
    background: white;
    border-radius: 2px;
}

/* Drag Over Effect */
tr.drag-over {
    background-color: #e0e7ff !important; /* Indigo 100 */
    outline: 2px dashed var(--primary-color);
}

/* Summary Section */
.summary-section {
    margin-top: 20px;
    page-break-inside: avoid;
}

.summary-table {
    width: auto;
    margin-left: auto;
}

.summary-table td {
    padding: 6px 12px;
    text-align: right;
}

.summary-table input {
    width: 80px;
    text-align: center;
    border: none;
    background: transparent;
    font-weight: bold;
}

/* Print Styles */
@media print {
    @page {
        size: A4;
        margin: 10mm;
    }

    body {
        background: white;
        padding: 0;
    }

    .main-header, .no-print {
        display: none !important;
    }

    .page-container {
        width: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none;
        min-height: auto;
    }

    .sheet-header {
        margin-bottom: 5mm;
    }
    
    /* Ensure colors print */
    .row-holiday { background-color: #fee2e2 !important; -webkit-print-color-adjust: exact; }
    .row-paid-leave { background-color: #dbeafe !important; -webkit-print-color-adjust: exact; }
    .row-sick-leave { background-color: #fef9c3 !important; -webkit-print-color-adjust: exact; }
    .row-missing { background-color: #f3f4f6 !important; -webkit-print-color-adjust: exact; }
    .weekend { background: var(--weekend-hatch) !important; -webkit-print-color-adjust: exact; }
}
