/* ============================
   Central Styles for Statement Tools
   ============================ */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;600;700&display=swap');

/* ============================
   CSS Variables
   ============================ */
:root {
    /* Klappir Brand Colors */
    --green-darkest: #3C9E77;
    --green-dark: #62B192;
    --green-medium: #8AC4AD;
    --green-light: #B1D8C8;
    --green-lightest: #D8EBE3;

    /* Layout Colors */
    --background-color: #f7f9f9;
    --card-background: #ffffff;
    --text-color: #212c3d;
    --border-color: #D8EBE3;

    /* Primary Colors */
    --klappir-green: #3C9E77;
    --klappir-green-dark: #2f9b7f;
    --primary: var(--klappir-green);
    --primary-dark: var(--klappir-green-dark);

    /* Additional Colors for WTT Calculator */
    --klappir-mint-light: #f0fdf4;
    --klappir-mint-border: #D8EBE3;
    --bg: #f7f9f9;
    --card: #ffffff;
    --border: var(--klappir-mint-border);
    --text: #1f2937;
}

/* ============================
   Base Styles
   ============================ */
body {
    font-family: 'IBM Plex Sans', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ============================
   Header Styles
   ============================ */
.header-container {
    text-align: center;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header-logo {
    display: flex;
    justify-content: flex-start;
    width: 100%;
    margin-bottom: 4px;
}

.header-content {
    text-align: center;
    width: 100%;
}

h1, h2, h3, h4 {
    color: var(--text-color);
    text-align: left;
}

h1 {
    text-align: center;
    font-size: 2em;
    margin: 0;
    font-weight: 700;
}

.header-content h1 {
    text-align: center;
}

h2 {
    font-size: 1.5em;
    margin: 0 0 15px 0;
}

h3 {
    border-bottom: 2px solid var(--green-light);
    padding-bottom: 10px;
    margin-top: 0;
}

h4 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--green-darkest);
    border-bottom: 1px solid var(--green-lightest);
    padding-bottom: 5px;
}

.logo {
    width: 100%;
    max-width: 450px;
    height: auto;
    margin-bottom: 15px;
}

/* ============================
   Grid Layouts
   ============================ */
.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (min-width: 992px) {
    .grid {
        grid-template-columns: 2fr 1fr;
    }
}

@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

/* ============================
   Card Styles
   ============================ */
.card {
    background-color: var(--card-background);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    text-align: left;
}

/* ============================
   Form Styles
   ============================ */
.form-group {
    margin-bottom: 15px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

@media (max-width: 576px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.label-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

label {
    font-weight: bold;
    color: #555;
}

input[type="text"],
input[type="number"],
input[type="date"],
select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
    background-color: #fafafa;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 1rem;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(60, 158, 119, 0.3);
}

input[readonly] {
    background-color: #f9fafb;
    cursor: not-allowed;
}

/* Remove scroll wheel from number inputs */
input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"]:focus {
    appearance: textfield;
    -moz-appearance: textfield;
}

/* Select dropdown styling */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%233C9E77' class='bi bi-chevron-down' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708 .708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

/* ============================
   Tooltip Styles
   ============================ */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    background-color: #a0aec0;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    line-height: 18px;
    font-style: italic;
}

.tooltip:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    text-align: left;
    white-space: nowrap;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
    width: 250px;
    white-space: normal;
    font-style: normal;
    font-weight: normal;
}

.tooltip:after {
    content: '';
    position: absolute;
    bottom: 125%;
    left: 50%;
    margin-left: -5px;
    margin-bottom: -10px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s;
}

.tooltip:hover:before, .tooltip:hover:after {
    visibility: visible;
    opacity: 1;
}

/* ============================
   Drop Zone Styles (Commute Calculator)
   ============================ */
.drop-zone {
    border: 2px dashed var(--green-light);
    border-radius: 4px;
    padding: 20px;
    transition: background-color 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
}

.drop-zone-prompt {
    text-align: center;
    margin: 0;
    color: #888;
    font-size: 1.1em;
}

.drop-zone.dragover {
    background-color: var(--green-lightest);
    border-color: var(--green-darkest);
}

textarea {
    display: none;
}

/* ============================
   Button Styles
   ============================ */
button,
.btn {
    background-color: var(--primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 16px;
    border: none;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    font-family: 'IBM Plex Sans', sans-serif;
    text-align: center;
}

button:hover,
.btn:hover {
    background-color: var(--primary-dark);
}

/* Danger variant */
.btn-danger {
    background-color: #ef4444;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* ID compatibility for existing markup */
#clearBtn { background-color: #ef4444; }
#clearBtn:hover { background-color: #dc2626; }
#copyBtn, #downloadBtn { background-color: var(--primary); }
#copyBtn:hover, #downloadBtn:hover { background-color: var(--primary-dark); }

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.output-buttons {
    margin-bottom: 20px;
    justify-content: flex-start;
}

/* ============================
   Results Grid Styles
   ============================ */
.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    text-align: center;
    margin-bottom: 20px;
}

.results-item p {
    margin: 5px 0;
}

.results-item .value {
    font-weight: bold;
    font-size: 1.2em;
    color: var(--green-darkest);
}

.grand-total {
    grid-column: 1 / -1;
    margin-top: 15px;
    border-top: 2px solid var(--green-light);
    padding-top: 15px;
}

.grand-total p {
    font-size: 1.2em;
}

.grand-total .value {
    font-size: 2.2em;
}

/* ============================
   Table Styles
   ============================ */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    text-align: left;
}

