/**
 * GF Form Main - Frontend Styles
 * 
 * Style specyficzne dla frontend
 * 
 * @package GF_Form_Manager
 * @version 1.0.0
 */

/* Frontend specific styles */
.gf-form-main-frontend {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Form preview styles - używane w podglądzie wypełnienia */
.gf-form-preview {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.gf-form-preview-header {
    background: #f8f9fa;
    padding: 20px;
    border-bottom: 1px solid #e1e5e9;
}

.gf-form-preview-header h3 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

.gf-preview-date {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.gf-form-preview-body {
    padding: 20px;
}

.gf-field-preview {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.gf-field-preview:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.gf-field-label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 16px;
}

.gf-field-label .required {
    color: #e74c3c;
    margin-left: 4px;
}

.gf-field-value {
    color: #555;
    font-size: 15px;
    line-height: 1.5;
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 6px;
    border-left: 4px solid #0073aa;
}

.gf-field-value p {
    margin: 0;
}

.gf-field-value ul,
.gf-field-value ol {
    margin: 0;
    padding-left: 20px;
}

.gf-field-value img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Form styling */
.gf-form-main-frontend .gf-form {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.gf-form-main-frontend .gf-field {
    margin-bottom: 25px;
}

.gf-form-main-frontend .gf-field label {
    color: #333;
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
}

.gf-form-main-frontend .gf-field input,
.gf-form-main-frontend .gf-field textarea,
.gf-form-main-frontend .gf-field select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.gf-form-main-frontend .gf-field input:focus,
.gf-form-main-frontend .gf-field textarea:focus,
.gf-form-main-frontend .gf-field select:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.gf-form-main-frontend .gf-button {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: #fff;
    border: none;
    padding: 14px 28px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gf-form-main-frontend .gf-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 115, 170, 0.3);
}

.gf-form-main-frontend .gf-button:active {
    transform: translateY(0);
}

/* Document list */
.gf-form-main-frontend .document-item {
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.gf-form-main-frontend .document-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.gf-form-main-frontend .document-item h4 {
    color: #333;
    margin: 0 0 10px 0;
    font-size: 18px;
}

.gf-form-main-frontend .document-item p {
    color: #666;
    margin: 0 0 15px 0;
    line-height: 1.5;
}

/* Modal enhancements */
.gf-form-main-frontend .gf-modal-content {
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.gf-form-main-frontend .gf-modal-header {
    background: #f8f9fa;
    margin: -20px -20px 20px -20px;
    padding: 20px;
    border-radius: 12px 12px 0 0;
}

.gf-form-main-frontend .gf-modal-title {
    color: #333;
    font-size: 20px;
    font-weight: 600;
}

/* Loading states */
.gf-form-main-frontend .gf-loading {
    padding: 40px;
    text-align: center;
}

.gf-form-main-frontend .gf-spinner {
    width: 32px;
    height: 32px;
    border-width: 4px;
}

/* Success states */
.gf-form-main-frontend .gf-message.success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px 20px;
    border-radius: 6px;
    margin: 15px 0;
}

.gf-form-main-frontend .gf-message.error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px 20px;
    border-radius: 6px;
    margin: 15px 0;
}

/* Modal form styles */
.form-modal-body .gf-form {
    margin: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.form-modal-body .gf-form-body {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 10px;
}

.form-modal-body .gf-form-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.form-modal-body label{
    min-width: 200px;
}

.form-modal-body .gf-field {
    margin-bottom: 20px;
}

.form-modal-body .gf-field label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 16px;
}

.form-modal-body .gf-field .required {
    color: #dc3545;
    font-weight: bold;
}

.form-modal-body .gf-field input,
.form-modal-body .gf-field textarea,
.form-modal-body .gf-field select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-modal-body .gf-field input:focus,
.form-modal-body .gf-field textarea:focus,
.form-modal-body .gf-field select:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.form-modal-body .gf-field textarea {
    min-height: 100px;
    resize: vertical;
}

.form-modal-body .gf-field input[type="radio"],
.form-modal-body .gf-field input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.form-modal-body .gf-field label input[type="radio"],
.form-modal-body .gf-field label input[type="checkbox"] {
    margin-right: 8px;
}

.form-modal-body .gf-button {
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.form-modal-body .gf-button:hover {
    background: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.form-modal-body .gf-button:active {
    transform: translateY(0);
}

.form-modal-body .gf-cancel-button {
    background: #6c757d;
}

.form-modal-body .gf-cancel-button:hover {
    background: #5a6268;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* Responsive design */
@media (max-width: 768px) {
    .gf-form-main-frontend .gf-form {
        padding: 20px;
        margin: 10px;
    }
    
    .gf-form-main-frontend .gf-field input,
    .gf-form-main-frontend .gf-field textarea,
    .gf-form-main-frontend .gf-field select {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .gf-form-main-frontend .gf-button {
        width: 100%;
        padding: 16px;
    }
    
    .gf-form-main-frontend .document-item {
        margin: 10px;
    }
    
    .form-modal-body .gf-form-footer {
        flex-direction: column;
    }
    
    .form-modal-body .gf-button {
        width: 100%;
    }
}

/* Style dla wartości pól w podglądzie */
.preview-values {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.4;
}

.preview-fields-values {
    color: #495057;
    margin-bottom: 4px;
}

/* Style dla pól adresowych w modalu */
.form-modal-body .gf-address-field {
    margin-bottom: 25px;
    padding: 25px;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
}

.form-modal-body .gf-address-field-label {
    margin-bottom: 20px;
}

.form-modal-body .gf-address-field-label h4 {
    margin: 0;
    font-weight: 600;
    color: #333;
    font-size: 18px;
    padding-bottom: 8px;
    border-bottom: 2px solid #0073aa;
}

.form-modal-body .gf-address-field-label .required {
    color: #dc3545;
    font-weight: bold;
}

.form-modal-body .gf-address-parts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
    align-items: start;
}

.form-modal-body .gf-address-part {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
    align-items: stretch;
    min-height: 80px;
}

.form-modal-body .gf-address-part label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
    line-height: 1.2;
    height: auto;
    min-height: 20px;
    width: 100%;
    max-width: 100%;
    display: block;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    flex-grow: 0;
    flex-basis: auto;
}

.form-modal-body .gf-address-part input {
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    flex: 1;
    height: 48px;
    margin-top: 0;
    margin-bottom: 0;
}

.form-modal-body .gf-address-part input:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

/* Style dla pól Imię i nazwisko w modalu */
.form-modal-body .gf-name-field {
    margin-bottom: 25px;
    padding: 25px;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
}

.form-modal-body .gf-name-field > label {
    display: block;
    font-weight: 600;
    color: #333;
    font-size: 18px;
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 2px solid #0073aa;
}

.form-modal-body .gf-name-field .required {
    color: #dc3545;
    font-weight: bold;
}

.form-modal-body .gf-name-subfields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
    align-items: start;
}

.form-modal-body .gf-name-subfield {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
    align-items: stretch;
    min-height: 80px;
}

.form-modal-body .gf-name-subfield label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
    line-height: 1.2;
    height: auto;
    min-height: 20px;
    width: 100%;
    max-width: 100%;
    display: block;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    flex-grow: 0;
    flex-basis: auto;
}

.form-modal-body .gf-name-subfield input {
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    flex: 1;
    height: 48px;
    margin-top: 0;
    margin-bottom: 0;
}

.form-modal-body .gf-name-subfield input:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

/* Responsywność dla pól adresowych */
@media (max-width: 768px) {
    .form-modal-body .gf-address-parts {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-modal-body .gf-address-field {
        padding: 20px;
    }
    
    .form-modal-body .gf-address-field-label h4 {
        font-size: 16px;
    }
    
    /* Responsywność dla pól Imię i nazwisko */
    .form-modal-body .gf-name-subfields {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-modal-body .gf-name-field {
        padding: 20px;
    }
    
    .form-modal-body .gf-name-field > label {
        font-size: 16px;
    }
}

.preview-field {
    display: inline-block;
    margin-right: 8px;
}

.preview-field strong {
    color: #6c757d;
    font-weight: 600;
}

.preview-fields-more {
    color: #6c757d;
    font-style: italic;
    font-size: 12px;
}

/* Style dla przycisków PDF */
.submission-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: nowrap;
}

.preview-values {
    flex-shrink: 0;
    order: 1;
}

.preview-submission {
    flex: 1;
    order: 2;
}


/* Ikona PDF jest teraz w tekście przycisku, nie w :before */

/* Style dla wartości pól w podglądzie */
.preview-values {
    margin: 0;
    padding: 6px 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.4;
    display: inline-block;
    white-space: nowrap;
    flex-shrink: 0;
}

.preview-fields-values {
    color: #495057;
    margin-bottom: 4px;
}

.preview-field {
    display: inline-block;
    margin-right: 8px;
}

.preview-field strong {
    color: #6c757d;
    font-weight: 600;
}

.preview-fields-more {
    color: #6c757d;
    font-style: italic;
    font-size: 12px;
}

/* Responsywność dla wartości pól */
@media (max-width: 768px) {
    .submission-item {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .preview-values {
        order: 1;
        font-size: 12px;
        padding: 6px 10px;
        white-space: normal;
    }
    
    .preview-submission {
        order: 2;
    }
    
    
    .preview-field {
        display: block;
        margin-bottom: 4px;
        margin-right: 0;
    }
}

/* Style dla istniejących dokumentów w modalu podpisanego dokumentu */
.gf-field-existing-documents {
    margin-bottom: 25px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.gf-field-existing-documents label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.existing-documents-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.document-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.document-item:hover {
    border-color: #007cba;
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.1);
}

.document-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.document-name {
    font-size: 13px;
    color: #495057;
    font-weight: 500;
    word-break: break-all;
}

.document-link {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    background: #007cba;
    color: #fff !important;
    text-decoration: none;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.document-link:hover {
    background: #005a87;
    color: #fff !important;
    text-decoration: none;
}

/* Responsywność dla dokumentów */
@media (max-width: 768px) {
    .document-item {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .document-info {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .document-link {
        align-self: flex-start;
    }
}
