/* Rata-päiväkirja — lomake CSS */

.rp-wrap {
  max-width: 680px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  color: #1a1a1a;
}
.rp-lomake-otsikko {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 20px;
  color: #1a1a1a;
}

/* Estää teeman ylikirjoittamisen nappiselektoreilla */
.rp-wrap button { box-shadow: none; text-shadow: none; }
.rp-wrap .rp-type-btn * { pointer-events: none; }

/* Tyypinvalintapainikkeet */
.rp-type-sel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
@media (max-width: 520px) {
  .rp-type-sel { grid-template-columns: 1fr; }
}
.rp-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px 12px;
  min-height: 100px;
  border: 2px solid #d1d5db;
  border-radius: 10px;
  background: #ffffff;
  color: #1a1a1a;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  text-align: center;
  word-break: break-word;
  hyphens: auto;
  box-sizing: border-box;
  width: 100%;
  overflow: visible;
}
.rp-type-btn:hover { border-color: #6b7280; background: #f9fafb; color: #1a1a1a; }
.rp-type-btn.rp-active-kausikortti { border-color: #15803d; background: #f0fdf4; color: #1a1a1a; }
.rp-type-btn.rp-active-kerta       { border-color: #1d4ed8; background: #eff6ff; color: #1a1a1a; }
.rp-type-btn.rp-active-vuokra      { border-color: #b45309; background: #fffbeb; color: #1a1a1a; }
.rp-type-btn strong,
.rp-type-btn .rp-type-label {
  font-size: 14px;
  font-weight: 600;
  display: block;
  line-height: 1.3;
  color: #111827;
  margin: 0;
}
.rp-type-btn small,
.rp-type-btn .rp-type-sub {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.3;
  display: block;
  margin: 0;
}
.rp-type-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  display: block;
}

/* Fieldset */
.rp-wrap fieldset.rp-section {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 28px 20px 20px;
  margin: 0 0 16px;
  background: #fafafa;
  overflow: visible;
  position: relative;
  min-width: 0;
}
.rp-wrap fieldset.rp-section legend {
  font-weight: 600;
  font-size: 13px;
  color: #374151;
  padding: 0 8px;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: #fafafa;
  line-height: 1;
  float: none;
  width: auto;
  margin: 0;
}
.rp-wrap fieldset.rp-section.rp-common { background: #fff; }
.rp-wrap fieldset.rp-section.rp-common legend { background: #fff; }

/* Rivit ja kentät */
.rp-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 0;
}
@media (max-width: 480px) { .rp-row { grid-template-columns: 1fr; } }

.rp-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.rp-field label {
  font-size: 13px;
  font-weight: 500;
  color: #111827 !important;
}
.rp-required label::after { content: " *"; color: #dc2626; }
.rp-opt { font-weight: 400; color: #9ca3af; font-size: 12px; }

.rp-field input,
.rp-field select,
.rp-field textarea {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  background: #fff !important;
  color: #111827 !important;
}
.rp-field input::placeholder,
.rp-field textarea::placeholder { color: #9ca3af !important; opacity: 1; }
.rp-field select option { color: #111827; background: #fff; }
.rp-field input:focus,
.rp-field select:focus,
.rp-field textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.rp-field small { font-size: 11px; color: #9ca3af; }

/* Radio & checkbox */
.rp-radio-group { display: flex; flex-direction: column; gap: 6px; }
.rp-radio, .rp-checkbox {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; cursor: pointer; color: #111827 !important;
}
.rp-radio input, .rp-checkbox input { width: 16px; height: 16px; }

/* Vastuuvapaus */
.rp-vastuu-lohko {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.rp-vastuu-teksti {
  font-size: 13px;
  color: #92400e;
  line-height: 1.5;
  margin-bottom: 10px;
}
.rp-vastuu-checkbox {
  font-size: 14px;
  font-weight: 500;
  color: #111827 !important;
  align-items: flex-start !important;
  gap: 10px;
}
.rp-vastuu-checkbox input { margin-top: 2px; flex-shrink: 0; }
.rp-virhe {
  background: #fef2f2; border: 1px solid #fecaca;
  color: #b91c1c; border-radius: 6px;
  padding: 10px 14px; font-size: 14px; margin-bottom: 12px;
}
.rp-submit {
  width: 100%; padding: 12px;
  background: #1a1a1a; color: #fff;
  border: none; border-radius: 8px;
  font-size: 16px; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.rp-submit:hover { background: #374151; }
.rp-submit:disabled { background: #9ca3af; cursor: not-allowed; }

/* Onnistuminen */
.rp-success {
  text-align: center; padding: 40px 20px;
  border: 2px solid #bbf7d0; border-radius: 12px;
  background: #f0fdf4;
}
.rp-success-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: #16a34a; color: #fff;
  font-size: 28px; line-height: 56px;
  margin: 0 auto 16px;
}
.rp-success h3 { margin: 0 0 8px; color: #15803d; }
.rp-success p  { color: #166534; margin: 0 0 20px; }
.rp-uusi-btn {
  padding: 10px 24px; border: 2px solid #16a34a;
  border-radius: 6px; background: #fff; color: #15803d;
  font-weight: 600; cursor: pointer; font-size: 15px;
}
.rp-uusi-btn:hover { background: #f0fdf4; }

/* Useampi auto -toiminto */
.rp-lisaa-auto-btn {
  margin-top: 4px;
  padding: 7px 16px;
  background: none;
  border: 1px dashed #9ca3af;
  border-radius: 6px;
  color: #374151;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  transition: border-color .15s, background .15s;
}
.rp-lisaa-auto-btn:hover { border-color: #6b7280; background: #f9fafb; }
.rp-auto-rivi { margin-bottom: 8px; }
.rp-auto-rivi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}
.rp-auto-rivi-otsikko { font-size: 13px; font-weight: 500; color: #374151; }
.rp-poista-auto-btn {
  padding: 3px 10px;
  background: none;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  color: #dc2626;
  font-size: 12px;
  cursor: pointer;
}
.rp-poista-auto-btn:hover { background: #fef2f2; }

/* ── Tooltip-helpperit ── */
.rp-help-wrap {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin-left: 4px;
}
.rp-help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #6b7280 !important;
    color: #fff !important;
    font-size: 11px;
    font-weight: bold;
    line-height: 1;
    border: none;
    cursor: pointer;
    padding: 0;
    box-sizing: border-box;
    flex-shrink: 0;
}
.rp-help-btn:hover { background: #4b5563 !important; }
.rp-help-tip {
    display: none;
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    background: #1f2937;
    color: #f9fafb !important;
    font-size: 13px;
    line-height: 1.4;
    padding: 6px 10px;
    border-radius: 4px;
    white-space: normal;
    z-index: 9999;
    max-width: 280px;
    pointer-events: none;
    min-width: 180px;
}
.rp-help-tip--open { display: block; }

/* ── Raporttiosion parannetut tyylit (Käynnit & Melumittaukset) ── */
.rp-dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}
.rp-kpi-card {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 15px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
}
.rp-kpi-title {
    font-size: 12px;
    color: #646970;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}
.rp-kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: #1d2327;
    line-height: 1.2;
}
.rp-kpi-subtext {
    font-size: 11px;
    color: #8c8f94;
    margin-top: 5px;
}
.rp-kpi-card.rp-exceed-card {
    border-left: 4px solid #d63638;
}
.rp-kpi-card.rp-exceed-card.rp-has-exceedances {
    background: #fff8f8;
}
.rp-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}
@media (max-width: 1024px) {
    .rp-charts-row {
        grid-template-columns: 1fr;
    }
}
.rp-chart-card {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.rp-chart-card h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 15px;
    font-weight: 600;
    border-bottom: 1px solid #f0f0f1;
    padding-bottom: 10px;
    color: #1d2327;
}
.rp-chart-container {
    position: relative;
    height: 320px;
    width: 100%;
}
.rp-tables-row {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 20px;
    margin-bottom: 25px;
}
@media (max-width: 900px) {
    .rp-tables-row {
        grid-template-columns: 1fr;
}

/* ── Ohjeistuksen tyylit (hallinta & frontend) ── */
.rp-help-container {
    margin-top: 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}
.rp-help-content h1 {
    font-size: 20px;
    font-weight: 700;
    margin: 20px 0 10px 0;
    color: #1d2327;
}
.rp-help-content h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 18px 0 8px 0;
    color: #1d2327;
}
.rp-help-content h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 15px 0 6px 0;
    color: #1d2327;
}
.rp-help-content p {
    margin-bottom: 12px;
}
.rp-help-content ul {
    margin-bottom: 12px;
}
.rp-help-content li {
    margin-bottom: 4px;
}
.rp-help-content code {
    background: #f0f0f1;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}
.rp-help-table th, .rp-help-table td {
    font-size: 13px;
    line-height: 1.4;
}

/* Frontend-kohtainen välilehtien fallback (kun ei olla admin-paneelissa) */
.rp-wrap .nav-tab-wrapper {
    border-bottom: 1px solid #ccc;
    margin-bottom: 15px;
    display: flex;
    gap: 5px;
    padding-bottom: 0;
}
.rp-wrap .nav-tab {
    padding: 8px 16px;
    font-size: 14px;
    line-height: 1.5;
    text-decoration: none;
    color: #444;
    background: #f3f4f6;
    border: 1px solid #ccc;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    font-weight: 600;
    transition: all 0.15s ease-in-out;
}
.rp-wrap .nav-tab-active, .rp-wrap .nav-tab:hover {
    background: #fff;
    color: #000;
    border-bottom: 1px solid #fff;
    margin-bottom: -1px;
}

/* Haitaripainikkeen leijuntavärit ja siisti siirtymä */
.rp-toggle-help-btn:hover {
    background-color: #e5e7eb !important;
    border-color: #9ca3af !important;
}

/* ── Raporttien Tulostusasettelu (Print CSS / PDF) ── */
@media print {
    #adminmenuback,
    #adminmenuwrap,
    #wpadminbar,
    #wpfooter,
    .nav-tab-wrapper,
    form,
    .screen-reader-text,
    .notice,
    .update-nag {
        display: none !important;
    }
    
    #wpcontent,
    #wpbody-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        float: none !important;
    }
    
    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 11pt !important;
    }
    
    .rp-dashboard-kpi-grid {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 15px !important;
        margin-bottom: 20px !important;
    }
    .rp-kpi-card {
        flex: 1 1 180px !important;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        page-break-inside: avoid !important;
    }
    
    .rp-charts-row {
        display: block !important;
    }
    .rp-chart-card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        margin-bottom: 20px !important;
        page-break-inside: avoid !important;
    }
    .rp-chart-container {
        height: 240px !important;
    }
    
    .rp-tables-row {
        display: block !important;
    }
    
    table.wp-list-table {
        border: 1px solid #ccc !important;
        width: 100% !important;
    }
    table.wp-list-table th, table.wp-list-table td {
        border: 1px solid #ddd !important;
        padding: 6px !important;
    }
}



