/* Microlith - Clean minimal design */

@font-face {
  font-family: 'Crimson Text';
  font-style: normal;
  font-weight: 400;
  src: url(crimson_text/CrimsonText-Regular.ttf) format('truetype');
}

@font-face {
  font-family: 'Crimson Text';
  font-style: normal;
  font-weight: 600;
  src: url(crimson_text/CrimsonText-SemiBold.ttf) format('truetype');
}

@font-face {
  font-family: 'Crimson Text';
  font-style: normal;
  font-weight: 700;
  src: url(crimson_text/CrimsonText-Bold.ttf) format('truetype');
}

@font-face {
  font-family: 'Crimson Text';
  font-style: italic;
  font-weight: 400;
  src: url(crimson_text/CrimsonText-Italic.ttf) format('truetype');
}

@font-face {
  font-family: 'Crimson Text';
  font-style: italic;
  font-weight: 600;
  src: url(crimson_text/CrimsonText-SemiBoldItalic.ttf) format('truetype');
}

@font-face {
  font-family: 'Crimson Text';
  font-style: italic;
  font-weight: 700;
  src: url(crimson_text/CrimsonText-BoldItalic.ttf) format('truetype');
}

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

body {
    font-family: 'Crimson Text', Georgia, 'Times New Roman', serif;
    line-height: 1.6;
    color: #000;
    background: white;
    padding: 40px 20px;
}

.container {
    max-width: 670px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: left;
    margin-bottom: 0;
    padding-bottom: 0.3em;
    border-bottom: 1px solid #000;
}

header h1 {
    margin: 0;
    padding: 0;
}

.logo {
    height: 40px;
    width: auto;
    display: block;
}

.login-header .logo {
    margin-bottom: 0;
}

h1 {
    font-size: 30px;
    font-weight: normal;
    text-align: left;
    margin-bottom: 0;
    padding-bottom: 0.3em;
}

h2 {
    font-size: 24px;
    font-weight: normal;
    margin-bottom: 0;
    padding-bottom: 0.3em;
}

h3 {
    font-size: 18px;
    font-weight: normal;
    margin: 20px 0 10px;
}

/* Forms */
form {
    margin: 20px 0 0 0;
}

label {
    display: block;
    margin-bottom: 5px;
    margin-top: 15px;
    font-size: 16px;
}

input[type="email"],
input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 10px 5px;
    font-size: 16px;
    font-family: 'Crimson Text', Georgia, 'Times New Roman', serif;
    border: none;
    border-bottom: 1px solid #000;
    margin-bottom: 20px;
    background: transparent;
}

input[type="email"]:focus,
input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-bottom: 2px solid #800;
}

input[type="number"] {
    width: auto;
    min-width: 100px;
}

/* Buttons */
button,
.btn {
    padding: 10px 20px;
    font-size: 16px;
    font-family: 'Crimson Text', Georgia, 'Times New Roman', serif;
    border: 1px solid #000;
    background: white;
    cursor: pointer;
    color: #000;
    text-decoration: none;
    display: inline-block;
}

button:hover,
.btn:hover {
    background: #000;
    color: white;
}

button.primary,
.btn.primary {
    background: #800;
    color: white;
    border-color: #800;
}

button.primary:hover,
.btn.primary:hover {
    background: #600;
    border-color: #600;
}

button.primary:disabled,
.btn.primary:disabled {
    background: #999;
    border-color: #999;
    cursor: not-allowed;
}

button.secondary,
.btn.secondary {
    background: white;
    color: #800;
    border-color: #800;
}

button.secondary:hover,
.btn.secondary:hover {
    background: #800;
    color: white;
}

button.btn-sm,
.btn.btn-sm {
    padding: 4px 10px;
    font-size: 16px;
}

button.add-btn {
    margin: 20px 0;
}

button.delete-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    color: #999;
    padding: 0 8px;
    margin-left: auto;
    cursor: pointer;
}

