/* Perusasetukset */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f9f9f9;
  color: #222;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header.header-banner {
    background-image: linear-gradient(120deg, #0961ef 0%, #e4fbc2 100%);
    background-size: cover;
    color: #222;
    text-align: center;
    padding: 1rem 1rem;
    position: relative;
	border: 1px solid #ccc;
    border-radius: 8px;
	
}

header.header-banner::after {
    content: "";
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.1); /* tummentaa kuvaa */
    z-index: 1;
}

header .header-content {
    position: relative;
    z-index: 2;
}

header nav a {
    color: #fff;
    margin: 0 0.5rem;
    text-decoration: none;
    font-weight: bold;
}

header nav a:hover {
    text-decoration: underline;
}


header .admin-link {
  position: absolute;
  right: 1rem;
  top: 1rem;
  color: #fff;
  text-decoration: underline;
  font-size: 0.9rem;
}

main {
  flex: 1;
  padding: 2px;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.chat-container {
  display: flex;
  gap: 1rem;
  height: 70vh;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: white;
  overflow: hidden;
  margin-bottom: 1rem;
}




/* Chat-ikkuna */
.chat-window {
  flex: 3;
  padding: 1rem;
  overflow-y: auto;
  border-right: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 1rem;
  background-color: #fff;
  
}

/* Yksittäinen viesti */
.chat-window .chat-message {
  padding: 0.4rem 0.6rem;
  border-radius: 5px;
  background: #e1f0ff;
  max-width: 100%;
  word-wrap: break-word;
  box-shadow: 0 5px 8px #222;
}

.chat-window .chat-message .text {
  white-space: pre-wrap;
}

.chat-window .system-message {
  text-align: center;
  color: #222;
  font-size: 1.4rem;
  background: #90f593;
  padding: 2px;
  border-radius: 4px
  
}



/* Paikalla olevat */
.users-online {
  flex: 1;
  padding: 2px;
  border-left: 1px solid #f9f9f9;
  background: #f8f9fa; /* vähän tummempi kuin #fff */
  overflow-y: auto;
  font-size: 0.9rem;
}

.users-online h2 {
  margin-top: 0;
  font-weight: 700;
  color: #222; /* tummempi otsikko */
}

.users-online ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.users-online ul li {
  padding: 0.4rem 0;
  border-bottom: 1px solid #ddd;
  color: #222; /* tummempi ja selkeämpi */
  cursor: pointer;
}

.users-online ul li:hover {
  text-decoration: underline;
  background-color: #e9ecef; /* hover-korostus */
}

/* Lähetyslomake */
.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  background: #fafafa;
  border-top: 1px solid #ddd;
}

.chat-form input#message {
  flex: 1;
  padding: 0.8rem 1rem;
  border: 1px solid #ccc;
  border-radius: 20px;
  font-size: 1.1rem;
  height: 3rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.chat-form input#message:focus {
  border-color: #007bff;
}

.chat-form button {
  background: #004080;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 0.8rem 1.2rem;
  font-size: 1rem;
  height: 3rem;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.1s ease;
}

.chat-form button:hover {
   background-color: #002a66;
   transform: scale(1.03);
}

/* Viestien muokkaus- ja poistonapit */
.msg-buttons {
  margin-top: 0.3rem;
}

.msg-buttons .msg-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  margin-right: 0.2rem;
}

/* Responsiivisuus */
@media (max-width: 700px) {
  .chat-container {
    flex-direction: column;
    height: auto;
  }

  .chat-window {
    flex: none;
    height: 50vh;
    border-right: none;
    border-bottom: 1px solid #ddd;
  }

  .users-online {
    flex: none;
    height: auto;
    border-left: none;
  }

  .chat-form {
    flex-direction: column;
  }

  .chat-form button {
    width: 100%;
  }
}
.form-container {
  max-width: 400px;
  margin: 2rem auto;
  padding: 2rem;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
}

.form-container h2 {
  text-align: center;
}

