/* Custom properties for configurable dimensions */
:root {
    --modal-width: 300px; /* Adjustable modal width */
    --modal-max-height: 90vh; /* Adjustable modal max height */
    --input-height: 28px; /* Reduced input height */
    --input-width: 200px; /* Adjustable input width for single fields */
    --paired-input-width: 140px; /* Adjustable input width for two-field groups */
    --triad-input-width: 90px; /* Adjustable input width for three-field group */
    --form-gap: 8px; /* Reduced gap between form groups */
}

/* Existing styles (unchanged) */
#autofill-container {
    position: fixed;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    background: rgba(45, 45, 45, 0.9);
    padding: 8px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    font-family: 'Segoe UI', Arial, sans-serif;
    color: #ffffff;
    cursor: move;
    max-width: 289px;
    box-sizing: border-box;
    flex-wrap: wrap;
}

#ip-address {
    padding: 6px 8px;
    background: #3d3d3d;
    border-radius: 4px;
    font-size: .6em;
    font-weight: bold;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 100px;
    text-align: center;
    flex-wrap: wrap;
}

#clock {
    padding: 6px 8px;
    background: #3d3d3d;
    border-radius: 4px;
    font-size: 1.2em;
    font-weight: bold;
    color: #fefeff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 100px;
    text-align: center;
}

#form1-btn {
    background: #38bdf8;
    border: none;
    border-radius: 6px;
    padding: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s, background-color 0.3s;
}

#form1-btn:hover {
    background: #0ea5e9;
    transform: scale(1.1);
}

#form2-btn {
    background: #60a5fa;
    border: none;
    border-radius: 6px;
    padding: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s, background-color 0.3s;
}

#form2-btn:hover {
    background: #3b82f6;
    transform: scale(1.1);
}

#config-btn {
    background: #93c5fd;
    border: none;
    border-radius: 6px;
    padding: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s, background-color 0.3s;
}

#config-btn:hover {
    background: #60a5fa;
    transform: rotate(45deg);
}

#clicker-btn {
    background: #f87171;
    border: none;
    border-radius: 6px;
    padding: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s, background-color 0.3s;
}

#clicker-btn:hover {
    background: #ef4444;
    transform: scale(1.1);
}

#clicker-btn.on {
    background: #34d399;
}

#clicker-btn.on:hover {
    background: #10b981;
}

button svg {
    fill: #ffffff;
    width: 20px;
    height: 20px;
}

.clicker-icon {
    transition: transform 0.3s ease;
}

.clicker-icon.on {
    transform: rotate(360deg);
}

.clicker-icon.on .play-path {
    display: none;
}

.clicker-icon.on .pause-path {
    display: block;
}

#clicker-time {
    width: 60px;
    padding: 4px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #3d3d3d;
    color: #ffffff;
    font-size: 12px;
    text-align: center;
}

#config-modal, #clicker-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
}

#config-modal.inert, #clicker-modal.inert {
    inert: true;
}

/* Updated styles for config-modal */
.modal-content {
    background: #2d2d2d;
    margin: 20px auto;
    padding: 16px;
    width: var(--modal-width);
    max-height: var(--modal-max-height);
    overflow-y: auto;
    border-radius: 8px;
    color: #ffffff;
    box-sizing: border-box;
}

.modal-content h3 {
    margin: 0 0 16px;
    text-align: center;
    font-size: 18px;
    color: #81c2ff;
}

.modal-content p {
    margin: 0 0 16px;
    text-align: center;
    font-size: 14px;
}

#config-form {
    display: flex; /* Group items for layout control */
    flex-wrap: wrap;
    gap: var(--form-gap); /* Uniform spacing */
}



/* Group Center and Service Level */
#config-form > .form-group:nth-child(1) { /* Center */
    flex: 0 0 calc(40% - var(--form-gap));
}

#config-form > .form-group:nth-child(2) { /* Service Level */
    flex: 0 0 calc(60% - var(--form-gap));
}


/* Visa Type */
#config-form > .form-group:nth-child(3) {
    flex: 1 1 100%;
    color: #81c2ff;
    text-align: center;
    font-size: 1em;
}

/* Group Trip Date and Destination */
#config-form > .form-group:nth-child(4),
#config-form > .form-group:nth-child(5) {
    flex: 1 1 calc(50% - var(--form-gap));
}

/* Group Residence Address, Gender, Issue Place */
#config-form > .form-group:nth-child(6) { /* Residence Address */
    flex: 0 0 calc(40% - var(--form-gap));
}

#config-form > .form-group:nth-child(7) { /* Gender */
    flex: 0 0 calc(25% - var(--form-gap));
}

#config-form > .form-group:nth-child(8) { /* Issue Place */
    flex: 0 0 calc(35% - var(--form-gap));
}

/* Group Issue Date and Expiration Date */
#config-form > .form-group:nth-child(9),
#config-form > .form-group:nth-child(10) {
    flex: 1 1 calc(50% - var(--form-gap));
}

/* Full-width group for Passport */
#config-form > .form-group:nth-child(11) {
    flex: 1 1 100%;
}

.form-group {
    margin-bottom: var(--form-gap);
    display: inline-block;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: bold;
    font-size: 12px;
}

.form-group input,
.form-group select {
    width: 100%;
    height: var(--input-height);
    padding: 4px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #3d3d3d;
    color: #ffffff;
    font-size: 12px;
    box-sizing: border-box;
}

/* File input styling */
.form-group input[type="file"] {
    padding: 4px;
    height: auto;
}

.form-buttons {
    margin-top: 16px;
    text-align: right;
    clear: both;
}

.form-buttons button {
    padding: 6px 16px;
    margin-left: 8px;
    width: auto;
    height: auto;
    font-size: 12px;
}

.form-buttons button[type="submit"] {
    background: #4CAF50;
}

.form-buttons button.cancel,
.form-buttons button.cancel-btn {
    background: #f44336;
}

.form-buttons button.start-btn {
    background: #38bdf8;
}

.form-buttons button.end-btn {
    background: #60a5fa;
}

.form-buttons button.clear-data {
    background: #ff9800;
}

#passport-status, #passport-error, #passport-current {
    margin-top: 4px;
    font-size: 11px;
}

#passport-status {
    color: #4CAF50;
    display: none;
}

#passport-error {
    color: #f44336;
    display: none;
}

#passport-current {
    color: #93c5fd;
    display: none;
}