/* Tools shared form styles */

.tools-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
}

/* Banners */
.banner {
    background: #1a1200;
    border: 1px solid #cc7a29;
    border-radius: 8px;
    padding: 14px 20px;
    margin-bottom: 1rem;
    width: 100%;
    text-align: center;
    font-size: 0.9rem;
    color: #ccc;
    line-height: 1.5;
}

.banner.banner-info {
    background: #0a1020;
    border-color: #4a70b0;
    color: #aac8ee;
}

.banner.banner-warning {
    background: #1a1500;
    border-color: #b09030;
    color: #ddc870;
}

body.starfield-view .banner {
    background: rgba(255, 153, 51, 0.1);
    border-color: rgba(255, 153, 51, 0.3);
}

body.starfield-view .banner.banner-info {
    background: rgba(100, 160, 255, 0.08);
    border-color: rgba(100, 160, 255, 0.3);
}

body.starfield-view .banner.banner-warning {
    background: rgba(255, 200, 50, 0.08);
    border-color: rgba(255, 200, 50, 0.3);
}

/* Page header */
.tools-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tools-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.3rem;
}

.tools-header p {
    color: #999;
    font-size: 1rem;
}

/* Form groups */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: #ddd;
    margin-bottom: 4px;
    font-weight: 500;
}

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

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

/* Inputs */
input[type="text"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    background: #111;
    border: 1px solid #555;
    border-radius: 6px;
    color: #fff;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

body.starfield-view input[type="text"],
body.starfield-view input[type="date"],
body.starfield-view input[type="time"],
body.starfield-view input[type="number"],
body.starfield-view input[type="email"],
body.starfield-view input[type="tel"],
body.starfield-view input[type="datetime-local"],
body.starfield-view select,
body.starfield-view textarea {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    color: #e0e0e0;
}

/* Dark theme for date/time pickers */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    color-scheme: dark;
}

/* Fix invisible date/time picker icons (calendar, clock) */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(0.8) brightness(1.5);
    cursor: pointer;
    opacity: 1;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #ff9933;
    box-shadow: 0 0 0 2px rgba(255, 153, 51, 0.4);
}

body.starfield-view input:focus,
body.starfield-view select:focus,
body.starfield-view textarea:focus {
    border-color: rgba(255, 153, 51, 0.6);
    box-shadow: 0 0 0 2px rgba(255, 153, 51, 0.2);
}

input::placeholder,
textarea::placeholder {
    color: #777;
}

body.starfield-view input::placeholder,
body.starfield-view textarea::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

/* Disabled state */
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #0a0a0a;
    border-color: #444;
}

