/* ==========================================
   Public Contract Form Styles
   ========================================== */

:root {
    --mcp-primary: #2563eb;
    --mcp-secondary: #64748b;
    --mcp-success: #10b981;
    --mcp-danger: #ef4444;
    --mcp-warning: #f59e0b;
    --mcp-dark: #1e293b;
    --mcp-light: #f8fafc;
    --mcp-border: #e2e8f0;
    --mcp-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --mcp-radius: 12px;
}

* {
    box-sizing: border-box;
}

/* Container */
.mcp-container {
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: 'Vazir', Tahoma, Arial, sans-serif;
    direction: rtl;
}

.mcp-form-wrapper {
    background: white;
    border-radius: var(--mcp-radius);
    box-shadow: var(--mcp-shadow);
    overflow: hidden;
    animation: fadeInUp 0.5s ease;
}

/* Header */
.mcp-header {
    background: linear-gradient(135deg, var(--mcp-primary), #3b82f6);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.mcp-header-text {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 25px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.mcp-logo-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.mcp-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    object-fit: contain;
    background: white;
    padding: 5px;
}

.mcp-org-name {
    font-size: 22px;
    font-weight: 600;
}

/* Contract Section */
.mcp-contract-section {
    padding: 40px 30px;
    background: var(--mcp-light);
}

.contract-main-title {
    text-align: center;
    font-size: 24px;
    color: var(--mcp-dark);
    margin-bottom: 40px;
    font-weight: bold;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--mcp-primary);
}

.contract-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Contract Articles */
.contract-article {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-right: 4px solid var(--mcp-primary);
}

.article-title {
    font-size: 18px;
    color: var(--mcp-primary);
    margin-bottom: 15px;
    font-weight: bold;
}

.contract-article p {
    line-height: 2;
    margin: 12px 0;
    text-align: justify;
    color: var(--mcp-dark);
}

.contract-article ul.contract-list {
    margin: 15px 0 15px 30px;
    list-style: disc;
}

.contract-article ul.contract-list li {
    margin: 8px 0;
    line-height: 1.8;
}

.party-info {
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin: 10px 0;
}

.and-text {
    text-align: center;
    font-weight: bold;
    font-size: 18px;
    margin: 20px 0;
    color: var(--mcp-primary);
}

.party-two-editable {
    background: #fff;
    padding: 20px;
    border: 2px dashed var(--mcp-primary);
    border-radius: 8px;
    margin: 15px 0;
}

/* Inline Inputs */
.inline-input {
    display: inline-block;
    border: none;
    border-bottom: 2px solid var(--mcp-primary);
    background: rgba(37, 99, 235, 0.05);
    padding: 4px 10px;
    margin: 0 5px;
    min-width: 150px;
    font-size: 15px;
    font-family: inherit;
    color: var(--mcp-dark);
    transition: all 0.3s ease;
    border-radius: 4px 4px 0 0;
}

.inline-input:focus {
    outline: none;
    border-bottom-color: #1d4ed8;
    background: rgba(37, 99, 235, 0.1);
}

.inline-input::placeholder {
    color: #94a3b8;
    font-size: 13px;
}

.inline-input.long-input {
    min-width: 300px;
}

.highlight-date {
    color: var(--mcp-primary);
    font-weight: bold;
    padding: 2px 8px;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 4px;
}

/* Signatures Section */
.signatures-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 3px solid var(--mcp-border);
}

.section-title {
    text-align: center;
    font-size: 20px;
    color: var(--mcp-dark);
    margin-bottom: 30px;
}

.signatures-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.signature-box {
    padding: 25px;
    border: 2px solid var(--mcp-border);
    border-radius: 8px;
    background: white;
}

.signature-box h4 {
    font-size: 16px;
    margin-bottom: 20px;
    color: var(--mcp-primary);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--mcp-border);
}

.signature-box p {
    margin: 12px 0;
    line-height: 1.8;
}

.signature-box.party-one {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-color: var(--mcp-primary);
}

.signature-box.party-two {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: var(--mcp-warning);
}

.stamp-display {
    margin-top: 20px;
}

.official-stamp {
    max-width: 120px;
    height: auto;
    margin-top: 10px;
}

.signature-action,
.stamp-upload-action {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed var(--mcp-border);
}

.signature-preview,
.stamp-preview {
    max-width: 200px;
    height: auto;
    border: 2px solid var(--mcp-border);
    border-radius: 6px;
    padding: 8px;
    background: white;
    display: block;
}

