/* CSS Variables for theming */
:root {
    --gold: #b1872d;
    --gold-light: #c9a456;
    --navy: #222944;
    --navy-light: #2d3658;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    padding: 30px 0;
    border-bottom: 3px solid var(--gold);
    margin-bottom: 30px;
}

.logo-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo-header svg {
    flex-shrink: 0;
}

h1 {
    font-size: 28px;
    color: var(--navy);
    font-weight: 600;
}

.subtitle {
    color: var(--gray-500);
    font-size: 16px;
}

/* Main Layout */
main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 900px) {
    main {
        grid-template-columns: 1fr;
    }
}

/* Section Styling */
.form-section,
.preview-section {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.preview-section {
    position: sticky;
    top: 20px;
    align-self: start;
}

h2 {
    font-size: 18px;
    color: var(--navy);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gray-200);
}

/* Photo Upload */
.photo-upload-section {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    padding: 20px;
    background: var(--gray-50);
    border-radius: 8px;
}

.photo-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 3px solid var(--white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-placeholder {
    font-size: 32px;
    color: var(--gray-400);
}

.photo-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upload-btn {
    display: inline-block;
    padding: 8px 16px;
    background: var(--navy);
    color: var(--white);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.upload-btn:hover {
    background: var(--navy-light);
}

.remove-btn {
    padding: 6px 12px;
    background: transparent;
    color: var(--gray-500);
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.remove-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.photo-hint {
    font-size: 12px;
    color: var(--gray-400);
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
}

.form-group .optional {
    font-weight: 400;
    color: var(--gray-400);
}

.form-group input {
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(177, 135, 45, 0.1);
}

.form-group input::placeholder {
    color: var(--gray-400);
}

/* Social Media Collapsible Section */
.social-section {
    margin-bottom: 25px;
}

.social-section summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    list-style: none;
    user-select: none;
    transition: background 0.2s;
}

.social-section summary::-webkit-details-marker {
    display: none;
}

.social-section summary::after {
    content: '+';
    margin-left: auto;
    font-size: 20px;
    font-weight: 300;
    color: var(--gray-400);
    line-height: 1;
}

.social-section[open] summary::after {
    content: '−';
}

.social-section summary:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.social-section .social-grid {
    margin-top: 15px;
    margin-bottom: 0;
}

/* Style Options */
.style-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-group > label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
}

.color-schemes,
.logo-styles,
.layout-styles,
.photo-shape-options,
.font-styles,
.border-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.color-scheme,
.logo-style,
.layout-style,
.photo-shape,
.font-style,
.border-toggle {
    padding: 10px 15px;
    border: 2px solid var(--gray-200);
    background: var(--white);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.color-scheme:hover,
.logo-style:hover,
.layout-style:hover,
.photo-shape:hover,
.font-style:hover,
.border-toggle:hover {
    border-color: var(--gray-300);
}

.color-scheme.active,
.logo-style.active,
.layout-style.active,
.photo-shape.active,
.font-style.active,
.border-toggle.active {
    border-color: var(--gold);
    background: rgba(177, 135, 45, 0.05);
}

.scheme-preview {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.scheme-preview.classic {
    background: linear-gradient(135deg, var(--navy) 50%, var(--gold) 50%);
}

.scheme-preview.navy {
    background: var(--navy);
}

.scheme-preview.gold {
    background: var(--gold);
}

.scheme-preview.minimal {
    background: var(--gray-600);
}

/* Preview Section */
.preview-container {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    min-height: 200px;
}

.signature-preview {
    font-family: Arial, Helvetica, sans-serif;
}

/* Copy status (above cards) */
.copy-status {
    font-size: 13px;
    color: var(--gray-500);
    min-height: 18px;
    margin-bottom: 12px;
    text-align: center;
}

.copy-status.success {
    color: #059669;
}

.copy-status.error {
    color: #dc2626;
}

/* Client instruction cards */
.client-cards {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.client-card {
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
}

.client-card-header {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: white;
}

.gmail-header   { background: var(--navy); }
.outlook-header { background: var(--gold); }

.client-card-body {
    padding: 16px;
    background: var(--gray-50);
}

/* Full-width action buttons inside cards */
.client-card-body .copy-btn,
.client-card-body .download-btn {
    width: 100%;
    justify-content: center;
    margin-bottom: 14px;
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--gold);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-btn:hover  { background: var(--gold-light); transform: translateY(-1px); }
.copy-btn:active { transform: translateY(0); }

.client-steps {
    padding-left: 20px;
    margin: 0;
}

.client-steps li {
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 7px;
    line-height: 1.5;
}

.client-steps li:last-child { margin-bottom: 0; }

kbd {
    display: inline-block;
    padding: 1px 6px;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
    color: var(--gray-700);
    box-shadow: 0 1px 0 var(--gray-300);
}

.step-or {
    font-size: 11px;
    color: var(--gray-400);
    font-style: italic;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px;
    color: var(--gray-400);
    font-size: 13px;
}

/* Signature Styles - these will be inlined in the actual signature */
.sig-table {
    border-collapse: collapse;
    font-family: Arial, Helvetica, sans-serif;
}

.sig-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.sig-divider {
    width: 2px;
    background-color: var(--gold);
}

.sig-name {
    font-size: 18px;
    font-weight: bold;
    color: var(--navy);
    margin: 0;
}

.sig-title {
    font-size: 14px;
    color: var(--gold);
    margin: 2px 0 8px 0;
}

.sig-info {
    font-size: 13px;
    color: var(--gray-600);
    margin: 3px 0;
}

.sig-link {
    color: var(--gold);
    text-decoration: none;
}

.sig-cta {
    display: inline-block;
    padding: 8px 16px;
    background-color: var(--gold);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    margin-top: 5px;
    margin-right: 8px;
}

/* Crop Modal */
.crop-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.crop-modal {
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 300px;
    max-width: 100%;
}

.crop-title {
    font-size: 16px;
    color: var(--navy);
    margin-bottom: 4px;
}

.crop-hint {
    font-size: 12px;
    color: var(--gray-400);
    margin-bottom: 16px;
}

.crop-area {
    position: relative;
    width: 240px;
    height: 240px;
    overflow: hidden;
    margin: 0 auto 16px;
    background: #111;
    border-radius: 4px;
    cursor: grab;
}

.crop-area:active {
    cursor: grabbing;
}

.crop-image {
    position: absolute;
    user-select: none;
    -webkit-user-drag: none;
}

.crop-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at center, transparent 100px, rgba(0, 0, 0, 0.6) 101px);
}

.crop-zoom {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--gray-600);
}

.crop-zoom input[type="range"] {
    flex: 1;
    accent-color: var(--gold);
}

.crop-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.crop-actions .upload-btn {
    background: var(--gold);
}

.crop-actions .upload-btn:hover {
    background: var(--gold-light);
}

/* Designation / Office search UI */
.designation-input-wrap, .office-input-wrap {
    position: relative;
}

.designation-dropdown, .office-dropdown {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    list-style: none;
    margin: 4px 0 0;
    padding: 4px 0;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.designation-dropdown.open, .office-dropdown.open {
    display: block;
}

.designation-dropdown li, .office-dropdown li {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
}

.designation-dropdown li:hover, .office-dropdown li:hover {
    background: rgba(177, 135, 45, 0.08);
}

.office-dropdown li { display: flex; flex-direction: column; gap: 2px; }
.office-dropdown li strong { font-size: 13px; }
.office-addr { font-size: 11px; color: var(--gray-500); }

.office-selected-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 12px;
    background: rgba(34, 41, 68, 0.06);
    border: 1px solid var(--navy);
    border-radius: 8px;
    font-size: 13px;
    color: var(--navy);
}
.office-selected-badge span { flex: 1; font-weight: 600; }
.office-selected-badge button {
    background: none; border: none; cursor: pointer;
    color: var(--gray-400); font-size: 16px; line-height: 1; padding: 0;
}
.office-selected-badge button:hover { color: var(--navy); }

.designation-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.designation-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(177, 135, 45, 0.1);
    border: 1px solid var(--gold);
    color: var(--navy);
    border-radius: 20px;
    padding: 3px 8px 3px 12px;
    font-size: 12px;
    font-weight: 600;
}

