/* =========================================================================
   DATAHUB-ANSA - PÄÄTYYLITIEDOSTO (style.css)
   Sisällysluettelo:
   1. Nollaus ja perusasetukset (Reset & Base)
   2. Asettelu (Layout - Header, Main, Footer)
   3. Typografia ja apuluokat (Typography & Utilities)
   4. Komponentit - Painikkeet (Buttons)
   5. Komponentit - Laatikot ja Artikkelit (Boxes & Articles)
   6. Komponentit - Navigaatio (Navigation)
   7. Komponentit - Lomakkeet (Forms & Inputs)
   8. Tulostusnäkymän erikoistyylit (Print Preview)
   ========================================================================= */


/* --- 1. NOLLAUS JA PERUSASETUKSET --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #2c3e50;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;

    /* Voimakkaampi siniharmaa tausta ja kylmänsininen ruudukko */
    background-color: #eef2f5;
    background-image: 
        linear-gradient(to right, rgba(41, 128, 185, 0.06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(41, 128, 185, 0.06) 1px, transparent 1px);
    background-size: 24px 24px;
}


/* --- 2. ASETTELU (HEADER, MAIN, FOOTER) --- */
header, main, footer {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

main {
    flex: 1; /* Työntää footerin aina sivun pohjalle */
}

/* Ylätunniste */
header {
    border-bottom: 1px solid #dcdde1;
    padding-top: 25px;
    padding-bottom: 15px;
}

.logo-area {
    display: block;
    width: 100%;
}

.logo-link {
    text-decoration: none !important;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 20px;
    width: fit-content;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: #1a252f;
    letter-spacing: -0.5px;
    margin: 0;
    line-height: 1;
}

header p {
    display: block;
    width: 100%;
    clear: both;
    text-align: center;
    margin-top: 12px;
    margin-bottom: 10px;
    padding: 6px 12px;
    position: relative;
    z-index: 1;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 1.1rem;
    color: #7f8c8d;
    
    background-image: linear-gradient(
        to right, 
        transparent 0%, 
        rgba(230, 126, 34, 0.21) 40%, 
        rgba(231, 76, 60, 0.25) 50%, 
        rgba(230, 126, 34, 0.21) 60%, 
        transparent 100%
    );
    background-size: 300% 100%;
    background-position: 150% 0;
    background-repeat: no-repeat;
    
    animation: aaltoPyyhkaisy 3.0s cubic-bezier(0.42, 0, 0.58, 1) forwards;
    animation-delay: 0.3s;
}

@keyframes aaltoPyyhkaisy {
    0% { background-position: 150% 0; }
    100% { background-position: -50% 0; }
}

/* Alatunniste */
footer {
    border-top: 1px solid #dcdde1;
    padding-top: 20px;
    padding-bottom: 20px;
    text-align: center;
    font-size: 0.85rem;
    color: #95a5a6;
}

footer a {
    color: #7f8c8d;
    text-decoration: underline;
}

footer a:hover {
    color: #2c3e50;
}

.support-link {
    margin-top: 10px; 
    margin-bottom: 10px;
    display: block;
    font-size: 0.8rem;
}

.kofi-link {
    font-weight: 600; 
    color: #e67e22; 
    text-decoration: none;
}

.footer-meta {
    margin-top: 5px; 
    font-size: 0.8rem; 
    color: #95a5a6;
}

.footer-links {
    margin-top: 10px; 
    font-size: 0.85rem;
}


/* --- 3. TYPOGRAFIA JA APULUOKAT --- */
main p {
    line-height: 1.75;
    letter-spacing: 0.3px;
    margin-bottom: 15px;
}



/* =========================================================================
   LISÄYS: YHTIÖHAKU (liitä tämä lohko olemassa olevan style.css:n LOPPUUN)
   Tyylit dynaamisen yhtiölistan hakukentälle ja tulosdropdownille.
   ========================================================================= */

.yhtio-haku {
    margin-top: 15px;
    border-top: 1px dashed #cbd5e1;
    padding-top: 15px;
}

.yhtio-haku label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #2c3e50;
}

/* Suhteellinen kehys, jotta tuloslista voidaan asemoida sen alle */
.haku-wrap {
    position: relative;
}

.haku-wrap input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.haku-wrap input[type="text"]:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 5px rgba(41, 128, 185, 0.2);
}

.haku-tulokset {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 20;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 6px 12px -2px rgba(0, 0, 0, 0.12);
}

.haku-osuma {
    padding: 10px 12px;
    font-size: 0.9rem;
    color: #374151;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
}

.haku-osuma:last-child {
    border-bottom: none;
}

.haku-osuma:hover {
    background-color: #eef2f5;
    color: #1a252f;
}

pre, code {
    white-space: pre-wrap;
    white-space: -moz-pre-wrap;
    white-space: -pre-wrap;
    white-space: -o-pre-wrap;
    word-wrap: break-word;
}

.txt-bold { font-weight: bold; }
.txt-italic { font-style: italic; }
.txt-pre { white-space: pre-wrap; }

.text-highlight {
    font-weight: 600; 
    color: #c0392b;
}

