/* Modern and Professional Styles for Commitment Signature Plugin */

:root {
    --csp-primary: #2563eb;
    --csp-secondary: #64748b;
    --csp-success: #10b981;
    --csp-danger: #ef4444;
    --csp-warning: #f59e0b;
    --csp-dark: #1e293b;
    --csp-light: #f8fafc;
    --csp-border: #e2e8f0;
    --csp-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --csp-radius: 12px;
}

* {
    box-sizing: border-box;
}

/* Container Styles */
.csp-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: 'Vazir', Tahoma, sans-serif;
    direction: rtl;
}

.csp-form-wrapper {
    background: white;
    border-radius: var(--csp-radius);
    box-shadow: var(--csp-shadow);
    overflow: hidden;
    animation: fadeInUp 0.5s ease;
}

/* Header Styles */
.csp-header {
    background: linear-gradient(135deg, var(--csp-primary), #3b82f6);
    color: white;
    padding: 30px;
    text-align: center;
}

.csp-header-text {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.csp-logo-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.csp-logo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.csp-org-name {
    font-size: 20px;
    font-weight: 600;
}

/* Commitment Section */
.csp-commitment-section {
    padding: 40px;
    background: var(--csp-light);
    border-bottom: 1px solid var(--csp-border);
}

.commitment-title {
    text-align: center;
    font-size: 24px;
    color: var(--csp-dark);
    margin-bottom: 30px;
    font-weight: bold;
}

.csp-commitment-text-editable {
    line-height: 2.5;
    font-size: 16px;
    color: var(--csp-dark);
    text-align: justify;
    background: white;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid var(--csp-border);
}

/* Inline Input Styles */
.inline-input {
    display: inline-block;
    border: none;
    border-bottom: 2px dotted var(--csp-primary);
    background: transparent;
    padding: 2px 8px;
    margin: 0 5px;
    min-width: 150px;
    font-size: 16px;
    font-family: inherit;
    color: var(--csp-primary);
    transition: all 0.3s ease;
}

.inline-input:focus {
    outline: none;
    border-bottom: 2px solid var(--csp-primary);
    background: rgba(37, 99, 235, 0.05);
}

.inline-input::placeholder {
    color: #94a3b8;
    font-size: 14px;
}

.inline-select {
    display: inline-block;
    border: none;
    border-bottom: 2px dotted var(--csp-primary);
    background: transparent;
    padding: 2px 8px;
    margin: 0 5px;
    font-size: 16px;
    font-family: inherit;
    color: var(--csp-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.inline-select:focus {
    outline: none;
    border-bottom: 2px solid var(--csp-primary);
    background: rgba(37, 99, 235, 0.05);
}

.signature-section-text {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px dashed var(--csp-border);
}

.signature-section-text p {
    margin: 10px 0;
}

.signature-name {
    min-width: 200px;
}

/* Form Styles */
.csp-form {
    padding: 40px;
}

.form-section-title {
    font-size: 18px;
    color: var(--csp-dark);
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--csp-primary);
}

.csp-form-group {
    margin-bottom: 25px;
}

.csp-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--csp-dark);
    font-size: 15px;
}

.csp-form-group .required {
    color: var(--csp-danger);
}

.form-help {
    display: block;
    margin-top: 5px;
    font-size: 13px;
    color: var(--csp-secondary);
}

.csp-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--csp-border);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: white;
    max-width: 400px;
}

