/**
 * Client Management - Frontend Form Styles
 * Version: 1.0.0
 * 
 * पूरी तरह से आइसोलेटेड CSS - केवल क्लाइंट फॉर्म पर लागू
 */

/* ===== बेस वेरिएबल्स ===== */
.cm-form-scope {
    --cm-primary: #1e3b5a;
    --cm-primary-dark: #143750;
    --cm-primary-light: #2b6c9e;
    --cm-secondary: #3b82f6;
    --cm-success: #1e9b75;
    --cm-warning: #d45a1a;
    --cm-error: #c72a1b;
    --cm-text-dark: #1a2e4d;
    --cm-text-light: #476788;
    --cm-text-muted: #616e7c;
    --cm-border: #e2eaf2;
    --cm-bg-gradient: linear-gradient(145deg, #f6f9fc 0%, #edf2f9 100%);
    --cm-card-bg: rgba(255, 255, 255, 0.85);
    --cm-shadow: 0 25px 50px -12px rgba(0, 20, 40, 0.35);
    --cm-shadow-small: 0 8px 14px -6px rgba(0, 32, 64, 0.08);
    --cm-radius: 2.5rem;
    --cm-radius-small: 2rem;
    --cm-radius-circle: 3rem;
    --cm-transition: all 0.2s ease;
}

/* ===== रीसेट और स्कोपिंग ===== */
.cm-form-scope,
.cm-form-scope *,
.cm-form-scope *::before,
.cm-form-scope *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.cm-form-scope {
    display: block;
    width: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== मुख्य कंटेनर ===== */
.cm-form-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1.5rem;
    background: var(--cm-bg-gradient);
}

.cm-form-card {
    max-width: 1100px;
    width: 100%;
    background: var(--cm-card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--cm-radius);
    box-shadow: var(--cm-shadow);
    padding: 2.5rem 2.2rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: var(--cm-transition);
}

/* ===== हेडर ===== */
.cm-form-header {
    margin-bottom: 2.5rem;
}

.cm-form-header h2 {
    font-size: 2.4rem;
    font-weight: 600;
    background: linear-gradient(135deg, #1a2e4d, #1e3b5a);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cm-form-header h2 i {
    background: #ffffffcc;
    padding: 0.7rem;
    border-radius: 50%;
    color: var(--cm-primary);
    font-size: 1.8rem;
}

.cm-form-subtitle {
    color: var(--cm-text-light);
    font-size: 1rem;
    padding-left: 1rem;
    border-left: 4px solid var(--cm-secondary);
}

/* ===== ग्रिड लेआउट ===== */
.cm-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.8rem 2rem;
}

@media (min-width: 640px) {
    .cm-form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.cm-grid-full {
    grid-column: 1 / -1;
}

/* ===== फील्ड ग्रुप ===== */
.cm-field-group {
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--cm-radius-small);
    padding: 1.5rem 1.3rem;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--cm-shadow-small);
}

.cm-group-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #153e5c;
    margin-bottom: 1.5rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px dashed #bdd3eb;
}

.cm-group-title i {
    color: var(--cm-primary-light);
    font-size: 1.3rem;
    width: 2rem;
}

/* ===== इनपुट फील्ड्स ===== */
.cm-field-wrapper {
    margin-bottom: 1.2rem;
}

.cm-field-label {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--cm-primary);
    margin-bottom: 0.3rem;
}

.cm-label-en {
    color: #0c2b40;
    font-weight: 600;
}

.cm-label-hi {
    font-size: 0.9rem;
    color: var(--cm-text-muted);
    font-weight: 400;
}

.cm-optional-badge {
    font-size: 0.7rem;
    background: #cbddee;
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
    color: #2e4b6e;
    margin-left: 0.5rem;
}

.cm-input,
.cm-select {
    width: 100%;
    padding: 0.85rem 1.2rem;
    background: white;
    border: 2px solid transparent;
    border-radius: 1.8rem;
    font-size: 1rem;
    outline: none;
    transition: var(--cm-transition);
    box-shadow: 0 2px 6px rgba(0, 30, 60, 0.05);
    border-color: var(--cm-border);
    font-family: inherit;
}

.cm-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.2rem center;
    background-size: 1.2rem;
    padding-right: 2.5rem;
}

.cm-input:focus,
.cm-select:focus {
    border-color: var(--cm-secondary);
    box-shadow: 0 6px 14px rgba(30, 100, 200, 0.15);
}

.cm-input.error,
.cm-select.error {
    border-color: var(--cm-error);
    background-color: #fff0f0;
}