.center-content { text-align: center; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.no-print-margin { margin-bottom: 25px; }


/* --- 4. KOMPONENTIT - PAINIKKEET (BUTTONS) --- */
.btn {
    display: inline-block;
    background-color: #2980b9;
    color: #ffffff;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn:hover { background-color: #2171a3; }

.btn-success { background-color: #27ae60; }
.btn-success:hover { background-color: #219653; }

.btn-large {
    font-size: 1.1rem; 
    padding: 15px 30px; 
    text-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.btn-full {
    margin-top: 15px; 
    width: 100%;
}

.btn.kopioitu-success {
    background-color: #27ae60 !important;
}

#tulosta-nappi:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* --- 5. KOMPONENTIT - LAATIKOT JA ARTIKKELIT --- */
.reklamaatio-box {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 20px;
    margin-top: 25px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.reklamaatio-box h3 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.reklamaatio-box p {
    line-height: 1.75;
    letter-spacing: 0.3px;
    margin-bottom: 15px;
}

.page-article {
    text-align: left; 
    padding: 30px;
}

.article-title {
    margin-bottom: 20px; 
    color: #1a252f; 
    font-size: 1.8rem;
}

.article-title-small {
    margin-bottom: 20px; 
    color: #1a252f; 
    font-size: 1.6rem;
}

.article-text {
    margin-bottom: 15px; 
    font-size: 1.05rem;
}

.article-text-muted {
    margin-bottom: 15px; 
    font-size: 1rem; 
    color: #555;
}

.text-copy-box {
    background-color: #f8f9fa; 
    border: 1px solid #d1d5db; 
    border-radius: 6px;
    padding: 20px;
    position: relative;
    margin-top: 15px;
}

.text-copy-box .btn-copy {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.8rem;
    padding: 5px 10px;
}

.copyable-text {
    background: transparent !important; 
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-family: inherit; 
    font-size: 0.95rem;
    color: #374151;
    white-space: pre-wrap; 
    word-wrap: break-word;
}

.laskuri-teksti {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-top: 8px;
    font-style: italic;
    text-align: center;
}


/* --- 6. KOMPONENTIT - NAVIGAATIO --- */
.lang-switch {
    float: right;
    font-size: 0.9rem;
}

.lang-switch a {
    color: #2980b9;
    text-decoration: none;
    font-weight: bold;
    padding: 2px 5px;
}

.lang-switch a:hover {
    text-decoration: underline;
}

.ohje-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.ohje-nav .btn {
    flex: 1;
    text-align: center;
    background-color: #e2e8f0;
    color: #4a5568;
    border: 1px solid #cbd5e1;
    font-size: 0.95rem;
}

.ohje-nav .btn.btn-active {
    background-color: #2980b9;
    color: #ffffff;
    border-color: #2171a3;
}

.ohje-nav .btn:hover:not(.btn-active) {
    background-color: #cbd5e1;
}

.back-link-container {
    margin-top: 25px; 
    padding-top: 15px; 
    border-top: 1px solid #e2e8f0;
}

.back-link {
    color: #2980b9; 
    text-decoration: none; 
    font-weight: 600;
}


/* --- 7. KOMPONENTIT - LOMAKKEET (FORMS & INPUTS) --- */
.lomake-alue {
    margin-bottom: 30px; 
    border-bottom: 2px dashed #cbd5e1; 
    padding-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input.kentta-validi {
    border-color: #27ae60 !important;
    box-shadow: 0 0 5px rgba(39, 174, 96, 0.2) !important;
}

.required-asterisk {
    color: #e74c3c;
}

.optional-text {
    font-weight: normal; 
    color: #7f8c8d; 
    font-size: 0.8rem;
}

textarea.copy-area {
    width: 100%;
    height: 250px;
    font-family: Consolas, Monaco, "Lucida Console", monospace;
    font-size: 0.9rem;
    color: #34495e;
    background-color: #f8f9fa;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 12px;
    resize: vertical;
    margin-bottom: 15px;
}

/* Yhtiövalinnat palstamuotoilu */
.yhtio-container {
    background-color: #f8f9fa;
    padding: 15px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    margin-bottom: 15px;
}

.yhtio-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.yhtio-col {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.yhtio-category {
    margin-bottom: 10px;
}

.yhtio-category h4 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: #2c3e50;
    border-bottom: 1px solid #cbd5e1;
    padding-bottom: 4px;
}

.yhtio-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.yhtio-label {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-weight: normal;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.3;
}

.yhtio-label input[type="checkbox"] {
    margin-top: 2px;
}

.yhtio-muut {
    margin-top: 15px;
    border-top: 1px dashed #cbd5e1;
    padding-top: 15px;
}


/* --- 8. TULOSTUSNÄKYMÄN ERIKOISTYYLIT (PRINT PREVIEW) --- */
.print-doc {
    background: #ffffff; 
    padding: 20px; 
    color: #000000; 
    font-family: 'Times New Roman', Times, serif; 
    line-height: 1.6; 
    text-align: justify;
}

.print-doc h2 {
    font-size: 1.4rem; 
    text-align: center; 
    font-weight: bold; 
    margin-bottom: 20px;
}

.doc-meta-block {
    margin-bottom: 25px; 
    border-bottom: 1px solid #000000; 
    padding-bottom: 10px;
}