/* ==========================================================================
   MARATHI MARRIAGE BIODATA MAKER - STYLESHEET
   ========================================================================== */

/* Main Container Layout */
.mbm-container {
    display: flex;
    flex-direction: row;
    gap: 30px;
    max-width: 1300px;
    margin: 20px auto;
    font-family: 'Poppins', 'Mukta', sans-serif;
    color: #333;
    background: #fdfdfd;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.05);
}

/* Form Builder Column */
.mbm-form-section {
    flex: 1.2;
    min-width: 0; /* Prevents flex children from breaking parent layout */
    background: #ffffff;
    padding: 25px;
    border-radius: 10px;
    border: 1px solid #eaeaea;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.mbm-plugin-title {
    font-family: 'Poppins', sans-serif;
    color: #800020;
    font-size: 28px;
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 2px dashed #e1c070;
    padding-bottom: 10px;
}

/* Live Preview Column */
.mbm-preview-section {
    flex: 1;
    min-width: 0;
    background: #f7f7f7;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
}

.mbm-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.mbm-preview-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #444;
}

.mbm-preview-badge {
    background: #800020;
    color: #fff;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.mbm-preview-scroll-container {
    width: 100%;
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

/* ==========================================================================
   TABS NAVIGATION
   ========================================================================== */
.mbm-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.mbm-tab-btn {
    flex: 1;
    min-width: 90px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 600;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    color: #555;
    transition: all 0.25s ease;
    text-align: center;
    white-space: nowrap;
}

.mbm-tab-btn:hover {
    background: #eee;
    color: #800020;
}

.mbm-tab-btn.active {
    background: #800020;
    color: #ffffff;
    border-color: #800020;
}

/* Tab Content Visibility */
.mbm-tab-content {
    display: none;
}

.mbm-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.mbm-tab-title {
    font-size: 18px;
    font-weight: 600;
    color: #800020;
    margin-bottom: 20px;
    border-left: 4px solid #D4AF37;
    padding-left: 10px;
}

/* ==========================================================================
   FORM CONTROLS
   ========================================================================== */
.mbm-form-group {
    margin-bottom: 18px;
}

.mbm-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #444;
}

.mbm-form-group label .required {
    color: #ff3b30;
}

.mbm-form-group input[type="text"],
.mbm-form-group select,
.mbm-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.mbm-form-group input[type="text"]:focus,
.mbm-form-group select:focus,
.mbm-form-group textarea:focus {
    border-color: #800020;
    box-shadow: 0 0 0 3px rgba(128, 0, 32, 0.1);
    outline: none;
}

.mbm-form-row {
    display: flex;
    margin-left: -8px;
    margin-right: -8px;
}

.mbm-form-row .mbm-form-group {
    padding-left: 8px;
    padding-right: 8px;
    box-sizing: border-box;
}

.col-12 { width: 100%; }
.col-6 { width: 50%; }
.col-4 { width: 33.33%; }

.mbm-form-section-separator {
    font-size: 14px;
    font-weight: 700;
    color: #800020;
    background: #fff8f8;
    padding: 8px 12px;
    border-radius: 4px;
    border-left: 3px solid #800020;
    margin: 25px 0 15px 0;
    text-transform: uppercase;
}

.mbm-field-desc {
    font-size: 12px;
    color: #777;
    margin-top: 4px;
}

/* ==========================================================================
   PHOTO UPLOAD UI
   ========================================================================== */
.mbm-photo-upload-container {
    position: relative;
    width: 100%;
}

.mbm-photo-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.mbm-photo-upload-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed #bbb;
    background: #fdfdfd;
    padding: 20px;
    border-radius: 8px;
    transition: all 0.2s;
}

.mbm-photo-upload-container:hover .mbm-photo-upload-box {
    border-color: #800020;
    background: #fcf6f6;
}

.mbm-photo-upload-icon {
    font-size: 24px;
    margin-bottom: 5px;
}

.mbm-photo-upload-text {
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

.mbm-btn-danger {
    background: #ff3b30;
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    margin-top: 10px;
    transition: background 0.2s;
}

.mbm-btn-danger:hover {
    background: #d62217;
}

/* ==========================================================================
   CHECKBOX DESIGN
   ========================================================================== */
.mbm-checkbox-container {
    display: block;
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
    line-height: 20px;
}

.mbm-checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: #eee;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.mbm-checkbox-container:hover input ~ .checkmark {
    background-color: #ddd;
}

