/**
 * Public-facing styles for document form
 *
 * @package    Edocman
 * @subpackage Edocman/public/css
 */

.edocman-frontend-form {
    max-width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.edocman-form-container {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.edocman-form-container h2 {
    margin: 0 0 30px 0;
    padding: 0 0 15px 0;
    border-bottom: 2px solid #0073aa;
    color: #333;
    font-size: 28px;
    font-weight: 600;
}

/* Messages */
.edocman-messages {
    margin-bottom: 20px;
}

.edocman-message {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
}

.edocman-success {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.edocman-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Form Sections */
.edocman-form-section {
    margin-bottom: 40px;
    padding: 25px;
    background: #f9f9f9;
    border-radius: 6px;
    border-left: 4px solid #0073aa;
}

.edocman-form-section h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 20px;
    font-weight: 500;
}

/* Field Groups */
.edocman-field-group {
    margin-bottom: 25px;
}

.edocman-field-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.edocman-field-group label.required {
    position: relative;
}

.required-mark {
    color: #d63638;
    font-weight: bold;
}

/* Form Controls */
.edocman-input,
.edocman-select,
.edocman-textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.edocman-input:focus,
.edocman-select:focus,
.edocman-textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.edocman-textarea {
    resize: vertical;
    min-height: 100px;
}

.edocman-select[multiple] {
    min-height: 120px;
}

/* Field Descriptions */
.field-description {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
    line-height: 1.4;
}

.char-counter {
    float: right;
    font-size: 11px;
    color: #666;
    margin-top: 5px;
}

.char-counter.warning {
    color: #d63638;
}

/* File Upload Area - Cập nhật */
.file-upload-area {
    position: relative;
    border: 2px dashed #ddd;
    border-radius: 6px;
    padding: 30px;
    text-align: center;
    transition: border-color 0.3s ease;
    background: #fafafa;
    cursor: pointer;
    min-height: 120px;
}

.file-upload-area:hover:not(.has-file) {
    border-color: #0073aa;
    background: #f0f8ff;
}

.file-upload-area.has-file {
    border-color: #0073aa;
    background: #f0f8ff;
    cursor: default; /* Không show pointer cursor khi đã có file */
}

.file-upload-area.dragover {
    border-color: #0073aa;
    background: #e6f3ff;
}

/* File Info - Cập nhật */
.file-upload-area .file-info {
    position: static;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: #fff;
    border: 2px solid #0073aa;
    border-radius: 4px;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    cursor: default; /* Không inherit cursor từ parent */
}

.file-info .file-details {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    pointer-events: none; /* Ngăn click events */
}

.file-info .file-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    font-size: 14px;
}

.file-info .file-size {
    font-size: 12px;
    color: #666;
}

/* Remove Button - Cập nhật */
.file-info .remove-file {
    background: #d63638;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
    position: relative;
    z-index: 10; /* Đảm bảo button ở trên cùng */
}

.file-info .remove-file:hover {
    background: #b32d2e;
    transform: scale(1.1); /* Hiệu ứng hover nhẹ */
}

.file-info .remove-file span {
    pointer-events: none; /* Ngăn click vào span */
}

/* Placeholder khi có file */
.file-upload-area.has-file .file-upload-placeholder {
    display: none !important;
}

.edocman-file-input,
.edocman-image-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-upload-placeholder,
.image-upload-placeholder {
    pointer-events: none;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.6;
}

.file-upload-placeholder p,
.image-upload-placeholder p {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.file-upload-placeholder small,
.image-upload-placeholder small {
    color: #666;
    font-size: 12px;
}

/* File Info Display */
.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 15px;
}

.file-details {
    display: flex;
    flex-direction: column;
}

.file-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.file-size {
    font-size: 12px;
    color: #666;
}

.remove-file,
.remove-image {
    background: #d63638;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.remove-file:hover,
.remove-image:hover {
    background: #b32d2e;
}

/* Image Preview */
.image-preview {
    position: relative;
    display: inline-block;
    margin-top: 15px;
}

.image-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.image-preview .remove-image {
    position: absolute;
    top: -10px;
    right: -10px;
}

/* Form Actions */
.edocman-form-actions {
    text-align: center;
    padding: 30px 0 0 0;
    border-top: 1px solid #ddd;
    margin-top: 30px;
}

.edocman-submit-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    min-width: 200px;
}

.edocman-submit-btn:hover {
    background: #005a87;
}

.edocman-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.approval-notice {
    margin-top: 15px;
    padding: 12px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    color: #856404;
    font-size: 14px;
}

.form-help {
    margin-top: 15px;
    color: #666;
    font-size: 12px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .edocman-form-container {
        padding: 20px;
        margin: 10px;
    }
    
    .edocman-form-section {
        padding: 15px;
    }
    
    .file-upload-area,
    .image-upload-area {
        padding: 20px 15px;
    }
    
    .upload-icon {
        font-size: 36px;
    }
    
    .edocman-submit-btn {
        width: 100%;
        padding: 12px;
    }
    
    .file-info {
        flex-direction: column;
        text-align: center;
    }
    
    .file-details {
        margin-bottom: 10px;
    }
}

/* Validation Styles */
.edocman-input.error,
.edocman-select.error,
.edocman-textarea.error {
    border-color: #d63638;
    box-shadow: 0 0 0 3px rgba(214, 54, 56, 0.1);
}

.field-error {
    color: #d63638;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

/* Fixed File Upload Styles */
.file-upload-area {
    position: relative;
    min-height: 120px;
}

.file-upload-area .file-info {
    position: static;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: #fff;
    border: 2px solid #0073aa;
    border-radius: 4px;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

.file-upload-area.has-file {
    border-color: #0073aa;
    background: #f0f8ff;
}

.file-info .file-details {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.file-info .file-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    font-size: 14px;
}

.file-info .file-size {
    font-size: 12px;
    color: #666;
}

.file-info .remove-file {
    background: #d63638;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}

.file-info .remove-file:hover {
    background: #b32d2e;
}

/* Image Upload Styles */
.image-upload-area {
    position: relative;
    min-height: 120px;
}

.image-upload-area .image-preview {
    position: static;
    display: inline-block;
    margin: 0;
    text-align: center;
}

.image-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.image-preview .remove-image {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #d63638;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.image-preview .remove-image:hover {
    background: #b32d2e;
}

/* Responsive fixes */
@media (max-width: 768px) {
    .file-info {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .file-info .file-details {
        margin-bottom: 0;
    }
}