button.delete-btn:hover {
    color: #D00;
    background: transparent;
}

/* Sections */
.section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #000;
}

#section-design {
    margin-top: 10px;
    padding-top: 0;
    border-top: none;
}

.section h2 {
    margin-top: 0;
    padding-top: 0;
}

/* Layers */
.layer {
    border: 1px solid #000;
    
    padding: 15px;
    margin-bottom: 15px;
}

.layer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.layer-number {
    font-weight: 500;
}

.step-select {
    width: 100%;
    margin-bottom: 10px;
}

.params {
    margin-top: 10px;
    padding-top: 10px;
}

.param {
    margin-bottom: 10px;
}

.param label {
    font-size: 13px;
    color: #666;
}

.param input,
.param select {
    margin-bottom: 0;
}

/* Actions */
.actions {
    margin: 20px 0;
    display: flex;
    gap: 10px;
}

/* Messages */
.section-message {
    min-height: 1.4em;
    padding: 5px 0;
    font-style: italic;
    color: transparent;
    white-space: nowrap;
}

.section-message.success {
    color: #155724;
}

.section-message.error {
    color: #D00;
}

.section-message.info {
    color: #666;
}

#login-message,
#access-message {
    margin-top: 15px;
    padding: 10px 0;
    min-height: 1.4em;
    font-style: italic;
    color: transparent;
}

#login-message.success,
#access-message.success {
    color: #155724;
}

#login-message.error,
#access-message.error {
    color: #D00;
}

#login-message.info,
#access-message.info {
    color: #666;
}

.quote-label {
    margin-right: 8px;
}