body.starfield-view input:disabled,
body.starfield-view select:disabled,
body.starfield-view textarea:disabled {
    opacity: 0.5;
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Autofill override - prevent white background on autofill */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: #e0e0e0;
    -webkit-box-shadow: 0 0 0px 1000px #1a1a1a inset;
    transition: background-color 5000s ease-in-out 0s;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

select option {
    background: #111;
    color: #fff;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-primary {
    background: #331a00;
    color: #ff9933;
    border: 1px solid #cc7a29;
}

.btn-primary:hover {
    background: #4d2600;
    border-color: #ff9933;
}

.btn-secondary {
    background: #222;
    color: #ccc;
    border: 1px solid #666;
}

.btn-secondary:hover {
    background: #333;
    border-color: #888;
}

.btn-danger {
    background: #2a0a0a;
    color: #e07070;
    border: 1px solid #aa4444;
    padding: 6px 14px;
    font-size: 0.85rem;
}

.btn-danger:hover {
    background: #3a1010;
    border-color: #e07070;
}

body.starfield-view .btn-primary {
    background: rgba(255, 153, 51, 0.2);
    border-color: rgba(255, 153, 51, 0.4);
}

body.starfield-view .btn-primary:hover {
    background: rgba(255, 153, 51, 0.3);
    border-color: rgba(255, 153, 51, 0.7);
}

body.starfield-view .btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

body.starfield-view .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

body.starfield-view .btn-danger {
    background: rgba(220, 60, 60, 0.15);
    border-color: rgba(220, 60, 60, 0.3);
}

body.starfield-view .btn-danger:hover {
    background: rgba(220, 60, 60, 0.25);
    border-color: rgba(220, 60, 60, 0.5);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.button-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

/* Trip entry cards */
.entry-card {
    background: #111;
    border: 1px solid #555;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 1.25rem;
    position: relative;
}

body.starfield-view .entry-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.entry-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #444;
}

body.starfield-view .entry-card-header {
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

.entry-card-header h3 {
    color: #ff9933;
    font-size: 1rem;
    font-weight: 600;
}

/* Section dividers within cards */
.form-section-label {
    font-size: 0.8rem;
    color: #ff9933;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

body.starfield-view .form-section-label {
    color: rgba(255, 153, 51, 0.7);
}

/* QR code display area */
.qr-output {
    text-align: center;
    margin-top: 2rem;
    padding: 24px;
    background: #111;
    border: 1px solid #555;
    border-radius: 10px;
}

body.starfield-view .qr-output {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.qr-output h3 {
    color: #ff9933;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.qr-canvas-wrapper {
    display: inline-block;
    padding: 16px;
    background: #fff;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.qr-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 1rem;
}

.qr-nav button {
    background: #222;
    border: 1px solid #666;
    color: #ccc;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.qr-nav button:hover:not(:disabled) {
    background: #333;
    border-color: #888;
}

body.starfield-view .qr-nav button {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

body.starfield-view .qr-nav button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.qr-nav button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.qr-nav .qr-indicator {
    color: #999;
    font-size: 0.9rem;
}

/* Validation errors */
.field-error {
    border-color: #cc3333 !important;
}

body.starfield-view .field-error {
    border-color: rgba(220, 60, 60, 0.6) !important;
}

.error-message {
    color: #e07070;
    font-size: 0.8rem;
    margin-top: 4px;
}

.validation-summary {
    background: #2a0a0a;
    border: 1px solid #aa4444;
    border-radius: 8px;
    padding: 14px 20px;
    margin-bottom: 1rem;
    color: #e07070;
    font-size: 0.9rem;
}

body.starfield-view .validation-summary {
    background: rgba(220, 60, 60, 0.1);
    border-color: rgba(220, 60, 60, 0.3);
}

/* Page-level controls */
.page-control {
    background: #111;
    border: 1px solid #555;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 1.5rem;
}

body.starfield-view .page-control {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.page-control label {
    display: block;
    font-size: 0.85rem;
    color: #ddd;
    margin-bottom: 6px;
    font-weight: 500;
}

body.starfield-view .page-control label {
    color: #bbb;
}

/* Footer info */
.protocol-footer {
    text-align: center;
    color: #777;
    font-size: 0.8rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #333;
}

body.starfield-view .protocol-footer {
    color: rgba(255, 255, 255, 0.2);
    border-top-color: rgba(255, 255, 255, 0.05);
}

/* Checkbox styles */
.checkbox-group {
    margin-top: -0.5rem;
    margin-bottom: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #ddd;
    font-size: 0.9rem;
}

body.starfield-view .checkbox-label {
    color: #bbb;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #ff9933;
    cursor: pointer;
}

/* Back link */
.back-link {
    margin-bottom: 1.5rem;
}

.back-link a {
    color: #aaa;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.back-link a:hover {
    color: #fff;
}

body.starfield-view .back-link a {
    color: rgba(255, 255, 255, 0.5);
}

body.starfield-view .back-link a:hover {
    color: rgba(255, 255, 255, 0.8);
}

body.starfield-view .form-group label {
    color: #bbb;
}

/* Print styles */
@media print {
    body {
        background: #fff !important;
        color: #000 !important;
    }
    canvas#starfield,
    .banner,
    .tools-header,
    .page-control,
    .entry-card,
    .button-row,
    .back-link,
    .protocol-footer,
    footer,
    .qr-nav,
    .view-toggle {
        display: none !important;
    }
    .qr-output {
        background: none !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .qr-canvas-wrapper {
        box-shadow: none !important;
    }
    /* Show all QR codes for printing */
    .qr-code-page {
        display: block !important;
        page-break-after: always;
        text-align: center;
        padding-top: 40px;
    }
    .qr-code-page:last-child {
        page-break-after: auto;
    }
    .qr-print-label {
        font-size: 14pt;
        margin-bottom: 20px;
        color: #000;
    }
}

/* Responsive */
@media (max-width: 600px) {
    .tools-container {
        padding: 20px 14px;
    }
    .tools-header h1 {
        font-size: 1.6rem;
    }
    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }
    .entry-card {
        padding: 14px;
    }
    .button-row {
        flex-direction: column;
    }
    .btn {
        width: 100%;
    }
}