.csp-input:focus {
    outline: none;
    border-color: var(--csp-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Button Styles */
.csp-btn {
    padding: 12px 32px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.csp-btn-primary {
    background: linear-gradient(135deg, var(--csp-primary), #3b82f6);
    color: white;
}

.csp-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
}

.csp-btn-secondary {
    background: var(--csp-secondary);
    color: white;
}

.csp-btn-secondary:hover {
    background: #475569;
}

.csp-btn-success {
    background: var(--csp-success);
    color: white;
}

.csp-btn-success:hover {
    background: #059669;
}

.csp-form-actions {
    text-align: center;
    padding-top: 20px;
}

/* Modal Styles - COMPLETELY FIXED */
.csp-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
}

.csp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.csp-modal-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.csp-modal-content {
    position: relative;
    background: white;
    width: 100%;
    max-width: 600px;
    margin: 20px auto;
    border-radius: var(--csp-radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideIn 0.3s ease;
}

.csp-modal-content.csp-modal-large {
    max-width: 900px;
}

.csp-modal-header {
    position: sticky;
    top: 0;
    background: white;
    padding: 20px 30px;
    border-bottom: 1px solid var(--csp-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--csp-radius) var(--csp-radius) 0 0;
    z-index: 10;
}

.csp-modal-header h3 {
    margin: 0;
    color: var(--csp-dark);
    font-size: 20px;
}

.csp-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: var(--csp-secondary);
    transition: color 0.3s ease;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.csp-modal-close:hover {
    color: var(--csp-danger);
}

.csp-modal-body {
    padding: 30px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.csp-modal-footer {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 20px 30px;
    border-top: 1px solid var(--csp-border);
    display: flex;
    justify-content: center;
    gap: 15px;
    border-radius: 0 0 var(--csp-radius) var(--csp-radius);
}

/* Signature Pad Styles */
.signature-pad-wrapper {
    border: 2px dashed var(--csp-border);
    border-radius: 8px;
    margin: 20px 0;
    background: white;
    position: relative;
}

.signature-pad {
    width: 100%;
    height: 200px;
    cursor: crosshair;
}

.signature-instruction {
    text-align: center;
    color: var(--csp-secondary);
    margin-bottom: 20px;
}

.signature-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

/* Preview Document Styles */
.csp-preview-document {
    background: white;
    padding: 40px;
}

.csp-doc-header {
    text-align: center;
    margin-bottom: 40px;
}

.csp-doc-bismillah {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    color: var(--csp-dark);
}

.csp-doc-logo-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.csp-doc-logo {
    width: 80px;
    height: 80px;
}

.csp-doc-org {
    font-size: 20px;
    font-weight: 600;
    color: var(--csp-primary);
}

.csp-doc-body {
    padding: 20px 0;
}

.csp-doc-text {
    line-height: 2;
    text-align: justify;
    margin-bottom: 40px;
    font-size: 16px;
}

.csp-doc-text strong {
    color: var(--csp-primary);
}

.csp-doc-signature-section {
    border-top: 2px solid var(--csp-border);
    padding-top: 30px;
    margin-top: 40px;
}

.csp-doc-info p {
    margin: 10px 0;
    font-size: 15px;
}

.csp-doc-signature {
    margin-top: 30px;
    text-align: center;
}

.signature-label {
    font-weight: bold;
    margin-bottom: 15px;
}

.signature-image {
    max-width: 300px;
    height: auto;
    border: 1px solid var(--csp-border);
    border-radius: 4px;
    padding: 10px;
    background: var(--csp-light);
}

/* Success Message */
.csp-message {
    padding: 20px;
    border-radius: var(--csp-radius);
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 20px;
    animation: slideIn 0.5s ease;
}

.csp-success {
    background: linear-gradient(135deg, #10b981, #34d399);
    color: white;
}

.message-icon {
    font-size: 48px;
    background: white;
    color: var(--csp-success);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-content h4 {
    margin: 0 0 10px 0;
    font-size: 20px;
}

.message-content p {
    margin: 0;
    font-size: 16px;
}

/* Field Error Style */
.field-error {
    border-color: var(--csp-danger) !important;
    background-color: #fef2f2 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .csp-container {
        padding: 0 15px;
        margin: 20px auto;
    }
    
    .csp-form-wrapper {
        border-radius: 8px;
    }
    
    .csp-header {
        padding: 20px;
    }
    
    .csp-header-text {
        font-size: 20px;
    }
    
    .csp-logo {
        width: 50px;
        height: 50px;
    }
    
    .csp-commitment-section,
    .csp-form {
        padding: 20px;
    }
    
    .csp-commitment-text-editable {
        padding: 15px;
        font-size: 14px;
        line-height: 2;
    }
    
    .inline-input,
    .inline-select {
        min-width: 100px;
        font-size: 14px;
        display: block;
        width: 100%;
        margin: 10px 0;
    }
    
    .csp-modal-container {
        padding: 10px;
    }
    
    .csp-modal-content {
        margin: 10px auto;
    }
    
    .csp-modal-body {
        padding: 20px;
    }
    
    .signature-pad {
        height: 150px;
    }
    
    .csp-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .csp-modal-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .csp-modal-footer .csp-btn {
        width: 100%;
    }
    
    .csp-preview-document {
        padding: 20px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Print Styles */
@media print {
    .csp-modal-header,
    .csp-modal-footer,
    .csp-btn,
    .csp-modal-close {
        display: none !important;
    }
    
    .csp-preview-document {
        padding: 20px;
    }
}