:root {
    --primary-color: #0f172a;
    --primary-dark: #0c1322;
    --primary-light: #f1f5f9;
    --accent-color: #e94560;
    --secondary-color: #64748b;
    --success-color: #16a34a;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.container { max-width: 900px; margin: 0 auto; padding: 40px 20px; }

/* Header */
header { text-align: center; margin-bottom: 40px; }

header h2 { font-size: 1.4rem; color: var(--text-primary); font-weight: 600; margin-bottom: 8px; }
.subtitle { color: var(--text-secondary); font-size: 0.95rem; }

/* Country selector banner */
.country-banner {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin-bottom: 28px;
    color: white;
    box-shadow: var(--shadow-lg);
}
.country-banner h3 { font-size: 1.1rem; margin-bottom: 14px; opacity: 0.9; }
.country-buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.country-btn {
    flex: 1; min-width: 100px;
    padding: 14px 12px;
    border-radius: var(--radius-md);
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}
.country-btn:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.6); }
.country-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    box-shadow: 0 4px 12px rgba(233,69,96,0.35);
    transform: translateY(-2px);
}
.country-btn .flag { font-size: 1.3rem; display: block; margin-bottom: 4px; }

/* Fee badge */
.fee-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--primary-light);
    border: 1px solid var(--primary-color);
    color: #1e40af;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 20px;
}
.fee-badge strong { color: var(--primary-color); font-size: 1rem; }

/* Form Sections */
.form-section {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: box-shadow 0.3s ease;
}
.form-section:hover { box-shadow: var(--shadow-lg); }
.form-section h3 {
    font-size: 1.15rem; color: var(--text-primary);
    margin-bottom: 20px;
    display: flex; align-items: center; gap: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-light);
}
.section-number {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white; border-radius: 50%;
    font-size: 0.85rem; font-weight: 700; flex-shrink: 0;
}
.section-description { color: var(--text-secondary); font-size: 0.88rem; margin-bottom: 16px; margin-top: -8px; }

/* Form Grid */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.form-group { display: flex; flex-direction: column; }
.form-group.full-width { grid-column: 1 / -1; }

/* Labels & Inputs */
label { font-size: 0.875rem; font-weight: 500; color: var(--text-primary); margin-bottom: 6px; }
.required { color: var(--error-color); font-weight: 600; }
.optional { color: var(--text-secondary); font-weight: 400; font-size: 0.8rem; }
.field-hint { display: block; margin-top: 4px; font-size: 0.75rem; color: var(--text-secondary); font-style: italic; }

input[type="text"], input[type="email"], input[type="tel"],
input[type="date"], input[type="number"], textarea, select {
    padding: 12px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem; font-family: inherit;
    transition: all 0.2s ease;
    background: white; color: var(--text-primary);
}
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.12);
}
input::placeholder, textarea::placeholder { color: #94a3b8; }
input:invalid:not(:placeholder-shown), textarea:invalid:not(:placeholder-shown) { border-color: var(--error-color); }
textarea { resize: vertical; min-height: 80px; }
select {
    cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; background-size: 20px; padding-right: 40px;
}

/* ID Upload */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fafafa;
    position: relative;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--primary-color);
    background: var(--primary-light);
}
.upload-zone input[type="file"] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
    border: none; padding: 0;
}
.upload-icon { font-size: 2.2rem; margin-bottom: 8px; }
.upload-label { font-size: 0.95rem; color: var(--text-primary); font-weight: 500; margin-bottom: 4px; }
.upload-hint { font-size: 0.8rem; color: var(--text-secondary); }
.upload-preview {
    display: none; margin-top: 12px;
    padding: 10px 14px;
    background: #d1fae5; border: 1px solid #10b981;
    border-radius: var(--radius-sm);
    font-size: 0.875rem; color: #065f46;
    align-items: center; gap: 8px;
}
.upload-preview.show { display: flex; }

/* Revenue split calculator */
.split-display {
    background: var(--primary-light);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-top: 8px;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.split-item { text-align: center; }
.split-label { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 4px; }
.split-value { font-size: 1.4rem; font-weight: 700; }
.split-value.owner { color: var(--primary-color); }
.split-value.venue { color: var(--secondary-color); }
.split-value.agent { color: var(--success-color); }
.split-name { font-size: 0.7rem; color: var(--text-secondary); }

/* Checkbox */
.checkbox-group { margin-bottom: 16px; }
.checkbox-label { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; font-weight: 400; }
.checkbox-label input[type="checkbox"] { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--primary-color); cursor: pointer; flex-shrink: 0; }
.checkbox-label span { line-height: 1.5; }