.btn-change-signature,
.btn-change-stamp {
    margin-top: 10px;
    padding: 6px 12px;
    background: var(--mcp-secondary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
}

.btn-change-signature:hover,
.btn-change-stamp:hover {
    background: #475569;
}

/* Form Styles */
.mcp-form {
    padding: 40px 30px;
    background: white;
}

.form-section-title {
    font-size: 20px;
    color: var(--mcp-dark);
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--mcp-primary);
}

.mcp-form-group {
    margin-bottom: 25px;
}

.mcp-form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--mcp-dark);
    font-size: 15px;
}

.mcp-form-group .required {
    color: var(--mcp-danger);
}

.form-help {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--mcp-secondary);
}

.mcp-input {
    width: 100%;
    max-width: 400px;
    padding: 12px 16px;
    border: 2px solid var(--mcp-border);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: white;
    font-family: inherit;
}

.mcp-input:focus {
    outline: none;
    border-color: var(--mcp-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.field-error {
    border-color: var(--mcp-danger) !important;
    background-color: #fef2f2 !important;
}

/* Buttons */
.mcp-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: inherit;
}

.mcp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mcp-btn-primary {
    background: linear-gradient(135deg, var(--mcp-primary), #3b82f6);
    color: white;
}

.mcp-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
}

.mcp-btn-secondary {
    background: var(--mcp-secondary);
    color: white;
}

.mcp-btn-secondary:hover {
    background: #475569;
}

.mcp-btn-success {
    background: var(--mcp-success);
    color: white;
}

.mcp-btn-success:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
}

.mcp-btn-large {
    padding: 16px 40px;
    font-size: 17px;
}

.btn-icon {
    font-size: 20px;
}

.mcp-form-actions {
    text-align: center;
    padding-top: 30px;
}

/* Modal Styles */
.mcp-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
}

.mcp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

.mcp-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;
}

.mcp-modal-content {
    position: relative;
    background: white;
    width: 100%;
    max-width: 600px;
    margin: 20px auto;
    border-radius: var(--mcp-radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideIn 0.3s ease;
}

.mcp-modal-content.mcp-modal-large {
    max-width: 900px;
}

.mcp-modal-header {
    position: sticky;
    top: 0;
    background: white;
    padding: 20px 30px;
    border-bottom: 2px solid var(--mcp-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--mcp-radius) var(--mcp-radius) 0 0;
    z-index: 10;
}

.mcp-modal-header h3 {
    margin: 0;
    color: var(--mcp-dark);
    font-size: 20px;
}

.mcp-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    color: var(--mcp-secondary);
    transition: color 0.3s ease;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.mcp-modal-close:hover {
    color: var(--mcp-danger);
}

.mcp-modal-body {
    padding: 30px;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
}

.mcp-modal-footer {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 20px 30px;
    border-top: 2px solid var(--mcp-border);
    border-radius: 0 0 var(--mcp-radius) var(--mcp-radius);
}

/* Signature Pad */
.signature-instruction {
    text-align: center;
    color: var(--mcp-secondary);
    margin-bottom: 20px;
    font-size: 15px;
}

.instruction-icon {
    font-size: 24px;
    display: block;
    margin-bottom: 10px;
}

.signature-pad-wrapper {
    border: 3px dashed var(--mcp-border);
    border-radius: 8px;
    margin: 20px 0;
    background: white;
    position: relative;
    overflow: hidden;
}

.signature-pad {
    width: 100%;
    height: 250px;
    cursor: crosshair;
    touch-action: none;
}

.signature-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

/* Preview Document */
.mcp-preview-document {
    padding: 30px;
    background: white;
}

.mcp-doc-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--mcp-primary);
}

.mcp-doc-bismillah {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 20px;
    color: var(--mcp-dark);
}

.mcp-doc-logo-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.mcp-doc-logo {
    width: 70px;
    height: 70px;
    border-radius: 50%;
}

.mcp-doc-org {
    font-size: 18px;
    font-weight: 600;
    color: var(--mcp-primary);
}

.mcp-doc-title {
    text-align: center;
    font-size: 20px;
    color: var(--mcp-dark);
    margin: 30px 0;
    font-weight: bold;
}

.mcp-doc-article {
    margin: 25px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.mcp-doc-article h3 {
    font-size: 16px;
    color: var(--mcp-primary);
    margin-bottom: 12px;
}

.mcp-doc-article p {
    line-height: 1.8;
    margin: 10px 0;
    text-align: justify;
}

.mcp-doc-signatures {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 30px;
}

.mcp-doc-signature-box {
    padding: 20px;
    border: 2px solid var(--mcp-border);
    border-radius: 8px;
    background: #f8f9fa;
}

.mcp-doc-signature-box h4 {
    font-size: 15px;
    margin-bottom: 15px;
    color: var(--mcp-primary);
}

.mcp-doc-signature-box p {
    margin: 8px 0;
    font-size: 14px;
}

.signature-img-container,
.stamp-img-container {
    margin-top: 15px;
}

.signature-img {
    max-width: 200px;
    height: auto;
    border: 1px solid var(--mcp-border);
    padding: 5px;
    border-radius: 4px;
    background: white;
}

.stamp-img {
    max-width: 100px;
    height: auto;
}

.mcp-doc-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid var(--mcp-border);
    text-align: center;
}

