/* WPMS Forms - Простые стили с выравниванием */

.wpms-form {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #f9f9f9;
}

/* Контейнер для каждого поля формы */
.wpms-form .field-container {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    row-gap: 6px;
}

.wpms-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
    min-height: 20px;
    line-height: 1.2;
}

.wpms-form input[type="text"],
.wpms-form input[type="email"],
.wpms-form input[type="tel"],
.wpms-form input[type="url"],
.wpms-form textarea,
.wpms-form select {
    width: 100%;
    padding: 10px;
    margin: 0;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
    box-sizing: border-box;
    min-height: 40px;
}

.wpms-form input[type="file"] {
    width: 100%;
    padding: 8px;
    margin: 0;
    background: #f9f9f9;
    border: 2px dashed #ccc;
    border-radius: 3px;
    cursor: pointer;
    box-sizing: border-box;
    min-height: 40px;
}

.wpms-form input[type="file"]:hover {
    border-color: #0073aa;
    background: #f0f8ff;
}

.wpms-form textarea {
    min-height: 80px;
    resize: vertical;
    line-height: 1.4;
}

.wpms-form input[type="submit"],
.wpms-form button[type="submit"] {
    background: #0073aa;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    margin-top: 15px;
    min-height: 40px;
    transition: background-color 0.3s ease;
    align-self: flex-start;
}

.wpms-form input[type="submit"]:hover,
.wpms-form button[type="submit"]:hover {
    background: #005a87;
}

.wpms-form input[type="submit"]:disabled,
.wpms-form button[type="submit"]:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.wpms-form input[type="radio"],
.wpms-form input[type="checkbox"] {
    margin-right: 8px;
    margin-bottom: 5px;
    vertical-align: middle;
}

.wpms-form .radio-group,
.wpms-form .checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.wpms-form .radio-item,
.wpms-form .checkbox-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.wpms-form .radio-item label,
.wpms-form .checkbox-item label {
    margin-bottom: 0;
    margin-left: 5px;
    font-weight: normal;
    min-height: auto;
}

.wpms-form .file-info {
    margin-top: 5px;
    padding: 8px;
    background: #e8f4fd;
    border: 1px solid #bee5eb;
    border-radius: 3px;
    font-size: 12px;
    color: #0c5460;
}

.wpms-form .file-error {
    margin-top: 5px;
    padding: 8px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 3px;
    font-size: 12px;
    color: #721c24;
}

.wpms-form .file-upload-info {
    margin-top: 8px;
    padding: 10px;
    background: #f0f8ff;
    border: 1px solid #b3d9ff;
    border-left: 4px solid #0073aa;
    border-radius: 4px;
    font-size: 12px;
    color: #333;
    line-height: 1.4;
}

.wpms-form .file-upload-info strong {
    color: #0073aa;
    font-weight: 600;
}

/* Стили для Google reCAPTCHA */
.wpms-form .g-recaptcha {
    margin: 15px 0;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 40px;
}

.wpms-form .g-recaptcha > div {
    margin: 0 auto;
}

/* Адаптивность для reCAPTCHA */
@media (max-width: 480px) {
    .wpms-form .g-recaptcha {
        transform: scale(0.8);
        transform-origin: center;
    }
}

.wpms-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
}

.wpms-success h3 {
    margin-top: 0;
    color: #155724;
}

.wpms-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
}

/* Стили для админки */
.wpms-submissions-list table {
    margin-top: 10px;
}

.status-confirmed {
    color: #46b450;
    font-weight: bold;
}

.status-pending {
    color: #ffb900;
    font-weight: bold;
}

.wpms-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.wpms-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 5px;
}

.wpms-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.wpms-modal-close:hover {
    color: black;
}

.submission-details {
    max-height: 400px;
    overflow-y: auto;
}

.submission-details table {
    width: 100%;
    border-collapse: collapse;
}

.submission-details table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.submission-details table td:first-child {
    width: 30%;
    font-weight: bold;
}

/* Адаптивность */
@media (max-width: 768px) {
    .wpms-form {
        margin: 10px;
        padding: 15px;
    }
    
    .wpms-modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

/* Ровное выравнивание формы на широких экранах */
@media (min-width: 768px) {
    /* Два столбца: слева лейбл, справа поле */
    .wpms-form .field-container {
        display: grid;
        grid-template-columns: 180px 1fr;
        align-items: start;
        column-gap: 16px;
        row-gap: 10px;
        margin-bottom: 18px;
    }

    .wpms-form label {
        margin-bottom: 0;
        text-align: left;
        align-self: start;
    }

    /* Явно закрепляем колонки для предсказуемого отступа слева */
    .wpms-form .field-container > label {
        grid-column: 1 / 2;
    }
    .wpms-form .field-container > input[type="text"],
    .wpms-form .field-container > input[type="email"],
    .wpms-form .field-container > input[type="tel"],
    .wpms-form .field-container > input[type="url"],
    .wpms-form .field-container > input[type="file"],
    .wpms-form .field-container > textarea,
    .wpms-form .field-container > select,
    .wpms-form .field-container > .radio-group,
    .wpms-form .field-container > .checkbox-group,
    .wpms-form .field-container > .file-info,
    .wpms-form .field-container > .file-error,
    .wpms-form .field-container > .file-upload-info {
        grid-column: 2 / 3;
    }

    /* Группы радио и чекбоксов выравниваем по колонке поля */
    .wpms-form .radio-group,
    .wpms-form .checkbox-group {
        display: grid;
        grid-auto-rows: minmax(20px, auto);
        row-gap: 6px;
    }

    /* Кнопка отправки и reCAPTCHA выравниваются по правой колонке */
    .wpms-form input[type="submit"],
    .wpms-form button[type="submit"],
    .wpms-form .g-recaptcha {
        grid-column: 2 / 3;
        justify-self: start;
    }

    /* Поля начинаются сверху, чтобы верхние кромки были на одной линии */
    .wpms-form input[type="text"],
    .wpms-form input[type="email"],
    .wpms-form input[type="tel"],
    .wpms-form input[type="url"],
    .wpms-form input[type="file"],
    .wpms-form textarea,
    .wpms-form select,
    .wpms-form .radio-group,
    .wpms-form .checkbox-group {
        align-self: start;
    }

    /* По умолчанию reCAPTCHA была по центру — выравниваем влево для ровной сетки */
    .wpms-form .g-recaptcha {
        justify-content: flex-start;
    }
}