/* =========================================
   BASE STYLES & RESET
   ========================================= */
* { box-sizing: border-box; } 

html, body { 
    margin: 0; 
    padding: 0; /* Reset default padding */
    width: 100%;
    max-width: 100vw; 
    overflow-x: hidden; 
    background: #eef2f6; 
}

/* Apply default font to body and add spacing for the fixed navbar */
body { 
    font-family: 'Poppins', Arial, sans-serif; 
    padding-top: 85px; /* Fixed: Pushes content down below the navbar! */
}

/* Force all elements inside the card to inherit the live font change, EXCEPT icons */
.card-preview *:not(i) { font-family: inherit; }

/* =========================================
   NAVBAR
   ========================================= */
.navbar { background: #0d47a1; padding: 12px 20px; display: flex; align-items: center; justify-content: center; position: fixed; top: 0; left: 0; width: 100%; z-index: 9999; color: white; box-sizing: border-box; }
.nav-title { margin: 0; font-size: 26px; font-weight: 700; text-align: center; }
.profile-btn { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); padding: 10px 20px; border-radius: 10px; background: linear-gradient(135deg, #2a7bff, #1b5ddb); border: 1px solid rgba(255,255,255,0.2); color: white; text-decoration: none; font-size: 13px; line-height: 1.3; box-shadow: 0 4px 12px rgba(0,0,0,0.15); transition: 0.2s; }
.profile-btn strong { font-size: 15px; }
.profile-btn:hover { background: linear-gradient(135deg, #1b5ddb, #0d47a1); }

@media (max-width: 900px) {
    .navbar { flex-direction: column; padding-bottom: 20px; height: auto; position: static; }
    .nav-title { margin-bottom: 12px; }
    .profile-btn { position: static; transform: none; display: inline-block; }
    body { padding-top: 0; }
}

/* =========================================
   PAGE LAYOUT
   ========================================= */
.page-wrapper { padding: 20px; width: 100%; max-width: 100vw; box-sizing: border-box; overflow-x: hidden; }
.container { max-width: 1200px; width: 100%; margin: auto; display: grid; grid-template-columns: 1fr 1.3fr; gap: 25px; align-items: start; }

@media (max-width: 900px) { 
    .container { grid-template-columns: 1fr; } 
}

/* =========================================
   FORMS & INPUTS
   ========================================= */
.form-section, .preview-section { 
    background: #fff; 
    padding: 25px; 
    border-radius: 12px; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.08); 
    width: 100%; 
    max-width: 100%; 
    box-sizing: border-box; 
}

.preview-section { overflow: hidden; }
.section-title { margin-top: 0; font-size: 20px; margin-bottom: 20px; color: #333;}
.form-divider { border: 0; height: 1px; background: #ddd; margin: 25px 0 10px 0; }

label { font-weight: 600; margin-top: 10px; display: block; font-size: 14px; color: #444;}
input[type="text"], input[type="email"], input[type="url"], textarea, select { width: 100%; padding: 10px; border-radius: 6px; border: 1px solid #ccc; margin-bottom: 10px; font-size: 14px; transition: 0.3s; box-sizing: border-box;}
input:focus, textarea:focus, select:focus { outline: none; border-color: #0d47a1; }
input[type="color"] { width: 100%; height: 40px; border: none; border-radius: 6px; cursor: pointer; padding: 0; margin-bottom: 10px;}
input[type="range"] { width: 100%; margin: 15px 0; cursor: pointer;}
input[type="file"] { margin-bottom: 10px; padding: 5px; width: 100%; box-sizing: border-box;}

.row-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

/* =========================================
   CONTENT CHECKLIST STYLES
   ========================================= */
.content-toggle-section { margin-top: 15px; padding: 15px; background: #f9f9f9; border-radius: 8px; border: 1px solid #eee; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.checkbox-group label { display: flex; align-items: center; gap: 5px; font-weight: 500; font-size: 13px; margin: 0; cursor: pointer; color: #444; }
.checkbox-group input[type="checkbox"] { width: auto; margin: 0; cursor: pointer; transform: scale(1.1); }

/* =========================================
   CUSTOM RADIO BUTTONS
   ========================================= */
.radio-group { display: flex; gap: 10px; margin-top: 5px; margin-bottom: 15px; }
.radio-group input { display: none; }
.radio-group label { flex: 1; padding: 12px 5px; border: 2px solid #ddd; text-align: center; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; transition: 0.2s; margin-top: 0; background: #fafafa; }
.radio-group label i { font-size: 18px; display: block; margin-bottom: 5px; color: #666; transition: 0.2s;}
.radio-group label small { font-size: 11px; font-weight: normal; color: #888; }
.radio-group input:checked + label { border-color: #0d47a1; background: #f0f5ff; color: #0d47a1; }
.radio-group input:checked + label i { color: #0d47a1; }

/* =========================================
   BUTTON ROW
   ========================================= */
.button-row { display: flex; gap: 10px; margin-top: 15px; }
.button-row button { flex: 1; padding: 12px; border-radius: 6px; border: none; background: #0d47a1; color: white; cursor: pointer; font-weight: 600; transition: 0.2s; }
.button-row button:hover { background: #002171; }
.button-row #resetBtn { background: #e0e0e0; color: #333; flex: 0.5; }
.button-row #resetBtn:hover { background: #bdbdbd; }

/* =========================================
   LIVE PREVIEW CONTAINER
   ========================================= */
.preview-holder { 
    display: flex; 
    width: 100%;
    max-width: 100%;
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; 
    padding: 20px; 
    min-height: 270px; 
    background: #f9f9f9; 
    border-radius: 8px; 
    border: 1px dashed #ccc;
    box-sizing: border-box;
}

/* =========================================
   BASE CARD STYLES
   ========================================= */
.card-preview {
    margin: auto; 
    flex-shrink: 0; 
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    overflow: hidden;
    display: flex;
    position: relative;
    box-sizing: border-box;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background 0.3s, color 0.3s, width 0.3s, height 0.3s;
    font-style: var(--f-style, normal); /* Allows italics */
}

.corner-tl, .corner-br { position: absolute; z-index: 1; opacity: 0.85; mix-blend-mode: multiply; width: 0; height: 0; background: transparent; }
.corner-tl { top: 0; left: 0; border-top: 140px solid transparent; border-right: 140px solid transparent; }
.corner-br { bottom: 0; right: 0; border-bottom: 140px solid transparent; border-left: 140px solid transparent; }

.card-left { flex: 1; z-index: 2; position: relative; }
.card-right { background: white; padding: 6px; border-radius: 8px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 2; position: relative; }
.card-right canvas { width: 100% !important; height: 100% !important; }

/* Typography styles using CSS variables for live Bold & Scaling toggling */
.card-company { font-size: calc(12px * var(--f-scale, 1)); font-weight: var(--f-weight-bold, 700); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; opacity: 0.8;}
.card-name { font-size: calc(24px * var(--f-scale, 1)); font-weight: var(--f-weight-bold, 700); line-height: 1.1; }
.card-title { font-size: calc(13px * var(--f-scale, 1)); font-weight: var(--f-weight-med, 500); margin-top: 4px; opacity: 0.85;}
.card-divider { width: 40px; height: 3px; background: currentColor; margin: 15px 0; border-radius: 2px;}
.card-details { font-size: calc(11px * var(--f-scale, 1)); line-height: 1.6; font-weight: var(--f-weight-med, 500);}
.card-details i { width: 16px; text-align: center; margin-right: 6px; opacity: 0.8;}

/* =========================================
   WATERMARK / LOGO STYLES
   ========================================= */
.watermark-img {
    position: absolute;
    z-index: 1; /* Sits behind text, above background */
    pointer-events: none; /* Prevents it from interfering with user clicks */
    object-fit: cover; /* Ensures circles/squares don't squash the image */
}
/* Positions */
.wm-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.wm-top-left { top: 20px; left: 20px; }
.wm-top-right { top: 20px; right: 20px; }
.wm-bottom-left { bottom: 20px; left: 20px; }
.wm-bottom-right { bottom: 20px; right: 20px; }
/* Shapes */
.wm-original { border-radius: 0; }
.wm-circle { border-radius: 50%; }
.wm-square { border-radius: 12px; }

/* =========================================
   CARD FORMATS
   ========================================= */
.card-horizontal { width: 450px; height: 250px; flex-direction: row; align-items: center; justify-content: space-between; padding: 25px; }
.card-horizontal .card-left { text-align: left; padding-right: 15px; }
.card-horizontal .card-right { width: 110px; height: 110px; }

.card-vertical { width: 250px; height: 450px; flex-direction: column; align-items: center; justify-content: center; padding: 30px 20px; text-align: center; }
.card-vertical .card-left { text-align: center; padding-right: 0; margin-bottom: 20px; }
.card-vertical .card-divider { margin: 15px auto; }
.card-vertical .card-right { width: 130px; height: 130px; }
.card-vertical .corner-tl { border-top-width: 100px; border-right-width: 100px; }
.card-vertical .corner-br { border-bottom-width: 100px; border-left-width: 100px; }

.card-square { width: 320px; height: 320px; flex-direction: column; align-items: center; justify-content: space-between; padding: 25px; text-align: center; }
.card-square .card-left { text-align: center; padding-right: 0; }
.card-square .card-divider { margin: 10px auto; }
.card-square .card-right { width: 100px; height: 100px; }
.card-square .card-company { margin-bottom: 5px; }

/* =========================================
   PRESET TEXTURES
   ========================================= */
.bg-kraft { background-image: url('https://www.transparenttextures.com/patterns/cardboard-flat.png'), linear-gradient(#e0c49c, #e0c49c) !important; }
.bg-linen { background-image: url('https://www.transparenttextures.com/patterns/linen.png'), linear-gradient(#f3efe4, #f3efe4) !important; }
.bg-carbon { background-image: repeating-linear-gradient(45deg,#333 0,#333 2px,#222 2px,#222 4px) !important; }
.bg-mesh { background-image: radial-gradient(circle, #333 1px, transparent 1px), linear-gradient(#111, #111) !important; background-size: 10px 10px !important;}

/* =========================================
   SMARTPHONE RESPONSIVE BREAKPOINTS
   ========================================= */
@media (max-width: 600px) {
    .page-wrapper { padding: 10px; width: 100%; overflow-x: hidden; }
    .form-section, .preview-section { padding: 15px; width: 100%; overflow: hidden; }
    
    .row-inputs { grid-template-columns: 1fr; gap: 5px; }
    .radio-group { flex-direction: column; }
    .button-row { flex-direction: column; }
    .button-row button { width: 100%; padding: 15px;}
    
    .preview-holder {
        justify-content: flex-start; 
        box-shadow: inset -15px 0 15px -15px rgba(0,0,0,0.15);
    }

    .card-preview { margin: 0; }
}