.mbm-checkbox-container input:checked ~ .checkmark {
    background-color: #800020;
    border-color: #800020;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.mbm-checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.mbm-checkbox-container .checkmark:after {
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ==========================================================================
   THEME SELECTOR GRID
   ========================================================================== */
.mbm-theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.mbm-theme-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    background: #fdfdfd;
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13.5px;
    color: #444;
    transition: all 0.2s;
    text-align: center;
    position: relative;
    box-sizing: border-box;
}

.mbm-theme-option input {
    display: none;
}

.mbm-theme-option:hover {
    background: #f8f9fa;
    border-color: #800020;
    color: #800020;
}

.mbm-theme-option.active {
    background: #fff8f9;
    border: 2px solid #800020; /* Accent border on selection */
    color: #800020;
    box-shadow: 0 3px 8px rgba(128, 0, 32, 0.1);
    padding: 9px 13px; /* Adjusted padding to maintain identical height with 2px border */
}

/* Tick icon badge inside selected button */
.mbm-theme-option.active::before {
    content: '✓';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #800020; /* Accent color */
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    flex-shrink: 0;
}

.theme-title {
    font-size: 13.5px;
    font-weight: 600;
    color: inherit;
    text-align: center;
}

.mbm-theme-option.active .theme-title {
    font-weight: 700;
}

/* ==========================================================================
   FORM FOOTER NAVIGATION & ACTION BUTTONS
   ========================================================================== */
.mbm-form-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.mbm-nav-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.mbm-btn-prev {
    background: #eaeaea;
    color: #444;
}

.mbm-btn-prev:hover {
    background: #d8d8d8;
}

.mbm-btn-next {
    background: #800020;
    color: #fff;
    margin-left: auto;
}

.mbm-btn-next:hover {
    background: #600018;
}

/* Action buttons at the bottom */
.mbm-action-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 25px;
}

@media(min-width: 600px) {
    .mbm-action-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
}

.mbm-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #ffffff;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

.mbm-action-btn .icon {
    font-size: 16px;
}

.btn-preview {
    background: #007aff;
}

.btn-preview:hover {
    background: #0056b3;
}

.btn-pdf {
    background: #28a745;
}

.btn-pdf:hover {
    background: #1e7e34;
}

.btn-wa {
    background: #25d366;
}

.btn-wa:hover {
    background: #1ebd58;
}

/* ==========================================================================
   A4 PRINT PAPER PREVIEW (HTML Simulation)
   ========================================================================== */
.mbm-print-paper {
    width: 210mm;         /* Exact A4 Width */
    height: 297mm;        /* Exact A4 Height */
    background-color: #fff8f2;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
    flex-shrink: 0;
    transition: transform 0.2s;
    transform-origin: top center;
    font-family: 'Poppins', sans-serif;
    font-size: 12px;      /* Default 12px to fit all fields */
    page-break-inside: avoid !important;
    break-inside: avoid !important;
}

/* Inner contents wrapper */
.mbm-print-content {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent text overflow from A4 page */
}

/* Default padding for all themes (1, 2, 3, 5) */
.mbm-print-paper .mbm-print-content {
    padding: 12% 13% 10% 13%; 
}

/* Theme 4 has 5% extra padding on both sides */
.mbm-print-paper.theme-4 .mbm-print-content {
    padding: 12% 18% 10% 18%; 
}

/* Ganesha top header */
.mbm-ganesha-header {
    text-align: center;
    margin-bottom: 12px;
}

.mbm-ganesha-img {
    width: 54px;
    height: auto;
    margin: 0 auto 3px auto;
    display: block;
}

.mbm-ganesha-text {
    font-family: 'Poppins', sans-serif;
    color: #800020;
    font-size: 1.1em;      /* Scale relative to container font size */
    font-weight: 700;
}

/* Sections Headings */
.mbm-section-heading {
    font-family: 'Poppins', sans-serif;
    color: #800020;
    font-size: 1.2em;      /* Scale relative to container font size */
    font-weight: 700;
    text-align: center;
    margin: 8px 0 4px 0;
    position: relative;
    display: block;
    width: 100%;
}

.mbm-section-heading::after {
    content: '';
    display: block;
    width: 40px;
    height: 1px;
    background: #D4AF37;
    margin: 2px auto 0 auto;
}

/* Flex Group Layout (Personal Info + Photo) */
.mbm-personal-grid {
    display: flex;
    flex-direction: row;
    gap: 15px;
    width: 100%;
    align-items: flex-start;
}

.mbm-personal-left {
    flex: 1;
}

.mbm-personal-right {
    width: 100px;
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* Profile Photo Frame */
.mbm-profile-pic-frame {
    width: 90px;
    height: 115px;
    border: 1px solid #555555;
    padding: 2px;
    background: #ffffff;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.1);
}

#p-profile-pic {
    width: 100%;
    height: 100%;
}

