/* --- MODERN DARK THEME - PILNĀ VERSIJA --- */

/* Google Fonts imports, lai iegūtu modernu fontu */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

/* Globālie stili */
body {
    font-family: 'Poppins', sans-serif;
    background-color: #121212;
    color: #e0e0e0;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

a {
    color: #03dac6;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #ffffff;
}

.container {
    width: 100%;
    max-width: 1100px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    border-bottom: 1px solid #2a2a2a;
    padding-bottom: 20px;
}

header h1 {
    color: #ffffff;
    font-weight: 700;
}

/* Paneļu stili */
.panel {
    background-color: #1e1e1e;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.2);
}

.panel h2, .panel h3 {
    margin-top: 0;
    color: #ffffff;
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
    margin-bottom: 20px;
    font-weight: 600;
}

/* Formu elementi (input, textarea, select) */
input[type="text"],
input[type="password"],
textarea,
select {
    background-color: #2c2c2c;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 12px;
    font-family: 'Poppins', sans-serif;
    font-size: 1em;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #03dac6;
    box-shadow: 0 0 0 3px rgba(3, 218, 198, 0.2);
}

/* Pogu stili */
button {
    background: linear-gradient(90deg, #03dac6, #018786);
    color: #121212;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(3, 218, 198, 0.3);
}

/* Uzdevumu saraksts */
.task-item {
    background-color: #2a2a2a;
    border-left: 5px solid #03dac6;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.task-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-text {
    font-size: 1.1em;
    font-weight: 600;
}

/* Stili login lapai */
.login-form-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}
.login-form {
    width: 100%;
    max-width: 400px;
}

.error {
    color: #cf6679;
    background-color: rgba(207, 102, 121, 0.1);
    border: 1px solid #cf6679;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
}

/* Atskaišu tabulas */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
th, td {
    padding: 12px 15px;
    border: 1px solid #2a2a2a;
    text-align: left;
}
th {
    background-color: #2c2c2c;
    color: #ffffff;
    font-weight: 600;
}
tr:nth-child(even) {
    background-color: #212121;
}

/* Tiešsaistes Statusa Panelis */
#live-status-panel h2 {
    color: #03dac6;
}
#live-count {
    font-size: 1.2em;
    font-weight: 600;
}
#live-user-list ul {
    list-style-type: none;
    padding-left: 0;
}
#live-user-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #2c2c2c;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 8px;
    border-left: 3px solid #03dac6;
}
.status-indicator {
    width: 10px;
    height: 10px;
    background-color: #2ecc71;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.7);
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    70% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* Komentāru sadaļa (bijušais čats) */
.chat-container {
    margin-top: 20px;
    border-top: 1px solid #333;
    padding-top: 20px;
}
.chat-message {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 80%;
    background-color: #373737;
    margin-bottom: 10px;
}
.chat-message p {
    margin: 0;
    word-wrap: break-word;
}
.chat-message strong {
    display: block;
    font-size: 0.8em;
    margin-bottom: 4px;
    color: #aaa;
}
.chat-form {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}
.chat-form textarea {
    flex-grow: 1;
}
.chat-form button {
    flex-shrink: 0;
}

/* Sānjoslas navigācija */
.app-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}
.sidebar {
    width: 240px;
    background-color: #1e1e1e;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #2a2a2a;
    flex-shrink: 0;
}
.sidebar h3 {
    color: #ffffff;
    margin-top: 0;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}
.sidebar ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}
.sidebar li a {
    display: block;
    padding: 12px 15px;
    border-radius: 8px;
    color: #e0e0e0;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease;
    margin-bottom: 5px;
}
.sidebar li a:hover {
    background-color: #2c2c2c;
    color: #ffffff;
}
.sidebar li a.active {
    background-color: #03dac6;
    color: #121212;
}
.main-content {
    flex-grow: 1;
}

/* Ritjoslas stili */
body::-webkit-scrollbar {
    width: 10px;
}
body::-webkit-scrollbar-track {
    background: #1e1e1e;
}
body::-webkit-scrollbar-thumb {
    background-color: #555;
    border-radius: 10px;
    border: 2px solid #1e1e1e;
}
.chat-messages-static {
  scrollbar-width: thin;
  scrollbar-color: #555 #2a2a2a;
}

/* Datuma ievades lauki */
input[type="date"] {
    background-color: #2c2c2c;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 12px;
    height: 49px;
    box-sizing: border-box;
    color-scheme: dark;
}
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

/* ========================================================== */
/* ATJAUNOTIE STILI: Darbinieku izvēlnei ar Checkboxiem       */
/* ========================================================== */

.checkbox-group {
    border: 1px solid #444;
    border-radius: 8px;
    padding: 5px;
    margin-top: 5px;
    max-height: 150px;
    overflow-y: auto;
}

.checkbox-item {
    display: block; /* Lai katrs elements aizņem savu rindu */
}

/* Label tagad ir galvenais interaktīvais elements */
.checkbox-item label {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative; /* Nepieciešams, lai pozicionētu ::after elementu */
}