.approval-stamp,
.pending-stamp {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 16px;
}

.approval-stamp {
    background: var(--mcp-success);
    color: white;
}

.pending-stamp {
    background: var(--mcp-warning);
    color: white;
}

.stamp-icon {
    font-size: 20px;
    margin-left: 8px;
}

/* Confirmation Section */
.confirmation-section {
    margin-bottom: 20px;
}

.confirmation-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid var(--mcp-border);
    transition: all 0.3s ease;
}

.confirmation-checkbox:hover {
    border-color: var(--mcp-primary);
    background: rgba(37, 99, 235, 0.05);
}

.confirmation-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-text {
    font-size: 15px;
    color: var(--mcp-dark);
    font-weight: 500;
}

.action-buttons-footer {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* Success Message */
.mcp-message {
    display: none;
    padding: 30px;
    border-radius: var(--mcp-radius);
    margin: 40px auto;
    max-width: 600px;
    animation: slideIn 0.5s ease;
}

.mcp-success {
    background: linear-gradient(135deg, #10b981, #34d399);
    color: white;
    text-align: center;
}

.message-icon-large {
    font-size: 64px;
    margin-bottom: 20px;
}

.message-content h3 {
    font-size: 24px;
    margin-bottom: 15px;
}

.message-content p {
    font-size: 16px;
    margin: 10px 0;
    line-height: 1.6;
}

.message-note {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 15px;
}

/* Already Signed */
.mcp-already-signed-wrapper {
    padding: 60px 20px;
}

.already-signed-card {
    max-width: 600px;
    margin: 0 auto;
    padding: 40px;
    background: white;
    border-radius: var(--mcp-radius);
    box-shadow: var(--mcp-shadow);
    text-align: center;
}

.success-icon {
    font-size: 80px;
    color: var(--mcp-success);
    margin-bottom: 20px;
}

.success-icon .dashicons {
    width: 80px;
    height: 80px;
    font-size: 80px;
}

.already-signed-card h2 {
    font-size: 24px;
    color: var(--mcp-dark);
    margin-bottom: 20px;
}

.status-message {
    margin: 20px 0;
}

.badge {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 15px;
}

.badge-warning {
    background: var(--mcp-warning);
    color: white;
}

.badge-success {
    background: var(--mcp-success);
    color: white;
}

.contract-info {
    margin: 30px 0;
    padding: 25px;
    background: var(--mcp-light);
    border-radius: 8px;
    text-align: right;
}

.contract-info p {
    margin: 12px 0;
    font-size: 15px;
    line-height: 1.8;
}

.action-section {
    margin-top: 30px;
    padding: 20px;
    background: #e0f2fe;
    border-radius: 8px;
}

.action-section p {
    margin: 0;
    color: var(--mcp-dark);
    line-height: 1.8;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .mcp-container {
        padding: 0 15px;
        margin: 20px auto;
    }
    
    .mcp-header {
        padding: 25px 20px;
    }
    
    .mcp-header-text {
        font-size: 22px;
    }
    
    .mcp-logo {
        width: 60px;
        height: 60px;
    }
    
    .mcp-org-name {
        font-size: 18px;
    }
    
    .mcp-contract-section,
    .mcp-form {
        padding: 25px 20px;
    }
    
    .contract-main-title {
        font-size: 20px;
    }
    
    .contract-content {
        padding: 20px;
    }
    
    .inline-input {
        display: block;
        width: 100%;
        margin: 10px 0;
        min-width: auto;
    }
    
    .inline-input.long-input {
        min-width: auto;
    }
    
    .signatures-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .mcp-modal-container {
        padding: 10px;
    }
    
    .mcp-modal-content {
        margin: 10px auto;
    }
    
    .mcp-modal-body {
        padding: 20px;
    }
    
    .signature-pad {
        height: 200px;
    }
    
    .mcp-doc-signatures {
        grid-template-columns: 1fr;
    }
    
    .action-buttons-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .action-buttons-footer .mcp-btn {
        width: 100%;
    }
}

@media print {
    .mcp-modal-header,
    .mcp-modal-footer,
    .mcp-btn,
    .mcp-modal-close {
        display: none !important;
    }
    
    .mcp-preview-document {
        padding: 20px;
    }
}