thead th {
    background-color: var(--green-dark);
    color: white;
}

tbody tr:nth-child(even) {
    background-color: var(--green-lightest);
}

tbody tr:hover {
    background-color: #f9fafb;
}

/* ============================
   Instructions Styles
   ============================ */
.instructions-container {
    background-color: var(--card-background);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}

.instructions-container h2 {
    text-align: center;
    color: var(--green-darkest);
    margin-bottom: 25px;
    font-size: 1.8em;
    font-weight: 700;
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.instruction-step {
    background-color: var(--green-lightest);
    border-radius: 8px;
    padding: 20px;
    border-left: 4px solid var(--green-darkest);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.instruction-step:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.instruction-step h3 {
    color: var(--green-darkest);
    margin: 0 0 10px 0;
    font-size: 1.2em;
    font-weight: 600;
    border-bottom: none;
    padding-bottom: 0;
}

.instruction-step p {
    margin: 0;
    color: #555;
    line-height: 1.5;
    font-size: 0.95em;
}

.note-box {
    background-color: #f0f9ff;
    border: 1px solid #0ea5e9;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
}

.note-box p {
    margin: 0;
    color: #0369a1;
    font-size: 0.9em;
    line-height: 1.4;
}

.instructions {
    margin-bottom: 20px;
    background-color: var(--green-lightest);
}

.instructions ol {
    margin: 0;
    padding-left: 20px;
}

.instructions li {
    margin-bottom: 10px;
}

.instructions li:last-child {
    margin-bottom: 0;
}

/* ============================
   Main Page Specific Styles
   ============================ */
.subtitle {
    color: #666;
    font-size: 1.2em;
    margin: 0 0 30px 0;
    font-weight: 400;
}

.description {
    background-color: var(--green-lightest);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 40px;
    border: 1px solid var(--border-color);
}

.description p {
    margin: 0 0 15px 0;
    font-size: 1em;
}

.description p:last-child {
    margin-bottom: 0;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.tool-card {
    background-color: var(--card-background);
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    text-align: left;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: auto;
}

.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: inherit;
}

.tool-icon {
    width: 60px;
    height: 60px;
    background-color: var(--green-lightest);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 24px;
}

.tool-title {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 15px 0;
}

.tool-description {
    color: #666;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.tool-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    flex-grow: 1;
}

.tool-features li {
    padding: 5px 0;
    color: #555;
    position: relative;
    padding-left: 20px;
}

.tool-features li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

.tool-link {
    background-color: var(--primary);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s ease;
    font-family: 'IBM Plex Sans', sans-serif;
    margin-top: auto;
}

.tool-link:hover {
    background-color: var(--primary-dark);
    text-decoration: none;
    color: #fff;
}

.footer {
    text-align: center;
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
    color: #666;
}

/* ============================
   WTT Calculator Specific Styles
   ============================ */
.calc-output {
    font-weight: 600;
    color: var(--primary-dark);
    text-align: right;
}

.divider {
    height: 1px;
    background: #e5e7eb;
    margin: 12px 0;
}

.table-fixed {
    table-layout: fixed;
}

#fuels-table td:last-child,
#electricity-table td:last-child {
    text-align: right;
}

.td-input:not([data-locked='1']) {
    background-color: var(--klappir-mint-light);
}

/* ============================
   Responsive Design
   ============================ */
@media (max-width: 768px) {
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .tool-card {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }

    .subtitle {
        font-size: 1.1em;
    }
}

/* ============================
   Utility Classes
   ============================ */
.antialiased {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.mb-10 {
    margin-bottom: 2.5rem;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.p-4 {
    padding: 1rem;
}

.p-8 {
    padding: 2rem;
}

.max-w-7xl {
    max-width: 80rem;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-6 {
    gap: 1.5rem;
}

.min-w-0 {
    min-width: 0;
}

.flex-1 {
    flex: 1 1 0%;
}

.flex-none {
    flex: none;
}

.shrink-0 {
    flex-shrink: 0;
}

.block {
    display: block;
}

.h-16 {
    height: 4rem;
}

.h-20 {
    height: 5rem;
}

.w-auto {
    width: auto;
}

.text-3xl {
    font-size: 1.875rem;
    line-height: 2.25rem;
}

.text-4xl {
    font-size: 2.25rem;
    line-height: 2.5rem;
}

.font-bold {
    font-weight: 700;
}

.text-gray-800 {
    color: #1f2937;
}

.text-gray-600 {
    color: #4b5563;
}

.text-gray-500 {
    color: #6b7280;
}

.text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.text-base {
    font-size: 1rem;
    line-height: 1.5rem;
}

.text-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.border-b {
    border-bottom-width: 1px;
}

.pb-2 {
    padding-bottom: 0.5rem;
}

.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.font-semibold {
    font-weight: 600;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    transition: border-color 0.2s, background-color 0.2s;
    background-color: #fff;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(60, 158, 119, 0.3);
}

.form-input[readonly] {
    background-color: #f9fafb;
    cursor: not-allowed;
}

/* Responsive grid utilities */
@media (min-width: 768px) {
    .md\\:p-8 {
        padding: 2rem;
    }

    .md\\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .lg\\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 640px) {
    .sm\\:text-4xl {
        font-size: 2.25rem;
        line-height: 2.5rem;
    }

    .sm\\:text-lg {
        font-size: 1.125rem;
        line-height: 1.75rem;
    }

    .sm\\:h-20 {
        height: 5rem;
    }
}
