/* cardly-admin.css */
* { box-sizing: border-box; }
body {
    font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
    margin: 0; background: #f7f8fa; color: #1f2937;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px; background: #1f2937; color: #f9fafb;
    padding: 16px 0; flex-shrink: 0;
    display: flex; flex-direction: column;
}
.sidebar h1 { font-size: 18px; padding: 0 16px; margin: 0 0 24px; }
.sidebar nav a {
    display: block; padding: 10px 16px; color: #d1d5db;
    border-left: 3px solid transparent;
}
.sidebar nav a.active, .sidebar nav a:hover {
    background: #111827; color: #fff;
    border-left-color: #3b82f6; text-decoration: none;
}
.sidebar nav a.disabled { color: #6b7280; pointer-events: none; }
.main { flex: 1; padding: 24px 32px; overflow-x: auto; }
.main h2 { margin-top: 0; }

.btn {
    display: inline-block; padding: 8px 16px; background: #2563eb;
    color: #fff; border: 0; border-radius: 4px; cursor: pointer;
    font-size: 14px;
}
.btn:hover { background: #1d4ed8; }
.btn.secondary { background: #6b7280; }
.btn.secondary:hover { background: #4b5563; }
.btn.success { background: #16a34a; }
.btn.success:hover { background: #15803d; }
.btn.danger { background: #dc2626; }
.btn.danger:hover { background: #b91c1c; }
.btn:disabled { background: #9ca3af; cursor: not-allowed; }

/* Icon-only action button: used in table action columns. Same class for ALL buttons
   in an action group; distinguish by icon shape, never by color. */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    color: #1f2937;
    border: 1px solid #9ca3af;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 13px;
    transition: background .12s, color .12s, border-color .12s;
}
.btn-icon:hover { background: #1f2937; color: #fff; border-color: #1f2937; text-decoration: none; }
.btn-icon:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.btn-icon-group { display: inline-flex; gap: 4px; flex-wrap: nowrap; }

.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td {
    padding: 10px 12px; text-align: left;
    border-bottom: 1px solid #e5e7eb;
}
.table th { background: #f3f4f6; font-weight: 600; }
.table tr:hover { background: #f9fafb; }

/* Compact columns: actions, codes, dates, single-badge — width 1% + nowrap so they shrink to content */
.table .col-actions, .table .col-compact {
    width: 1%;
    white-space: nowrap;
}

.form-row { margin-bottom: 16px; }
.form-row label {
    display: block; margin-bottom: 4px;
    font-size: 13px; color: #374151;
}
.form-row input, .form-row select, .form-row textarea {
    width: 100%; padding: 8px 12px;
    border: 1px solid #d1d5db; border-radius: 4px;
    font-size: 14px; font-family: inherit;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
    outline: none; border-color: #2563eb;
}

/* Form grid: pack short fields 2-3 per row on wide screens */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px 20px;
    margin-bottom: 16px;
}
.form-grid .form-row { margin-bottom: 0; }
.form-grid .form-row.span-2 { grid-column: span 2; }
.form-grid .form-row.span-full { grid-column: 1 / -1; }

/* Section divider inside a form */
.form-section { margin: 24px 0 12px; padding-top: 16px; border-top: 1px solid #e5e7eb; }
.form-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.form-section h3 { margin: 0 0 12px; font-size: 15px; color: #374151; font-weight: 600; }

/* Inline checkbox: label sits to the right of the input */
.form-checkbox {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 0;
}
.form-checkbox input[type="checkbox"] {
    width: 18px; height: 18px; margin: 0; cursor: pointer; flex-shrink: 0;
}
.form-checkbox label {
    display: inline; margin: 0; cursor: pointer;
    font-size: 14px; color: #1f2937;
}

/* Logo uploader: preview + pick/drop + remove */
.logo-uploader {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 16px;
    align-items: start;
    padding: 16px;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    transition: border-color .15s, background .15s;
}
.logo-uploader.dragover { border-color: #2563eb; background: #eff6ff; }
.logo-preview {
    width: 200px; height: 140px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-placeholder { color: #9ca3af; font-size: 13px; text-align: center; padding: 8px; }
.logo-controls { display: flex; flex-direction: column; gap: 8px; }
.logo-controls .btn { align-self: flex-start; }
.logo-hint { color: #6b7280; font-size: 12px; line-height: 1.4; }

/* Color picker row: native swatch + hex code displayed */
.color-row { display: flex; align-items: center; gap: 12px; }
.color-row input[type="color"] {
    width: 56px; height: 36px; padding: 2px;
    border: 1px solid #d1d5db; border-radius: 4px; cursor: pointer; background: #fff;
}
.color-row input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 2px; }
.color-row input[type="color"]::-moz-color-swatch { border: 0; border-radius: 2px; }
.color-row .color-hex {
    font-family: ui-monospace, monospace; font-size: 13px; color: #4b5563;
    text-transform: uppercase;
}

.card {
    background: #fff; padding: 20px; border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05); margin-bottom: 16px;
}

.toast {
    position: fixed; bottom: 24px; right: 24px;
    padding: 12px 20px; background: #111827; color: #fff;
    border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.15);
    opacity: 0; transition: opacity .2s;
    z-index: 1000;
}
.toast.show { opacity: 1; }
.toast.error { background: #dc2626; }
.toast.success { background: #16a34a; }

.tag {
    display: inline-block; padding: 2px 8px;
    border-radius: 4px; font-size: 12px; font-weight: 600;
}
.tag.active     { background: #dcfce7; color: #15803d; }
.tag.suspended  { background: #fef3c7; color: #b45309; }
.tag.archived   { background: #e5e7eb; color: #4b5563; }
.tag.disabled   { background: #fee2e2; color: #b91c1c; }

.tabs { display: flex; gap: 0; border-bottom: 2px solid #e5e7eb; margin-bottom: 16px; }
.tabs a {
    padding: 12px 20px; color: #6b7280; cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tabs a.active { color: #2563eb; border-bottom-color: #2563eb; }
.tabs a.disabled { color: #9ca3af; pointer-events: none; }

.empty {
    padding: 48px; text-align: center; color: #6b7280;
    background: #fff; border-radius: 8px;
}