/* ===== रो डुओ ===== */
.cm-row-duo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

@media (max-width: 480px) {
    .cm-row-duo {
        grid-template-columns: 1fr;
    }
}

/* ===== अपलोड एरिया ===== */
.cm-upload-area {
    background: #f3f9ff;
    border: 2px dashed #9bc0e6;
    border-radius: var(--cm-radius-small);
    padding: 0.8rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    transition: var(--cm-transition);
}

.cm-upload-area:hover {
    background: #e3f0fd;
    border-color: var(--cm-secondary);
}

.cm-upload-area.has-file {
    background: #e8f5e9;
    border-color: var(--cm-success);
}

.cm-upload-area i {
    font-size: 1.8rem;
    color: var(--cm-primary-light);
}

.cm-file-input {
    display: none;
}

/* ===== कैप्चा ===== */
.cm-captcha-box {
    background: #f4f7fb;
    border-radius: var(--cm-radius-small);
    padding: 0.75rem 1.2rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.cm-captcha-math {
    background: var(--cm-primary);
    color: white;
    padding: 0.55rem 1.2rem;
    border-radius: var(--cm-radius-circle);
    font-weight: 700;
    font-size: 1.3rem;
    min-width: 100px;
    text-align: center;
}

.cm-captcha-input {
    flex: 2;
    min-width: 140px;
    padding: 0.7rem 1rem;
    border: 1px solid #cbddee;
    border-radius: var(--cm-radius-circle);
    font-size: 1rem;
    outline: none;
}

.cm-captcha-input:focus {
    border-color: var(--cm-secondary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===== बटन्स ===== */
.cm-form-actions {
    margin-top: 2.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    justify-content: space-between;
    align-items: center;
}

.cm-btn-submit {
    background: linear-gradient(115deg, var(--cm-primary), #143750);
    border: none;
    padding: 1rem 2.8rem;
    border-radius: var(--cm-radius-circle);
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    transition: var(--cm-transition);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.cm-btn-submit:hover {
    background: linear-gradient(115deg, #15324b, #0f2b40);
    transform: scale(1.01);
}

.cm-btn-reset {
    background: transparent;
    border: 2px solid #a0c1da;
    padding: 0.8rem 2rem;
    border-radius: var(--cm-radius-circle);
    font-weight: 500;
    color: #1f4b73;
    cursor: pointer;
    transition: var(--cm-transition);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
}

.cm-btn-reset:hover {
    background: rgba(255, 255, 255, 0.7);
    border-color: #5982aa;
}

/* ===== फीडबैक ===== */
.cm-feedback {
    margin-top: 1.5rem;
    padding: 0.8rem 2rem;
    border-radius: var(--cm-radius-circle);
    font-weight: 500;
    display: none;
    animation: cmFadeIn 0.3s ease;
}

.cm-feedback.success {
    background: #e7f3e8;
    color: #0a3b2e;
    border-left: 8px solid var(--cm-success);
}

.cm-feedback.error {
    background: #ffe4e0;
    color: #8b2c1b;
    border-left: 8px solid var(--cm-error);
}

.cm-feedback.warning {
    background: #fff0e0;
    color: #9c4a1c;
    border-left: 8px solid var(--cm-warning);
}

.cm-feedback i {
    margin-right: 8px;
}

/* ===== एनिमेशन ===== */
@keyframes cmFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cmSpin {
    to { transform: rotate(360deg); }
}

/* ===== लोडिंग स्टेट ===== */
.cm-btn-submit.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.cm-btn-submit.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: cmSpin 0.6s linear infinite;
}

/* ===== रिस्पॉन्सिव ===== */
@media (max-width: 768px) {
    .cm-form-card {
        padding: 1.8rem 1.5rem;
    }
    
    .cm-form-header h2 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .cm-form-container {
        padding: 0.8rem;
    }
    
    .cm-form-card {
        padding: 1.5rem 1.2rem;
        border-radius: 2rem;
    }
    
    .cm-form-header h2 {
        font-size: 1.6rem;
        flex-wrap: wrap;
    }
    
    .cm-form-actions {
        flex-direction: column;
    }
    
    .cm-btn-submit,
    .cm-btn-reset {
        width: 100%;
        justify-content: center;
    }
    
    .cm-captcha-box {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ===== प्रिंट ===== */
@media print {
    .cm-form-container {
        background: none;
        padding: 0;
        min-height: auto;
    }
    
    .cm-form-card {
        box-shadow: none;
        border: 1px solid #ddd;
        background: white;
    }
    
    .cm-form-actions,
    .cm-upload-area {
        display: none;
    }
}