/* Recipe metadata */
.recipe-metadata {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

.recipe-metadata.compact {
    margin-bottom: 10px;
    padding-bottom: 10px;
}

.metadata-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.compact .metadata-row {
    margin-bottom: 2px;
}

.metadata-row label {
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
    min-width: 120px;
}

.metadata-row input {
    flex: 1;
    max-width: 400px;
    padding: 8px 12px;
}

.compact .metadata-row input {
    padding: 5px 8px;
    margin-bottom: 0;
}

.compact .metadata-row label {
    font-size: 14px;
    min-width: 100px;
}

.radio-group {
    display: flex;
    gap: 15px;
    align-items: center;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    font-size: 14px;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    width: auto;
    margin: 0;
    padding: 0;
}

.add-step-container {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.recipe-file-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.add-step-container select {
    width: 100%;
    max-width: 250px;
}

#recipe-steps {
    margin: 0;
    margin-top: 20px;
    min-height: 50px;
    padding-top: 20px;
    border-top: 1px solid #000;
}

.recipe-step {
    border-bottom: 1px solid #000;
    padding: 8px 10px;
    background: white;
    display: flex;
    flex-direction: column;
    gap: 0;
    cursor: move;
    position: relative;
}

.recipe-step.metadata-step {
    cursor: default;
}

.recipe-step.metadata-step .recipe-step-inner {
    align-items: flex-start;
}

.recipe-step.metadata-step .step-params-table {
    margin-left: 0;
}

.recipe-step.metadata-step .step-params-table td.param-label {
    width: 1%;
}

.drag-handle {
    display: block;
    text-align: center;
    color: #ccc;
    font-size: 10px;
    line-height: 1;
    letter-spacing: 2px;
    user-select: none;
    cursor: move;
}

.drag-handle:hover {
    color: #999;
}

.recipe-step-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.recipe-step:hover {
    background: white;
}

.recipe-step.dragging {
    opacity: 0.5;
}

.recipe-step:last-child {
    border-bottom: none;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.step-number {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
}

.step-params {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    flex: 1;
}

.param {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 0;
}

.param label {
    font-size: 12px;
    color: #666;
    margin-bottom: 0;
    white-space: nowrap;
}

.param input,
.param select {
    width: auto;
    min-width: 80px;
    max-width: 120px;
    margin-bottom: 0;
    padding: 6px 8px;
    font-size: 13px;
}

.param select.foundry-dropdown {
    min-width: 100px;
    max-width: 150px;
}

/* Unified step parameters table */
.step-params-table {
    margin-left: 20px;
    margin-top: 10px;
    border-collapse: collapse;
}

.step-params-table td {
    padding: 3px 10px 3px 0;
    vertical-align: middle;
}

.step-params-table td.param-label {
    text-align: left;
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    padding-right: 15px;
}

.recipe-step:not(.metadata-step) .step-params-table td.param-label {
    min-width: 220px;
}

.step-params-table td.param-input {
    text-align: left;
}

.step-params-table td.param-input input {
    width: 150px;
    margin-bottom: 0;
    padding: 5px;
}

.step-params-table td.param-input select {
    width: 200px;
    margin-bottom: 0;
}

/* Section headers for nested steps */
.step-params-table tr.nested-section-header td.section-label {
    font-weight: bold;
    font-size: 14px;
    padding-top: 10px;
    padding-bottom: 3px;
    color: #000;
}

/* Nested parameters with left border */
.step-params-table tr.nested-param-row td {
    border-left: 2px solid #ccc;
    padding-left: 15px;
}

.step-params-table tr.nested-param-row td.param-label {
    font-size: 13px;
}

/* Nested step section labels */
.param > label {
    display: block;
    margin-bottom: 5px;
}

.param.has-nested > label {
    font-weight: bold;
    font-size: 14px;
    margin-top: 10px;
    margin-bottom: 3px;
}

/* File dropdown */
.file-picker-wrapper {
    display: inline-block;
    position: relative;
}

.file-dropdown {
    width: 200px;
    margin-bottom: 0;
}

.file-picker-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: #800;
    transition: width 0.2s;
}

.file-picker-progress.active {
    box-shadow: 0 0 2px rgba(136, 0, 0, 0.3);
}

/* Security Tab */
.security-section {
    margin-bottom: 30px;
    padding: 20px 0;
    padding-bottom: 30px;
    border-bottom: 1px solid #000;
}

.security-section:last-child {
    border-bottom: none;
}

.security-section h3 {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 16px;
    font-weight: 500;
}

.security-description {
    font-size: 13px;
    color: #666;
    margin: 5px 0 15px;
}

.security-status-enabled {
    color: #155724;
    font-weight: 500;
    margin: 10px 0;
}

.security-status-disabled {
    color: #856404;
    margin: 10px 0;
}

.security-status-loading {
    color: #666;
    font-style: italic;
}

.security-section label {
    display: block;
    margin: 10px 0 5px;
    font-size: 14px;
}

.security-section input[type="password"],
.security-section input[type="text"] {
    width: 100%;
    max-width: 300px;
    padding: 8px 5px;
    font-size: 14px;
    border: none;
    border-bottom: 1px solid #000;
    background: transparent;
    margin-bottom: 10px;
}

.security-section input[type="password"]:focus,
.security-section input[type="text"]:focus {
    outline: none;
    border-bottom: 2px solid #800;
}

.security-section button {
    margin-top: 10px;
    margin-right: 10px;
}

#totp-qr-code {
    margin: 15px 0;
    padding: 10px;
    background: white;
    display: inline-block;
}

#totp-secret {
    background: white;
    padding: 5px 0;
    font-family: monospace;
    font-size: 14px;
}

/* security-message now uses .section-message class */

/* File Upload Section */
.file-upload-section {
    margin: 30px 0 20px 0;
    padding: 0;
    padding-top: 15px;
    border-top: 1px solid #000;
}

.file-upload-section h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: normal;
}

.file-upload-hint {
    font-size: 12px;
    color: #666;
    margin: 0 0 10px 0;
}

.file-attach-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#file-list {
    margin-top: 10px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 13px;
}

.file-item:last-child {
    border-bottom: none;
}

.file-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item-size {
    color: #666;
    font-size: 12px;
    margin-left: 10px;
}