/* Row-wise Key Value Flex Items */
.mbm-preview-row {
    display: flex;
    font-size: 1em;       /* Inherit font-size dynamically from container */
    margin-bottom: 4px;
    line-height: 1.25;
    word-break: break-word;
}

.mbm-label {
    width: 100px;
    font-weight: 700;
    flex-shrink: 0;
    color: #111;
}

.mbm-colon {
    width: 15px;
    text-align: center;
    flex-shrink: 0;
    font-weight: 700;
    color: #111;
}

.mbm-value {
    flex-grow: 1;
    color: #111;
}

/* Adjustments for full width details in Family/Contact */
#p-family-section .mbm-label,
#p-contact-section .mbm-label {
    width: 130px; /* Slightly wider labels for longer Marathi fields */
}

/* Hiding empty rows automatically */
.mbm-preview-row.empty-field {
    display: none !important;
}

/* ==========================================================================
   PREVIEW MODAL (FULL SCREEN)
   ========================================================================== */
.mbm-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.85);
    backdrop-filter: blur(5px);
}

.mbm-modal-content {
    position: relative;
    background-color: transparent;
    margin: 40px auto;
    padding: 0;
    width: 90%;
    max-width: 830px;
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.mbm-close-modal {
    position: absolute;
    right: -45px;
    top: -10px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.mbm-close-modal:hover {
    color: #D4AF37;
}

.mbm-modal-body {
    display: flex;
    justify-content: center;
    background: transparent;
    padding: 10px;
    overflow-x: auto;
}

.mbm-modal-footer {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.mbm-modal-action-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.mbm-modal-action-btn:hover {
    background: #218838;
}

/* ==========================================================================
   STATUS & LOADING MODAL
   ========================================================================== */
.mbm-status-modal-content {
    background-color: #ffffff;
    margin: 15% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    animation: zoomIn 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
}

.mbm-status-icon-container {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
}

.mbm-status-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #800020;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.mbm-status-success-icon {
    width: 56px;
    height: 56px;
    background: #28a745;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(40, 167, 69, 0.3);
}

#mbm-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #800020;
    font-family: 'Poppins', sans-serif;
}

#mbm-modal-desc {
    margin: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    font-family: 'Poppins', sans-serif;
}

.mbm-modal-share-btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #ffffff;
    background: #25d366;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
    box-sizing: border-box;
}

.mbm-modal-share-btn:hover {
    background: #1ebd58;
}

.mbm-modal-close-btn {
    margin-top: 10px;
    background: #eaeaea;
    color: #444;
    border: none;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.mbm-modal-close-btn:hover {
    background: #d8d8d8;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   RESPONSIVE DESIGN MEDIA QUERIES
   ========================================================================== */
@media (max-width: 1200px) {
    .mbm-container {
        flex-direction: column;
        padding: 15px;
    }
    
    .mbm-preview-section {
        margin-top: 20px;
    }
}

@media (max-width: 768px) {
    .mbm-form-row {
        flex-direction: column;
        margin-left: 0;
        margin-right: 0;
    }
    
    .mbm-form-row .mbm-form-group {
        width: 100% !important;
        padding-left: 0;
        padding-right: 0;
    }
    
    .mbm-close-modal {
        right: 10px;
        top: -45px;
    }
}

/* Scale preview slightly down if container is too small to avoid horizontal scroll */
@media (max-width: 850px) {
    .mbm-preview-scroll-container {
        justify-content: flex-start;
    }
}

/* Export override to strip shadows/borders and make theme stick perfectly to all 4 sides */
.mbm-print-paper.mbm-exporting {
    box-shadow: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    transform: none !important;
    height: 297mm !important;
    width: 210mm !important;
    overflow: hidden !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
}

/* Gender selector toggle buttons style */
.mbm-gender-toggle {
    display: flex;
    gap: 12px;
    margin-top: 6px;
    margin-bottom: 15px;
}

.mbm-gender-btn {
    flex: 1;
    padding: 10px 14px;
    background: #fdfdfd;
    border: 1px solid #ccc;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: #444;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.mbm-gender-btn input[type="radio"] {
    margin: 0;
    cursor: pointer;
}

.mbm-gender-btn:hover {
    background: #f1f1f1;
    border-color: #800020;
}

.mbm-gender-btn.active {
    background: #800020;
    color: #ffffff;
    border-color: #800020;
    box-shadow: 0 3px 8px rgba(128, 0, 32, 0.2);
}
