/* assets/css/frontend.css */

.cp-popup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.cp-popup.active {
    display: flex;
}

.cp-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: opacity 0.4s ease;
}

.cp-container {
    position: relative;
    background: #FFFFFF;
    padding: 40px 44px 32px;
    border-radius: 20px;
    max-width: 480px;
    width: 100%;
    border-top: 5px solid #2563EB;
    max-height: 92vh;
    overflow-y: auto;
    animation: cpSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-sizing: border-box;
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
@keyframes cpSlideIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(24px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.cp-rounded .cp-container {
    border-radius: 28px;
}
.cp-shadow .cp-container {
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.18), 0 10px 30px rgba(0, 0, 0, 0.06);
}

.cp-close {
    position: absolute;
    top: 14px;
    left: 18px;
    background: #F1F5F9;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #64748B;
    transition: all 0.25s ease;
    padding: 6px 10px;
    border-radius: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cp-close:hover {
    background: #FEE2E2;
    color: #EF4444;
    transform: rotate(90deg);
}
.cp-close:active {
    transform: rotate(90deg) scale(0.92);
}

.cp-header {
    text-align: center;
    margin-bottom: 28px;
}
.cp-icon {
    font-size: 40px;
    margin-bottom: 10px;
    display: block;
}
.cp-header h3 {
    font-size: 24px;
    font-weight: 800;
    color: #0F172A;
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}
.cp-header p {
    font-size: 15px;
    color: #64748B;
    margin: 0;
    line-height: 1.7;
    font-weight: 400;
}

.cp-field {
    margin-bottom: 18px;
}
.cp-field label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #0F172A;
    margin-bottom: 5px;
}
.cp-required {
    color: #EF4444;
}
.cp-field input,
.cp-field textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #E2E8F0;
    border-radius: 14px;
    font-size: 15px;
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.25s ease;
    background: #F8FAFC;
    color: #0F172A;
    box-sizing: border-box;
    font-weight: 450;
}
.cp-field input::placeholder,
.cp-field textarea::placeholder {
    color: #94A3B8;
    font-weight: 350;
}
.cp-field input:hover,
.cp-field textarea:hover {
    background: #FFFFFF;
    border-color: #CBD5E1;
}
.cp-field input:focus,
.cp-field textarea:focus {
    border-color: #2563EB;
    outline: none;
    background: #FFFFFF;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}
.cp-field input.error,
.cp-field textarea.error {
    border-color: #EF4444;
    background: #FEF2F2;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.08);
}
.cp-field input.error:focus,
.cp-field textarea.error:focus {
    border-color: #EF4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}
.cp-field textarea {
    resize: vertical;
    min-height: 100px;
    border-radius: 14px;
}
.cp-error {
    display: none;
    font-size: 13px;
    font-weight: 500;
    color: #EF4444;
    margin-top: 5px;
    padding-right: 4px;
}
.cp-error.show {
    display: block;
    animation: cpFadeError 0.3s ease;
}
@keyframes cpFadeError {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.cp-hint {
    display: block;
    font-size: 12px;
    color: #94A3B8;
    margin-top: 5px;
    font-weight: 400;
}

.cp-submit {
    width: 80%;
    padding: 14px 20px;
    color: #FFFFFF;
    border: none;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 700;
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin: 8px auto 0;
    display: block;
    position: relative;
    letter-spacing: 0.02em;
    min-height: 52px;
}
.cp-submit:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 12px 32px rgba(37, 99, 235, 0.35);
}
.cp-submit:active {
    transform: translateY(0) scale(0.97);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.2);
}
.cp-submit .cp-submit-loader {
    display: none;
}
.cp-submit.loading .cp-submit-text {
    display: none;
}
.cp-submit.loading .cp-submit-loader {
    display: inline-block;
    animation: cpSpin 0.8s linear infinite;
}
@keyframes cpSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
.cp-submit.loading {
    opacity: 0.8;
    pointer-events: none;
    transform: scale(0.98);
}

#cp-response {
    margin-top: 14px;
    font-size: 15px;
    text-align: center;
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 500;
    display: none;
}
#cp-response.success {
    display: block;
    color: #065F46;
    background: #D1FAE5;
    border: 1px solid #6EE7B7;
    animation: cpFadeError 0.4s ease;
}
#cp-response.error {
    display: block;
    color: #991B1B;
    background: #FEE2E2;
    border: 1px solid #FCA5A5;
    animation: cpFadeError 0.4s ease;
}