/* Uzbraucot ar peli, mainām fonu */
.checkbox-item label:hover {
    background-color: #2c2c2c;
}

/* Paslēpjam īsto, neglīto checkbox */
.checkbox-item input[type="checkbox"] {
    display: none;
}

/* Veidojam mūsu pašu kastīti ar ::before pseido-elementu */
.checkbox-item label::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid #888;
    border-radius: 4px;
    margin-right: 12px;
    transition: all 0.2s ease;
}

/* Kad checkbox ir iezīmēts, mainām kastītes izskatu */
.checkbox-item input[type="checkbox"]:checked + label::before {
    background-color: #03dac6;
    border-color: #03dac6;
}

/* Pievienojam ķeksīti ar ::after pseido-elementu, kad ir iezīmēts */
.checkbox-item input[type="checkbox"]:checked + label::after {
    content: '✔';
    font-size: 14px;
    color: #121212;
    position: absolute;
    left: 15px; /* Pielāgota pozīcija */
    top: 50%;
    transform: translateY(-50%);
}
/* Stili statusa indikatoram (mirgojošais punkts) */

.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 10px;
    vertical-align: middle; /* Nedaudz pielīdzina punktu pie teksta centra */
    animation: blink-animation 1.5s infinite;
}

.status-indicator.online {
    background-color: #28a745; /* Zaļš */
    box-shadow: 0 0 8px #28a745;
}

.status-indicator.offline {
    background-color: #dc3545; /* Sarkans */
    box-shadow: 0 0 8px #dc3545;
}

/* CSS animācija, kas liek punktam mirgot */
@keyframes blink-animation {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
    100% {
        opacity: 1;
    }
}
/* Stili uzdevuma laika informācijai */
.task-time-info {
    font-size: 0.9em;
    color: #b3b3b3; /* Gaiši pelēks */
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #333; /* Smalka atdalošā līnija */
}