/* Signature */
.signature-container { display: flex; flex-direction: column; gap: 12px; }
#signatureCanvas {
    border: 2px dashed var(--border-color); border-radius: var(--radius-md);
    background: #fafafa; cursor: crosshair; touch-action: none; max-width: 100%;
}
#signatureCanvas:hover { border-color: var(--primary-color); }

/* Buttons */
.btn-primary, .btn-secondary, .btn-success {
    padding: 14px 28px; border-radius: var(--radius-md);
    font-size: 1rem; font-weight: 600; cursor: pointer;
    transition: all 0.2s ease; border: none;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)); color: white; box-shadow: var(--shadow-md); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: white; color: var(--primary-color); border: 2px solid var(--primary-color); }
.btn-secondary:hover { background: var(--primary-light); }
.btn-success { background: linear-gradient(135deg, #25D366, #128C7E); color: white; border: none; box-shadow: var(--shadow-md); }
.btn-success:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
#clearSignature { align-self: flex-start; padding: 8px 16px; font-size: 0.875rem; }

/* Form Actions */
.form-actions { display: flex; justify-content: center; gap: 16px; margin-top: 32px; flex-wrap: wrap; }

/* Terms */
.terms-section { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); border-color: var(--warning-color); }

/* Modals */
.modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1000; overflow-y: auto; padding: 20px;
}
.modal-content {
    background: white; max-width: 800px; margin: 40px auto;
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}
@keyframes modalSlideIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
.modal-content h2 { padding: 24px 28px; border-bottom: 1px solid var(--border-color); font-size: 1.4rem; }
.close-modal { float: right; font-size: 1.5rem; color: var(--text-secondary); cursor: pointer; transition: color 0.2s; }
.close-modal:hover { color: var(--error-color); }
#previewContent { padding: 28px; max-height: 60vh; overflow-y: auto; white-space: pre-wrap; font-family: 'Courier New', monospace; font-size: 0.82rem; line-height: 1.7; color: var(--text-primary); background: #f8fafc; border-radius: var(--radius-md); }
.modal-actions { padding: 20px 28px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 12px; }

/* Share modal */
.share-modal-content { max-width: 500px; text-align: center; }
.share-modal-content h2 { border-bottom: none; }
.success-icon { font-size: 4rem; margin-bottom: 10px; padding-top: 24px; }
.share-description { color: var(--text-secondary); margin-bottom: 24px; padding: 0 20px; }
.share-options { padding: 0 28px 20px; }
.share-options .form-group { margin-bottom: 20px; text-align: left; }
.share-options .form-group input { width: 100%; background: var(--background-color); }
.share-buttons { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.btn-share { width: 100%; padding: 16px 20px; font-size: 1.05rem; border-radius: var(--radius-md); cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 10px; }
.share-note { background: var(--primary-light); padding: 12px 16px; border-radius: var(--radius-md); font-size: 0.83rem; color: var(--text-secondary); }
.share-note p { margin: 0; }

/* Signature section */
.signature-section { border: 2px solid var(--primary-color); background: linear-gradient(135deg, #fff 0%, var(--primary-light) 100%); }
.signature-section h3 { color: var(--primary-color); }

/* Footer */
footer { text-align: center; padding: 24px; color: var(--text-secondary); font-size: 0.875rem; }

/* Loading */
.btn-primary.loading { position: relative; color: transparent; }
.btn-primary.loading::after { content: ""; position: absolute; width: 20px; height: 20px; border: 2px solid white; border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 20px 16px; }
    .form-section { padding: 20px; }
    .form-actions { flex-direction: column; }
    .btn-primary, .btn-secondary, .btn-success { width: 100%; }
    #signatureCanvas { width: 100%; height: 120px; }
    .split-display { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
    .container { padding: 12px; }
    header { margin-bottom: 20px; }
    .form-section { padding: 16px; margin-bottom: 16px; }
    input[type="text"], input[type="email"], input[type="tel"],
    input[type="date"], input[type="number"], textarea, select { padding: 10px 12px; font-size: 16px; }
    .modal-content { margin: 10px auto; }
}
@media (pointer: coarse) {
    .btn-primary, .btn-secondary, .btn-share { min-height: 48px; }
    .checkbox-label input[type="checkbox"] { width: 24px; height: 24px; }
    select { min-height: 48px; }
}
@media print {
    body { background: white; }
    .container { max-width: 100%; }
    .form-section { box-shadow: none; border: 1px solid #ccc; page-break-inside: avoid; }
    .form-actions, .country-banner { display: none; }
}