.file-item-reupload {
    color: #b00;
    font-size: 11px;
    font-weight: 600;
    margin-left: 10px;
    white-space: nowrap;
}

.file-item-remove {
    background: transparent;
    border: none;
    color: #999;
    font-size: 16px;
    padding: 0 8px;
    margin-left: 10px;
    cursor: pointer;
}

.file-item-remove:hover {
    color: #D00;
    background: transparent;
}

/* Order Details Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #000;
}

.modal-header h2 {
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #D00;
    background: transparent;
}

/* Payment form */
.payment-message {
    color: #cc0000;
    margin: 15px 0;
    font-size: 14px;
}

#payment-element {
    margin: 20px 0;
}

#payment-order-info {
    font-weight: 500;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

/* Check Email Page */
.check-email-card {
    max-width: 670px;
    margin: 0 auto;
    text-align: center;
    padding-top: 40px;
}

.email-icon {
    font-size: 72px;
    margin-bottom: 20px;
}

.check-email-card h1 {
    font-size: 30px;
    font-weight: normal;
    margin-bottom: 15px;
    padding-bottom: 0;
    color: #000;
}

.email-message {
    font-size: 18px;
    margin-bottom: 20px;
    color: #000;
    line-height: 1.6;
}

.email-message strong {
    color: #800;
    font-weight: normal;
}

.email-instructions {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
    line-height: 1.6;
}

.email-tips {
    text-align: left;
    margin: 30px auto 0 auto;
    padding: 0;
    border-top: 1px solid #000;
    padding-top: 20px;
}

.email-tips h3 {
    font-size: 18px;
    font-weight: normal;
    margin-bottom: 10px;
    padding-bottom: 0;
    color: #000;
}

.email-tips ul {
    list-style: none;
    padding: 0;
}

.email-tips li {
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
    color: #666;
    font-size: 16px;
    line-height: 1.6;
}

.email-tips li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #800;
}

.email-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #000;
}

/* Login page specific */
.login-header {
    text-align: left;
    padding-bottom: 0.3em;
    border-bottom: 1px solid #000;
    margin-bottom: 20px;
}

.login-header h1 {
    margin-bottom: 0;
    padding-bottom: 0;
}

.login-header .subtitle,
header .subtitle {
    margin: 0;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

/* Page footer with logout */
.page-footer {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid #000;
    text-align: center;
}

/* ================================================================
   Welcome page (moved from welcome.html inline <style>)
   ================================================================ */

#services ul {
    list-style-position: inside;
    padding-left: 0;
}

.contact-info {
    background: #f9f9f9;
    padding: 20px;
    border-left: 3px solid #000;
}

.contact-info p {
    margin-bottom: 8px;
}

#login-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-top: 6px;
}

#login-form input[type="email"] {
    flex: 1;
    margin-bottom: 0;
    padding: 4px 5px;
}

#login-form button {
    padding: 4px 10px;
    font-size: 14px;
    white-space: nowrap;
}

#login-message {
    font-size: 14px;
}

.welcome-section-first {
    border-top: none;
    padding-top: 8px;
}

.welcome-label {
    margin-top: 6px;
    font-size: 14px;
}

/* ================================================================
   Pay page (moved from pay.html inline <style>)
   ================================================================ */

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

.pay-header {
    padding-bottom: 0.3em;
    border-bottom: 1px solid #000;
    margin-bottom: 20px;
}

.pay-header h1 {
    margin: 0;
    padding: 0;
    font-size: 30px;
    font-weight: normal;
}

.pay-header p {
    margin: 0;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

.quote-summary {
    padding: 15px 0;
    margin-bottom: 20px;
}

.quote-summary h3 {
    margin-top: 0;
    font-size: 18px;
    font-weight: normal;
}

.quote-summary dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 16px;
}

.quote-summary dt {
    color: #666;
    font-size: 16px;
}

.quote-summary dd {
    text-align: right;
    font-size: 16px;
}