.form-container input {
  width: 100%;
  padding: 0.8rem;
  margin-bottom: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.form-container button {
  width: 100%;
  padding: 0.8rem;
  background: #0056b3; /* tummempi sininen */
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.form-container button:hover {
  background-color: #003f7f; /* vielä tummempi hover */
}

.form-container .error {
  color: red;
  margin-bottom: 1rem;
  text-align: center;
}
.admin-links {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 2rem 0;
}

.admin-link {
  display: block;
  padding: 0.75rem;
  background: #1e7e34;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 1.1rem;
  font-weight: 500;
  transition: background 0.2s ease;
}

.admin-link:hover {
  background: #155d27;
}
.btn-small {
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
  background: #dc3545;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  margin-left: 0.5rem;
}

.btn-small:hover {
  background: #c82333;
}



h2 {
  text-align: center;
  margin-top: 0;
  font-size: 1em;
}

.admin-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

.admin-card {
  display: block;
  background: #f1f1f1;
  border: 1px solid #ccc;
  padding: 1rem 2rem;
  text-align: center;
  text-decoration: none;
  color: #333;
  font-size: 1.1rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.admin-card:hover {
  background: #007bff;
  color: #fff;
}


/* Muokkaus- ja poistonapit viestin alla */
.msg-buttons {
  margin-top: 4px;
  display: flex;
  gap: 6px;
}

.msg-btn {
  background: #007bff;
  border: none;
  color: white;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.25s ease;
  user-select: none;
}

.msg-btn:hover {
  background: #0056b3;
}

.msg-btn:focus {
  outline: 2px solid #0056b3;
  outline-offset: 2px;
}

/* Chat-viestin tyyli, jossa napit ovat mukana */
.chat-message {
  padding: 8px 12px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.1);
  max-width: 80%;
  word-wrap: break-word;
  margin-bottom: 8px;
  position: relative;
}

.chat-message b {
  color: #0366d6;
  font-weight: 700;
  margin-bottom: 5px;
  display: block;
}

.chat-message .text {
  color: #222;
  white-space: pre-wrap;
}

/* Omien viestien korostus */
.chat-message.from-self {
  background: #e0f7fa;
  margin-left: auto;
}

/* Järjestä chat-kontainerissa viestit pystysuoraan */
#messages {
  overflow-y: auto;
  max-height: 70vh;
  padding: 12px;
  background: #acd5ff;
  border: 1px solid #02101e;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
}



header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 5px;
    justify-content: center;
    align-items: center;
}

header nav a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    background-color: #0056b3; /* Tumma sininen tausta */
    padding: 6px 12px;
    margin: 0 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: inline-block;
}

