/* General Styles */
body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    margin: 20px;
    background-color: #f9f9f9;
    color: #333;
    line-height: 1.6;
}

/* Header and Logo */
h1 {
    text-align: center;
    font-size: 2.2em;
    margin-bottom: 30px;
    color: #222;
    padding-bottom: 10px;
    border-bottom: 2px solid #1a3c6e;
}

.logo {
    text-align: center;
    margin: 0 auto 20px auto;
    max-width: 150px;
}

.logo img {
    width: 100%;
    height: auto;
    max-width: 150px;
}

h2 {
    border-bottom: 2px solid #1a3c6e;
    padding-bottom: 5px;
    margin-top: 30px;
    margin-bottom: 20px;
    color: #444;
    font-size: 1.5em;
}

h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #1a3c6e;
    font-size: 1.3em;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 25px;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 4px;
}

th {
    text-align: left;
    padding: 10px;
    width: 35%;
    vertical-align: top;
    background-color: #f0f0f0;
    border-bottom: 1px solid #ddd;
}

td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

/* Form Elements */
input[type="text"],
input[type="date"],
select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

input[type="text"]:focus,
input[type="date"]:focus,
select:focus {
    border-color: #1a3c6e;
    outline: none;
    box-shadow: 0 0 5px rgba(26, 60, 110, 0.2);
}

/* Buttons */
button {
    padding: 12px 24px;
    font-size: 1em;
    background-color: #1a3c6e;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 15px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #15325c;
}

button[type="submit"] {
    background-color: #cc0000;
    display: block;
    margin: 30px auto;
    padding: 15px 30px;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

button[type="submit"]:hover {
    background-color: #aa0000;
}

button[type="button"] {
    background-color: #666;
    font-size: 14px;
    padding: 8px 16px;
}

button[type="button"]:hover {
    background-color: #555;
}

/* Canvas & Signature */
canvas {
    display: block;
    margin-top: 10px;
    margin-bottom: 15px;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#signatureCanvas {
    width: 100%;
    max-width: 500px;
    height: 150px;
    margin: 0 auto;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 4px;
}


/* Text Content */
p {
    font-size: 0.95em;
    line-height: 1.5;
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    border-left: 3px solid #cc0000;
}

/* Flexible Layout Sections */
.flex-section {
    display: flex;
    justify-content: space-between;
    gap: 30px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.flex-section > div {
    flex: 1;
    min-width: 300px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
}

/* Print Settings */
@media print {
    button {
        display: none;
    }

    body {
        margin: 0;
        padding: 20px;
        background-color: white;
    }

    .flex-section > div {
        box-shadow: none;
        padding: 0;
    }

    input, select {
        border: none;
    }
}

/* Mobile Responsive Design - Everything Stacks Vertically */
@media (max-width: 800px) {
    /* Adjust body margins for mobile */
    body {
        margin: 10px;
        padding: 0;
    }

    /* Adjust header and logo for mobile */
    h1 {
        font-size: 1.8em;
        margin-bottom: 20px;
    }

    .logo {
        margin-bottom: 20px;
    }

    /* Stack flex sections vertically on mobile */
    .flex-section {
        flex-direction: column;
        gap: 20px;
    }

    /* Make each section take full width on mobile */
    .flex-section > div {
        width: 100%;
        min-width: unset;
        flex: none;
        margin-bottom: 20px;
    }

    /* Adjust table layout for mobile */
    th {
        width: 40%;
    }

    /* Make signature section stack vertically on mobile */
    .flex-section:last-of-type > div {
        text-align: center;
    }

    /* Adjust signature canvas for mobile */
    #signatureCanvas {
        margin: 0 auto;
    }

    /* Adjust buttons for mobile */
    button[type="submit"] {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }

    /* Adjust section headers for mobile */
    h2 {
        font-size: 1.3em;
        margin-top: 25px;
    }

    h3 {
        font-size: 1.1em;
    }
}

@media (prefers-color-scheme: dark) {
    #signatureCanvas {
        background-color: white !important;
    }
}