.cp-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid #E2E8F0;
}
.cp-footer small {
    font-size: 12px;
    color: #94A3B8;
    font-weight: 400;
}

.cp-popup.cp-dark .cp-container {
    background: #1E293B;
}
.cp-popup.cp-dark .cp-header h3 {
    color: #F8FAFC;
}
.cp-popup.cp-dark .cp-header p {
    color: #94A3B8;
}
.cp-popup.cp-dark .cp-field label {
    color: #E2E8F0;
}
.cp-popup.cp-dark .cp-field input,
.cp-popup.cp-dark .cp-field textarea {
    background: #0F172A;
    border-color: #334155;
    color: #F8FAFC;
}
.cp-popup.cp-dark .cp-field input::placeholder,
.cp-popup.cp-dark .cp-field textarea::placeholder {
    color: #64748B;
}
.cp-popup.cp-dark .cp-field input:focus,
.cp-popup.cp-dark .cp-field textarea:focus {
    border-color: #2563EB;
    background: #0F172A;
}
.cp-popup.cp-dark .cp-close {
    background: #334155;
    color: #94A3B8;
}
.cp-popup.cp-dark .cp-close:hover {
    background: #FEE2E2;
    color: #EF4444;
}
.cp-popup.cp-dark .cp-footer {
    border-color: #334155;
}
.cp-popup.cp-dark .cp-footer small {
    color: #64748B;
}
.cp-popup.cp-dark .cp-error {
    color: #F87171;
}

[data-cp-trigger] {
    cursor: pointer;
}

@media (max-width: 768px) {
    .cp-container {
        padding: 32px 28px 24px;
        max-width: 420px;
    }
    .cp-header h3 {
        font-size: 22px;
    }
    .cp-header p {
        font-size: 14px;
    }
    .cp-field input,
    .cp-field textarea {
        font-size: 14px;
        padding: 10px 14px;
    }
    .cp-submit {
        width: 85%;
        font-size: 16px;
        padding: 12px 18px;
        min-height: 48px;
    }
}

@media (max-width: 480px) {
    .cp-container {
        padding: 24px 18px 20px;
        max-width: 100%;
        border-radius: 20px;
        margin: 10px;
    }
    .cp-header h3 {
        font-size: 20px;
    }
    .cp-header p {
        font-size: 13px;
    }
    .cp-icon {
        font-size: 32px;
    }
    .cp-field input,
    .cp-field textarea {
        font-size: 13px;
        padding: 10px 12px;
        border-radius: 12px;
    }
    .cp-field label {
        font-size: 13px;
    }
    .cp-submit {
        width: 100%;
        font-size: 15px;
        padding: 12px 16px;
        border-radius: 12px;
        min-height: 44px;
    }
    .cp-close {
        top: 10px;
        left: 12px;
        width: 32px;
        height: 32px;
        font-size: 18px;
        padding: 4px 8px;
    }
    #cp-response {
        font-size: 13px;
        padding: 8px 12px;
    }
    .cp-footer small {
        font-size: 11px;
    }
}

@media (max-width: 380px) {
    .cp-container {
        padding: 20px 14px 16px;
    }
    .cp-header h3 {
        font-size: 18px;
    }
    .cp-field input,
    .cp-field textarea {
        font-size: 12px;
        padding: 8px 10px;
    }
    .cp-submit {
        font-size: 14px;
        padding: 10px 14px;
        min-height: 40px;
    }
}

.cp-container::-webkit-scrollbar {
    width: 4px;
}
.cp-container::-webkit-scrollbar-track {
    background: #F1F5F9;
    border-radius: 10px;
}
.cp-container::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 10px;
}
.cp-container::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}
.cp-popup.cp-dark .cp-container::-webkit-scrollbar-track {
    background: #1E293B;
}
.cp-popup.cp-dark .cp-container::-webkit-scrollbar-thumb {
    background: #475569;
}