.task-time-info span {
    display: block; /* Katrs laiks savā rindā */
    margin-bottom: 5px;
}
/* Stili čata logam */
.chat-container { margin-top: 15px; border-top: 1px solid #444; padding-top: 15px; }
.chat-messages { max-height: 200px; overflow-y: auto; margin-bottom: 10px; display: flex; flex-direction: column; gap: 10px; }
.chat-form { display: flex; gap: 10px; }
.chat-form textarea { flex-grow: 1; }

/* Stili atsevišķam ziņojumam */
.chat-message { padding: 8px 12px; border-radius: 12px; max-width: 80%; }
.chat-message p { margin: 5px 0 0; }
.chat-message .timestamp { font-size: 0.75em; color: #999; text-align: right; display: block; margin-top: 4px;}

/* Citu lietotāju ziņas */
.their-message { background-color: #3a3a3a; align-self: flex-start; }

/* Jūsu paša ziņas */
.my-message { background-color: #004d40; /* Tumši zaļš */ align-self: flex-end; }

.no-comments { color: #888; }
/* ========================================================= */
/*         TESTA VERSIJA AR !IMPORTANT                       */
/* ========================================================= */

.chat-messages {
    scrollbar-width: thin !important;
    scrollbar-color: #03dac6 #2c2c2c !important;
}

.chat-messages::-webkit-scrollbar {
    width: 8px !important;
}

.chat-messages::-webkit-scrollbar-track {
    background: #2c2c2c !important;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: #03dac6 !important;
    border-radius: 10px !important;
}
/* ============================================= */
/*          STILI MOBILAJĀM IERĪCĒM              */
/* ============================================= */

/* Šie stili piemērosies visiem ekrāniem, kas ir ŠAURĀKI par 768 pikseļiem */
@media (max-width: 768px) {
    
    /* Liekam sānjoslai un galvenajam saturam aizņemt pilnu platumu */
    .sidebar,
    .main-content {
        flex-basis: 100%; /* Aizņem 100% no pieejamā platuma, liekot nostāties vienam zem otra */
    }

    /* Samazinām galveno virsrakstu */
    h1 {
        font-size: 24px;
    }

    /* Padarām filtrus atskaitēs kompaktākus */
    .filter-form {
        flex-direction: column; /* Liekam filtrus vienu zem otra, nevis blakus */
        align-items: stretch;
    }

    /* Samazinām atstarpes paneļos */
    .panel {
        padding: 15px;
    }
}
/* ========================================================= */
/*      PAMATA STILI ADAPTĪVAJAM DIZAINAM (FLEXBOX)         */
/* ========================================================= */

/* Šis ir galvenais konteiners, kas satur sānjoslu un saturu */
.app-layout {
    display: flex;       /* Aktivizējam Flexbox, lai elementi būtu elastīgi */
    flex-wrap: wrap;     /* Atļaujam elementiem "nokrist" zemāk, ja nepietiek vietas */
    gap: 20px;           /* Atstarpe starp sānjoslu un saturu */
}

/* Sānjoslas pamatstili */
.sidebar {
    flex-basis: 240px;   /* Sākuma platums sānjoslai */
    flex-grow: 1;        /* Atļaujam tai nedaudz pastiepties */
}

/* Galvenā satura pamatstili */
.main-content {
    flex-basis: 0;       /* Sākuma platums 0, lai aprēķins būtu pareizs */
    flex-grow: 999;      /* Liekam aizņemt visu pārējo pieejamo vietu */
    min-width: 50%;      /* Nodrošinām, lai saturs nesaspiestos pārāk šauri */
}


/* ========================================================= */
/*  MEDIJU VAICĀJUMI - MAĢIJA SĀKAS ŠEIT (MAZIEM EKRĀNIEM)   */
/* ========================================================= */

/* Šie stili stāsies spēkā TIKAI ekrāniem, kas ir šaurāki par 768px (planšetes, telefoni) */
@media (max-width: 768px) {

    /* Liekam galvenajam konteinerim pārkārtoties uz vertikālu skatu */
    .app-layout {
        flex-direction: column;
    }

    /* Pārveidojam galvenes izkārtojumu */
    header {
        text-align: center; /* Centrējam tekstu */
    }
    header p {
        font-size: 0.9em;
    }

    /* Samazinām fontu izmērus, lai viss ietilptu */
    h1 {
        font-size: 1.8em;
    }
    h2 {
        font-size: 1.4em;
    }

    /* Pārveidojam atskaišu filtrus, lai tie būtu viens zem otra */
    .filter-form {
        flex-direction: column;
        align-items: stretch; /* Izstiepjam elementus pa visu platumu */
    }
    
    /* Pārveidojam uzdevuma pogas, lai tās būtu zem nosaukuma */
    .task-item .task-main {
        flex-direction: column;
        align-items: flex-start; /* Sākam no kreisās malas */
        gap: 10px;
    }
    
    /* Padarām čata logu kompaktāku */
    .chat-messages {
        max-height: 150px;
    }
}
/* =============================== */
/*      JAUNIE ČATA ZIŅU STILI     */
/* =============================== */

/* Konteiners, kas saturēs ziņas */
.chat-messages-static {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Atstarpe starp ziņām */
}

/* Stils visām ziņām (kopīgais) */
.chat-message {
    padding: 10px 15px;
    border-radius: 12px;
    max-width: 75%; /* Lai ziņas neaizņemtu visu platumu */
}

/* Stils CITIEM lietotājiem (kreisā puse, tumšs fons) */
.chat-message.other-message {
    background-color: #3a3a3a; /* Nedaudz gaišāks nekā fons */
    align-self: flex-start; /* Pielīdzina pie kreisās malas */
    border-bottom-left-radius: 2px; /* Asāks stūris */
}

/* Stils MANĀM ziņām (labā puse, akcenta krāsa) */
.chat-message.my-message {
    background-color: #03dac6; /* Jūsu sistēmas akcenta krāsa */
    color: #121212; /* Tumšs teksts labākai lasāmībai */
    align-self: flex-end; /* Pielīdzina pie labās malas */
    border-bottom-right-radius: 2px; /* Asāks stūris */
}

/* Padarām lietotāja vārdu treknu arī savām ziņām */
.chat-message.my-message strong {
    color: #000;
}
/* Stili jaunajam tiešsaistes panelim */
#live-status-panel {
    background-color: #1e1e1e;
    border-left: 4px solid #03dac6;
}

#live-status-panel #live-count {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.live-user-item {
    padding: 8px 0;
    font-size: 1.1em;
}
/* ============================================= */
/*     STILI SKAITĻU IEVADES LAUKIEM VISĀ LAPĀ   */
/* ============================================= */
input[type="number"] {
    background-color: #3a3a3a !important; /* Tumšs fons */
    color: #ffffff !important;           /* Balts teksts */
    border: 1px solid #555 !important;   /* Pelēka maliņa */
    padding: 10px !important;            /* Atstarpes */
    border-radius: 5px !important;       /* Noapaļoti stūri */
    -moz-appearance: textfield;          /* Noņem bultiņas Firefox */
}

/* Noņem bultiņas Chrome, Safari, Edge, Opera */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}
.success-message {
    color: #28a745; /* Zaļš */
    background-color: rgba(40, 167, 69, 0.1);
    border: 1px solid #28a745;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
}
/* ============================================= */
/*           JAUNĀS, VIENKĀRŠĀS ANIMĀCIJAS         */
/* ============================================= */

/* 1. Animācija galvenajam saturam */

/* Sākuma stāvoklis (neredzams) */
.main-content {
    opacity: 0;
    animation: fadeInAnimation 0.5s ease-in-out forwards;
}

/* Animācija, kas padara bloku redzamu */
@keyframes fadeInAnimation {
    from {
        opacity: 0;
        transform: translateY(10px); /* Nedaudz "uzpeld" no apakšas */
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 2. Animācija sānjoslas pogām */

/* Pievienojam plūdenu pāreju fona krāsai un teksta krāsai */
.sidebar li a {
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}