header nav a:hover,
header nav a:focus {
    background-color: #003d80; /* Tummempi hover */
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.logout-btn {
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
}

.logout-btn:hover {
    background: #c0392b;
}
footer {
  background-image: linear-gradient(120deg, #0961ef 0%, #e4fbc2 100%);
  text-align: center;
  padding: 1rem;
  #background: #f1f1f1;
  color: #555;
  font-size: 0.9rem;
  margin-top: auto;
}

footer a {
  color: #007bff;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}


header h1 {
  margin: 0;
  font-size: 2.0rem;
  
}
header nav {
  margin-top: 10px;
}
header nav a{background-image: linear-gradient(to right, #00c6ff 0%, #0072ff  51%, #00c6ff  100%)}
header nav a {
  margin: 10px;
  padding: 5px 10px;
  text-align: center;
  text-transform: uppercase;
  transition: 0.5s;
  background-size: 200% auto;
  color: white;            
  box-shadow: 0 0 20px #eee;
  border-radius: 10px;
  display: block;
}
header nav a:hover {
  background-position: right center; /* change the direction of the change here */
  color: #fff;
  text-decoration: underline;
}
.admin-link {
  background: #28a745;
  padding: 2px 6px;
  border-radius: 4px;
}
.private-message {
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    padding: 10px;
    margin: 5px 0;
    border-radius: 8px;
    font-style: italic;
    color: #856404;
}

.private-header {
    font-weight: bold;
    margin-bottom: 5px;
    color: #856404;
}

.private-text {
    white-space: pre-wrap;
}
/* Viestien nappien säiliö */
.msg-buttons {
    margin-top: 5px;
    display: flex;
    gap: 5px;
}

/* Yhteiset ominaisuudet */
.msg-btn {
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.msg-btn:hover {
    transform: scale(1.05);
}

/* Muokkaa-nappi */
.msg-btn.edit {
    background-color: #3498db;
    color: white;
}

.msg-btn.edit:hover {
    background-color: #2980b9;
}

/* Poista-nappi */
.msg-btn.delete {
    background-color: #e74c3c;
    color: white;
}

.msg-btn.delete:hover {
    background-color: #c0392b;
}
.success {
    background: #d4edda;
    color: #155724;
    padding: 0.5em;
    margin: 1em 0;
    border: 1px solid #c3e6cb;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-family: Arial, sans-serif;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    background-color: #fff;
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
}

th, td {
    padding: 0.75em;
    border-bottom: 1px solid #ddd;
    text-align: left;
}

th {
    background: linear-gradient(90deg, #007bff, #0056b3);
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

tr:hover {
    background-color: #eef7ff;
}

td {
    vertical-align: top;
}

@media (max-width: 600px) {
    table {
        font-size: 0.85rem;
    }

    th, td {
        padding: 0.5em;
    }
}

.account-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.account-actions button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 1rem;
    font-weight: 600; /* hieman paksumpi */
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: #fff;
    text-align: center;
    transition: background-color 0.2s ease, transform 0.1s ease;
}


.account-actions button:hover {
    transform: scale(1.03);
}

/* Vaihda salasana - sininen */
.account-actions .change-password-button {
    background-color: #004080;
}
.account-actions .change-password-button:hover {
    background-color: #002a66;
}

/* Kirjaudu ulos - punainen */
.account-actions .logout-button {
    background-color: #990000;
}
.account-actions .logout-button:hover {
    background-color: #660000;
}

/* Mobiiliystävällinen */
@media (max-width: 576px) {
    .account-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .account-actions button {
        width: 100%;
        justify-content: center;
    }
}




@media (max-width: 700px) {
    body {
        font-size: 0.95rem;
        padding: 0;
    }

    header {
        font-size: 1.2rem;
        padding: 0.5rem;
    }

    .chat-container {
        flex-direction: column;
        height: auto;
    }

    .chat-window {
        flex: none;
        height: 50vh;
        font-size: 0.9rem;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }

    .users-online {
        flex: none;
        height: auto;
        font-size: 2.85rem;
        border-left: none;
    }

    .chat-form {
        flex-direction: column;
    }

    .chat-form input#message {
        width: 100%;
        font-size: 1rem;
    }

    .chat-form button {
        width: 100%;
    }

    .form-container {
        margin: 1rem;
        padding: 1rem;
    }

    .form-container h2 {
        font-size: 1.2rem;
    }

    .form-container input {
        font-size: 0.9rem;
        padding: 0.6rem;
    }

    .form-container button {
        font-size: 0.9rem;
        padding: 0.6rem;
    }

    .admin-panel {
        flex-direction: column;
    }

    .admin-card {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
    }

    .account-actions {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .account-actions .change-password,
    .account-actions .logout-button {
        width: 100%;
    }

    .msg-buttons {
        gap: 3px;
    }

    .msg-btn {
        font-size: 0.8rem;
        padding: 3px 6px;
    }
}


/* Nimet rivillä */
#users span {
    cursor: pointer;
    color: #007bff;
    text-decoration: underline;
    transition: color 0.2s ease;
}

#users span:hover {
    color: #0056b3;
}

/* Mobiili: fontti hieman pienemmäksi */
@media (max-width: 576px) {
    #users {
        font-size: 0.9rem;
    }
}
/* Paikalla olevat: nimilista rivillä */
#users {
    display: inline;
    font-size: 18px;
    color: #333;
    font-weight: 500;
    line-height: 1.4;
    word-break: break-word;
    white-space: nowrap; /* voi myös olla  jos et halua rivittyvän */
	overflow-x: auto;
}

.users-online {
    font-size: 2rem;
    white-space: normal;
}

/* Mahdollisesti wrapper h2:seen */
.users-online h2 {
    font-size: 1rem;
    font-weight: 600;
}

/* Jos käytät jotain muuta kuin h2 */
.users-online {
    white-space: normal;
    word-break: break-word;
}
.welcome-box {
    #background: linear-gradient(to right, #0066cc, #00cc99);
    color: black;
    padding: 20px;
    #border-radius: 12px;
    margin-bottom: 2px;
    #box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    text-align: center;
    transform: translateY(20px);
    animation: fadeInUp 1s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-box h2 {
    margin-top: 0;
    font-size: 1.5em;
}
  .profile-container {
        max-width: 600px;
        margin: 2em auto;
        background: #f5f5f5;
        padding: 2em;
        border-radius: 12px;
    }
    textarea {
        width: 100%;
        min-height: 80px;
    }
    input[type="submit"] {
        margin-top: 1em;
    }
    .success {
        color: green;
        margin-bottom: 1em;
    }
       .profile-container {
            display: flex;
            flex-wrap: wrap;
            gap: 2rem;
        }

        .profile-info {
            flex: 2;
            min-width: 250px;
            background: #f9f9f9;
            padding: 1em;
            border-radius: 8px;
            box-shadow: 0 0 4px rgba(0,0,0,0.1);
        }

        .user-list {
            flex: 1;
            min-width: 180px;
            background: #efefef;
            padding: 1em;
            border-radius: 8px;
            box-shadow: 0 0 4px rgba(0,0,0,0.1);
        }

        .user-list h3 {
            margin-top: 0;
        }

        .user-list ul {
            list-style: none;
            padding-left: 0;
        }

        .user-list li {
            margin: 0.3em 0;
        }

        .user-list a {
            text-decoration: none;
            color: #007bff;
        }

        .user-list a:hover {
            text-decoration: underline;
        }

.danger-button {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 0.5em 1em;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}
.danger-button:hover {
    background-color: #c82333;
}

.profile-card {
            background: #e1f0ff;
            border: 1px solid #ddd;
            border-radius: 10px;
            margin: 1em 0;
            padding: 1em;
        }
        .profile-card h3 {
            margin: 0 0 0.5em 0;
        }
        .profile-card p {
            margin: 0;
        }
		
/* Hamburger-tyyli mobiilille */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    padding: 10px;
    margin-left: auto;
}

.mobile-menu {
    display: none;
    flex-direction: column;
    background-color: #333;
    padding: 10px;
    position: absolute;
    top: 60px;
    right: 10px;
    z-index: 1000;
    border-radius: 8px;
}

.mobile-menu a {
    color: white;
    text-decoration: none;
    padding: 10px;
    border-bottom: 1px solid #555;
}

.mobile-menu a:last-child {
    border-bottom: none;
}

.mobile-menu.show {
    display: flex;
}

/* Piilota mobiilivalikko tietokoneella */
@media screen and (min-width: 769px) {
    .mobile-toggle {
        display: none;
    }
    .mobile-menu {
        display: none !important;
    }
}

/* Piilota normaali valikko mobiilissa */
@media screen and (max-width: 768px) {
    .desktop-menu {
        display: none !important;
    }
    .mobile-toggle {
        display: block;
    }
}

/* === Säännöt -sivu === */
.saannot-page p {
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 1em;
  color: #333;
  background-color: #fdfdfd;
  padding: 1em;
  border-left: 4px solid #007bff;
  max-width: 800px;
}

/* === Tietoa -sivu === */
.tietoa-page p {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #222;
  background-color: #f5f5f5;
  padding: 0.8em;
  border-left: 4px solid #28a745;
  max-width: 800px;
}

/* === Top10 kirjoittajat -sivu === */
.top-page table {
  width: 100%;
  border-collapse: collapse;
  max-width: 800px;
  margin-top: 1em;
}
.top-page th, .top-page td {
  padding: 0.5em;
  border: 1px solid #ccc;
  text-align: left;
}
.top-page th {
  background-color: #007bff;
  color: white;
}
.top-page td {
  background-color: #fdfdfd;
}

@media (max-width: 600px) {
  .saannot-page p,
  .tietoa-page p,
  .top-page table {
    font-size: 0.95rem;
    padding: 0.5em;
  }
}

.login-message {
    #background: linear-gradient(to right, #0066cc, #00cc99);
    color: black;
    padding: 20px;
    #border-radius: 12px;
    margin-bottom: 20px;
    #box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    text-align: center;
	
}

.login-message h2 {
    font-size: 1.8em;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px #00000055;
}

.login-message p {
    font-size: 1.1em;
    line-height: 1.4; 
}

.private-window {
    position: absolute;
    top: 100px;
    left: 100px;
    width: 300px;
    background: #222;
    color: #fff;
    border: 1px solid #555;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    z-index: 1000;
    padding: 0;
    overflow: hidden;
}

.private-header {
    background: #e1f0ff;
    padding: 8px;
    font-weight: bold;
    cursor: move;
    user-select: none;
	color: #002a66;

}

.private-messages {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
    background: #f6fafe;
	color: #002a66;
}

.private-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    border: none;
    border-top: 1px solid #000000;
    background: #e1f0ff;
    color: #000000;
}

@media (max-width: 600px) {
    .private-message-window {
        width: 95%;
        height: 60%;
        bottom: 5px;
        right: 5px;
        left: 5px;
        font-size: 14px;
    }
}

.private-message-header {
    background: #444;
    padding: 8px;
    cursor: move;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.private-message-messages {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    font-size: 0.95em;
    background-color: #111;
}

.private-message-input {
    display: flex;
    border-top: 1px solid #555;
}

.private-message-input textarea {
    flex: 1;
    padding: 6px;
    resize: none;
    font-size: 14px;
    background: #333;
    color: white;
    border: none;
    outline: none;
}

.private-message-input button {
    padding: 6px 10px;
    background: #007bff;
    border: none;
    color: white;
    cursor: pointer;
}
.card-actions {
    margin-top: 5px;
}
.card-actions button {
    margin-right: 5px;
    padding: 3px 8px;
    font-size: 0.9em;
}