.designation-pill button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    font-size: 15px;
    line-height: 1;
    padding: 0;
}

.designation-pill button:hover {
    color: var(--navy);
}

/* Step nav */
.form-steps { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.step-btn { background: none; border: none; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--gray-400); padding: 6px 14px; border-radius: 20px; transition: all 0.2s; }
.step-btn.active { color: var(--navy); background: rgba(34,41,68,0.08); }
.step-sep { color: var(--gray-300); }

/* Page nav */
.page-nav { display: flex; margin-top: 20px; }
.page-nav-top { margin-top: 0; margin-bottom: 16px; }
.next-btn { margin-left: auto; background: var(--navy); color: white; border: none; border-radius: 8px; padding: 10px 20px; font-size: 14px; font-weight: 600; cursor: pointer; transition: opacity 0.2s; }
.next-btn:hover { opacity: 0.85; }
.back-btn { background: none; border: 1px solid var(--gray-200); border-radius: 8px; padding: 8px 16px; font-size: 13px; color: var(--gray-600); cursor: pointer; transition: all 0.2s; }
.back-btn:hover { border-color: var(--navy); color: var(--navy); }

/* Photo shape group */
.photo-shape-group { margin-top: 16px; margin-bottom: 4px; }

/* Crop overlay shape variants */
/* circle: keep full-area overlay, use radial-gradient to cut out the guide circle */
.crop-overlay.shape-circle  { inset: 0; width: auto; height: auto; border-radius: 0; background: radial-gradient(circle at center, transparent 100px, rgba(0,0,0,0.6) 101px); }
/* square/portrait: position a small transparent box, use box-shadow for the dark surround */
/* right/bottom must be auto to override inset:0 from the base rule */
.crop-overlay.shape-square  { top: 20px; right: auto; bottom: auto; left: 20px; width: 200px; height: 200px; border-radius: 8px; background: transparent; box-shadow: 0 0 0 9999px rgba(0,0,0,0.6); }
.crop-overlay.shape-portrait { top: 20px; right: auto; bottom: auto; left: 40px; width: 160px; height: 200px; border-radius: 8px; background: transparent; box-shadow: 0 0 0 9999px rgba(0,0,0,0.6); }

/* Download for Outlook button */
.download-btn { display: flex; align-items: center; justify-content: center; padding: 12px 20px; background: transparent; color: var(--gold); border: 2px solid var(--gold); border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.download-btn:hover { background: var(--gold); color: white; }

/* Font preview spans */
.font-preview-sans  { font-family: Arial, Helvetica, sans-serif; margin-left: 4px; opacity: 0.7; }
.font-preview-serif { font-family: Georgia, "Times New Roman", serif; margin-left: 4px; opacity: 0.7; }
