:root {
    --pistachio-dark: #b1c499;
    --eb-dark: #2C3E50;
    --white: #ffffff;
    --gray-bg: #f4f4f4;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --danger: #E74C3C;
    --warning: #F1C40F;
    /* Task Manager Vars */
    --prio-high: #e74c3c;
    --prio-med: #f39c12;
    --prio-low: #3498db;
}

/* =========================================
   GLOBAL RESET & BASE STYLES
   ========================================= */
* { box-sizing: border-box; }

body {
    background-color: var(--gray-bg);
    font-family: 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.main-header {
    background-color: var(--pistachio-dark);
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.nav-logo { height: 70px; width: auto; }

.header-left { display: flex; align-items: center; flex: 1; }

.brand-name {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--eb-dark);
    line-height: 1;
    text-align: center;
    flex: 2;
    margin: 0;
}

.header-right { display: flex; align-items: center; justify-content: flex-end; flex: 1; }

.user-info { display: flex; align-items: center; gap: 15px; }
.user-name { font-weight: 600; color: var(--eb-dark); }
.logout-pill {
    background: var(--eb-dark);
    color: white;
    padding: 8px 20px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: opacity 0.3s;
}
.logout-pill:hover { opacity: 0.8; }

/* =========================================
   UI COMPONENTS (Buttons & Inputs)
   ========================================= */
.btn-primary { 
    background: var(--pistachio-dark); 
    color: white; 
    border: none; 
    padding: 10px 20px; 
    border-radius: 5px; 
    cursor: pointer; 
    font-size: 0.9rem; 
    text-decoration: none; 
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}
.btn-primary:hover { background: #9ab080; }

.btn-secondary { 
    background: #e0e0e0; 
    color: #555; 
    border: none; 
    padding: 10px 20px; 
    border-radius: 5px; 
    cursor: pointer; 
    text-decoration: none; 
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.btn-secondary:hover { background: #d0d0d0; }

.btn-danger { 
    background: var(--danger); 
    color: white; 
    border: none; 
    padding: 10px 20px; 
    border-radius: 5px; 
    cursor: pointer; 
    font-size: 0.9rem;
}
.btn-danger:hover { background: #c0392b; }

.action-btn { 
    background: none; 
    border: none; 
    font-size: 1.1rem; 
    cursor: pointer; 
    margin: 0 5px; 
    color: #888; 
    transition: 0.2s; 
}
.action-btn:hover { transform: scale(1.1); color: var(--eb-dark); }

/* =========================================
   GRID LAYOUT SYSTEM (Desktop/Landscape)
   ========================================= */

.dashboard-wrapper {
    padding: 20px;
    width: 100%;
    max-width: 1800px; /* Increased for 4 columns */
    margin: 0 auto;
    flex: 1;
    display: grid;
    /* UPDATED: 4 Columns -> News | Tasks | Inbox | Birthday */
    grid-template-columns: 4fr 3fr 3fr 2fr; 
    grid-template-rows: auto auto;
    gap: 20px;
    grid-template-areas: 
        "news tasks inbox bday" 
        "links links links links";
}

.announcement-panel { grid-area: news; }
.task-panel         { grid-area: tasks; } /* New Task Area */
.inbox-panel        { grid-area: inbox; }
.birthday-panel     { grid-area: bday; }
.quick-links-section { grid-area: links; }

.panel, .quick-links-section {
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    border-top: 5px solid var(--pistachio-dark);
    display: block; 
}

.quick-links-section {
    background: #e8e8e8;
    border: 1px solid #ddd;
    border-top: none; 
}

.panel-header, .section-header {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: var(--eb-dark);
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.info-list { list-style: none; padding: 0; margin: 0; }
.info-list li {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.info-list li:last-child { border-bottom: none; }

.news-link {
    color: var(--eb-dark);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}
.news-link:hover {
    color: var(--pistachio-dark);
    text-decoration: underline;
}

/* Dashboard Inbox Styles */
.dash-msg-link {
    color: var(--eb-dark);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
    display: block;
    width: 100%;
}
.dash-msg-link:hover { color: var(--pistachio-dark); }

.msg-unread {
    background-color: #f9fff9; 
    border-left: 3px solid var(--pistachio-dark);
    padding-left: 10px !important;
}

.date-badge {
    font-size: 0.8rem;
    background: #eee;
    padding: 2px 8px;
    border-radius: 4px;
    color: #666;
    white-space: nowrap;
}

/* NEW: Styles for Task Widget */
.task-checkbox {
    cursor: pointer;
    font-size: 1.2rem;
    color: #ccc;
    transition: 0.2s;
}
.task-checkbox:hover { color: var(--pistachio-dark); transform: scale(1.1); }

.task-subject {
    font-weight: 600;
    color: var(--eb-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.priority-dot { height: 8px; width: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.prio-High { background: var(--prio-high); }
.prio-Medium { background: var(--prio-med); }
.prio-Low { background: var(--prio-low); }

.birthday-item { font-weight: 600; color: var(--eb-dark); }
.no-data-message { padding: 20px 0; text-align: center; color: #888; font-style: italic; font-size: 0.95rem; }

/* =========================================
   TILE GRID (Square & Responsive)
   ========================================= */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr); 
    gap: 15px;
}

.tile {
    background: var(--white);
    border-radius: 8px;
    padding: 10px;
    text-decoration: none;
    text-align: center;
    aspect-ratio: 1 / 1; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(177, 196, 153, 0.4);
    border-color: var(--pistachio-dark);
}

.tile-icon { font-size: 2rem; margin-bottom: 5px; } 
.tile-title { color: var(--eb-dark); font-weight: 600; font-size: 0.8rem; line-height: 1.1;}

/* Site Footer */
.site-footer {
    text-align: center;
    padding: 20px;
    font-size: 0.8rem;
    color: var(--eb-dark);
    border-top: 1px solid #ddd;
    margin-top: auto;
    background: var(--gray-bg);
}

/* =========================================
   MOBILE / PORTRAIT OVERRIDES
   ========================================= */
@media (max-width: 900px) {
    .brand-name { display: none; }
    .nav-logo { height: 60px; }
    .dashboard-wrapper { display: flex; flex-direction: column; gap: 20px; }
    
    /* UPDATED ORDER: News -> Tasks -> Inbox -> Birthday -> Links */
    .announcement-panel { order: 1; }
    .task-panel         { order: 2; }
    .inbox-panel        { order: 3; }
    .birthday-panel     { order: 4; }
    .quick-links-section { order: 5; }
    
    .tile-grid { grid-template-columns: repeat(2, 1fr); }
}

/* =========================================
   MODALS
   ========================================= */
.modal-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.5); display: none; justify-content: center; 
    align-items: center; z-index: 2000; 
}
.glass-effect { backdrop-filter: blur(8px); background: rgba(255, 255, 255, 0.2); }
.modal-window { 
    background: white; padding: 30px; border-radius: 15px; 
    width: 90%; max-width: 800px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); 
    max-height: 90vh; overflow-y: auto; position: relative;
}

@media (orientation: portrait) {
    .modal-window {
        width: 85%;
        max-width: 600px;
    }
}

.glow-window { border: 1px solid rgba(177, 196, 153, 0.5); box-shadow: 0 0 20px rgba(177, 196, 153, 0.3); }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid #eee; padding-bottom: 15px;}
.close-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #999; transition: 0.2s; }
.close-btn:hover { color: var(--danger); transform: scale(1.1); }
.announcement-content { font-size: 1rem; line-height: 1.6; color: #333; }
.announcement-content img { max-width: 100%; height: auto; }

/* =========================================
   ADMIN PAGE STYLES (Manage News)
   ========================================= */
.admin-container { 
    width: 95%; 
    max-width: 1300px; 
    margin: 40px auto; 
    padding: 20px; 
}

.top-bar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px; 
}

/* News List */
.news-list { 
    background: white; 
    border-radius: 8px; 
    box-shadow: var(--shadow); 
    overflow: hidden; 
}

.news-item { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 20px; 
    border-bottom: 1px solid #eee; 
    transition: 0.2s; 
}

.news-item:hover { background: #f9fff5; }
.news-item:last-child { border-bottom: none; }

.news-meta { display: flex; flex-direction: column; gap: 5px; }
.news-title { font-weight: bold; font-size: 1.1rem; color: var(--eb-dark); }
.news-date { font-size: 0.8rem; color: #888; }

/* Status Badges */
.status-badge { 
    font-size: 0.7rem; padding: 3px 8px; border-radius: 12px; 
    text-transform: uppercase; display: inline-block; width: fit-content; font-weight: 600;
}
.status-draft { background: #eee; color: #666; border: 1px solid #ccc; }
.status-published { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }

/* Quill Editor Overrides */
#editor-container { height: 300px; background: white; border-radius: 0 0 8px 8px; }
.ql-toolbar { background: #f8f8f8; border-color: #ddd !important; border-radius: 8px 8px 0 0; }
.ql-container { border-color: #ddd !important; border-radius: 0 0 8px 8px; font-family: 'Segoe UI', sans-serif !important; font-size: 1rem !important; }

/* =========================================
   TIMESHEET UPDATES & TABLES
   ========================================= */

/* Sticky Filter Bar */
.filter-bar {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
    /* Sticky Magic */
    position: sticky;
    top: 90px; /* Adjust based on your main-header height */
    z-index: 900;
    border: 1px solid #eee;
}

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-weight: 600; color: var(--eb-dark); font-size: 0.9rem; }
.form-group input { padding: 8px; border: 1px solid #ddd; border-radius: 4px; font-family: inherit; }

/* Search Input Styling (Updated: No Icon) */
.search-group {
    flex-grow: 1; /* Takes remaining space */
    min-width: 200px;
}

.search-input {
    width: 100%;
    padding: 10px; /* Standard padding */
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    /* Removed background icon and left-padding */
}

/* Alert Rows (Errors / Sickness) */
.alert-row {
    background-color: #ffe6e6 !important; /* Light Red Background */
    border-left: 4px solid var(--danger);
}

.alert-row td {
    color: #c0392b; /* Dark Red Text */
    font-weight: 500;
}

/* Active Row (Currently Working) */
.active-row {
    background-color: #f0fdf4 !important; /* Light Green */
    border-left: 4px solid var(--pistachio-dark);
}

.active-row td {
    color: var(--eb-dark);
}

.missing-data {
    color: var(--danger);
    font-weight: bold;
    font-style: italic;
}

/* Timesheet Table Structure */
.timesheet-section {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 30px;
    border-top: 4px solid var(--pistachio-dark);
}

.employee-header {
    background: #f9f9f9;
    padding: 10px 15px;
    border-left: 4px solid var(--eb-dark);
    margin: 20px 0 10px 0;
    font-weight: 700;
    color: var(--eb-dark);
    display: flex;
    justify-content: space-between;
}

.dept-header {
    font-size: 1.5rem;
    color: var(--pistachio-dark);
    margin-top: 30px;
    border-bottom: 2px solid #eee;
    padding-bottom: 5px;
}

/* Responsive Table Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto; /* Horizontal scroll on mobile */
    -webkit-overflow-scrolling: touch;
}

.ts-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* Forces scroll on small screens */
}

.ts-table th, .ts-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.ts-table th {
    background-color: var(--eb-dark);
    color: white;
    font-weight: 600;
    white-space: nowrap;
}

.ts-table tr:hover { background-color: #f1f7ed; transition: 0.2s; }

/* Status Colors */
.note-text { font-style: italic; color: #666; font-size: 0.9rem; }
.absence-text { color: var(--danger); font-weight: 600; }
.weekend-row { background-color: #fafafa; }

.total-row td {
    font-weight: bold;
    background-color: #e8e8e8;
    color: var(--eb-dark);
    border-top: 2px solid #ccc;
}

/* =========================================
   EDIT BUTTON & MODAL INPUTS
   ========================================= */

/* Edit Button */
.btn-edit {
    background-color: var(--eb-dark);
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
}

.btn-edit:hover {
    background-color: var(--pistachio-dark);
}

/* Modal Inputs */
.modal-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.9);
}

.modal-input:focus {
    outline: none;
    border-color: var(--pistachio-dark);
    box-shadow: 0 0 5px rgba(177, 196, 153, 0.5);
}

/* Glass Modal Specifics */
.glass-effect {
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.3); /* Darker overlay for contrast */
}

/* Animation for Edit Fields */
#editFields {
    transition: opacity 0.3s ease;
}

/* Modal Z-Index Hierarchy */
#readModal   { z-index: 2000; }
#editModal   { z-index: 2000; }
#confirmModal { z-index: 3000; } /* Must be higher than Edit */
#messageModal { z-index: 2200; } /* Must be highest */

/* =========================================
   NEW: LIKE SECTION STYLES
   ========================================= */
.like-container {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 15px;
}

.like-button {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #ccc;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.2s;
    padding: 0;
}

.like-button:hover {
    transform: scale(1.15);
}

.like-button.liked i {
    color: var(--danger);
    font-weight: 900; /* Force FontAwesome Solid */
}

.like-count {
    font-size: 0.95rem;
    color: #555;
    font-weight: 600;
}