.quote-summary .price {
    font-size: 20px;
    font-weight: 600;
}

.pay-form label {
    display: block;
    margin-bottom: 5px;
    margin-top: 15px;
    font-size: 16px;
}

.pay-form input[type="email"],
.pay-form input[type="text"],
.pay-form input[type="password"] {
    width: 100%;
    padding: 10px 5px;
    font-size: 16px;
    font-family: 'Crimson Text', Georgia, 'Times New Roman', serif;
    border: none;
    border-bottom: 1px solid #000;
    margin-bottom: 20px;
    background: transparent;
}

.pay-form input:focus {
    outline: none;
    border-bottom: 2px solid #800;
}

.pay-form button.primary {
    padding: 10px 20px;
    font-size: 16px;
    font-family: 'Crimson Text', Georgia, 'Times New Roman', serif;
    background: #800;
    color: white;
    border: 1px solid #800;
    cursor: pointer;
}

.pay-form button.primary:hover {
    background: #600;
    border-color: #600;
}

.pay-form button.primary:disabled {
    background: #999;
    border-color: #999;
    cursor: not-allowed;
}

#pay-message {
    margin-top: 12px;
}

#unlock-message {
    margin-top: 12px;
    font-size: 16px;
    font-style: italic;
    min-height: 1.4em;
}

#unlock-message.error { color: #D00; }
#unlock-message.success { color: #155724; }
#unlock-message.info { color: #666; }

.pay-error {
    margin-top: 40px;
}

.pay-error h2 {
    font-size: 24px;
    font-weight: normal;
    margin-bottom: 8px;
}

.pay-error p { color: #666; }

/* ================================================================
   Shared layout classes (replacing inline style= attributes)
   ================================================================ */

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hidden-elem {
    display: none;
}

/* ================================================================
   Index page (replacing inline styles)
   ================================================================ */

#file-list {
    margin-top: 20px;
    padding-top: 0;
}

.pattern-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.quote-actions-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #000;
}

#section-quote > h3 {
    margin-top: 0;
}

#quote-expiry-countdown {
    font-size: 13px;
    color: #800;
    margin-top: 5px;
}

#job-auth-message {
    margin-top: 15px;
    line-height: 1.6;
}

#quote-pay-instructions {
    margin-top: 15px;
    line-height: 1.6;
}

.file-list-empty {
    color: #999;
    font-size: 13px;
    font-style: italic;
}

/* ================================================================
   Unlock page (replacing inline styles)
   ================================================================ */

#unlock-error-message {
    color: #D00;
}

.unlock-help-text {
    margin-top: 20px;
    color: #666;
}

#unlock-done-expires {
    margin-top: 15px;
    font-weight: 500;
}

#unlock-order-info {
    margin: 20px 0;
    padding: 15px 0;
    border-bottom: 1px solid #000;
}

#unlock-recipe-title {
    font-weight: 500;
}

#unlock-expires {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
}

#unlock-countdown {
    font-size: 13px;
    color: #800;
    margin-top: 5px;
}

.unlock-instructions {
    margin: 20px 0;
    line-height: 1.6;
}

#unlock-passphrase {
    max-width: 400px;
}

.unlock-submit {
    margin-top: 10px;
}

#unlock-message {
    margin-top: 15px;
    padding: 10px 0;
    font-style: italic;
}

/* OTP security box (shared: unlock page, pay-app.js) */
.otp-box {
    margin: 0 0 20px;
    padding: 12px 15px;
    background: #f5f5f5;
    border: 1px solid #ccc;
}

.otp-box.pay-otp-box {
    margin-top: 20px;
}

.otp-note {
    font-size: 12px;
    color: #666;
    margin: 0 0 6px 0;
}

.otp-phrase {
    font-weight: bold;
    font-family: monospace;
    font-size: 15px;
    letter-spacing: 0.05em;
    margin: 0 0 6px 0;
}

.otp-warning {
    font-size: 12px;
    color: #800;
    margin: 0;
}
