/* =========================================================
   Stamp Manager - styles.css
   Version: 3.02
   ========================================================= */

/* GLOBAL BASE STYLES ------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    color: #111827;
    background-color: #f3f4f6;
}

/* Layout containers */

.sm-header,
.sm-main,
.sm-footer,
.sm-tabs {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* Header */

.sm-header {
    padding: 16px 16px 4px;
}

.sm-header-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #111827;
}

.sm-header-subtitle {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: #4b5563;
}

/* Tabs bar */

.sm-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 16px 8px;
}

/* Main */

.sm-main {
    padding: 8px 16px 16px;
}

/* Footer */

.sm-footer {
    padding: 8px 16px 24px;
    font-size: 12px;
    color: #6b7280;
}

/* Small status messages */

.sm-status {
    margin-top: 6px;
    font-size: 12px;
    min-height: 16px;
}

/* TAB BUTTONS --------------------------------------------- */

.sm-tab-button {
    border: none;
    background-color: #e5f3ff;
    color: #1f2937;
    padding: 8px 16px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, transform 0.15s, box-shadow 0.15s;
}

.sm-tab-button:hover {
    background-color: #bfdbfe;
    transform: translateY(-1px);
}

/* Active tab */
.sm-tab-button.active {
    background-color: #60a5fa;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

/* Keyboard focus */
.sm-tab-button:focus,
.sm-tab-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #1d4ed8;
}

/* Tab content panes */
.sm-tab {
    display: none;
    margin-top: 12px;
}

.sm-tab.active {
    display: block;
}

/* PANELS & LAYOUT ---------------------------------------- */

/* Generic panel wrapper */
.sm-panel {
    background-color: #ffffff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    padding: 10px 12px;
    margin-bottom: 12px;
}

/* Panel header row (title + buttons) */
.sm-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.sm-panel-title {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
}

/* MASTER: 2-column layout */
.sm-master-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-top: 16px;
}

/* Left: master list */
.sm-master-left {
    flex: 2;
    padding: 16px;
    background-color: #f9fafb;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

/* Right: master form, light yellow background */
.sm-master-right {
    flex: 1;
    padding: 16px;
    background-color: #fffbeb; /* light yellow */
    border-radius: 10px;
    border: 1px solid #fbbf24;
}

/* LOOKUP: simpler layout */
.sm-lookup-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.sm-lookup-left {
    flex: 2;
    padding: 16px;
    background-color: #f9fafb;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.sm-lookup-right {
    flex: 1;
    padding: 16px;
    background-color: #f3f4ff;
    border-radius: 10px;
    border: 1px solid #a5b4fc;
}

/* Responsive stack for narrow screens */
@media (max-width: 900px) {
    .sm-master-layout,
    .sm-lookup-layout {
        flex-direction: column;
    }
}

/* MASTER TOPBAR & PAGINATION ----------------------------- */

.sm-master-topbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: flex-end;
    margin-bottom: 8px;
}

.sm-master-topbar-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 160px;
}

.sm-master-topbar-block label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

/* Pagination row under Master list */
.sm-master-pagination {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    justify-content: flex-start;
}

.sm-page-info {
    min-width: 180px;
}

.sm-page-select {
    padding: 4px 10px;
    border-radius: 9999px;
    border: 1px solid #d1d5db;
    font-size: 13px;
    background-color: #ffffff;
}

/* TABLES -------------------------------------------------- */

.sm-table-wrapper {
    overflow-x: auto;
}

.sm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.sm-table thead {
    background-color: #e5e7eb;
}

.sm-table th,
.sm-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.sm-table th {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #374151;
}

.sm-table tbody tr:nth-child(odd) {
    background-color: #f9fafb;
}

.sm-table tbody tr:nth-child(even) {
    background-color: #ffffff;
}

/* Row hover + clickable */
.sm-table-row-selectable {
    cursor: pointer;
}

.sm-table-row-selectable:hover {
    background-color: #dbeafe !important;
}

/* Master list column widths */
.sm-col-country {
    width: 80px;
    white-space: nowrap;
}

.sm-col-facevalue {
    width: 80px;
    white-space: nowrap;
}

/* FORM ELEMENTS ------------------------------------------ */

.sm-form {
    display: block;
}

.sm-form-group {
    margin-bottom: 8px;
}

.sm-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
    color: #374151;
}

.sm-required {
    color: #b91c1c;
    margin-left: 2px;
}

.sm-form-group input[type="text"],
.sm-form-group input[type="number"],
.sm-form-group input[type="date"],
.sm-form-group input[type="email"],
.sm-form-group select {
    width: 100%;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-size: 13px;
    background-color: #ffffff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

/* Checkbox inline with label handled in HTML; basic styling: */
.sm-form-group input[type="checkbox"] {
    margin-right: 4px;
}

/* Focus styles */
.sm-form-group input[type="text"]:focus,
.sm-form-group input[type="number"]:focus,
.sm-form-group input[type="date"]:focus,
.sm-form-group input[type="email"]:focus,
.sm-form-group select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px #2563eb;
}

/* Radio/checkbox option layout */
.sm-radio-option {
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
    font-size: 13px;
}

.sm-radio-option input[type="radio"] {
    margin-right: 4px;
}

/* Small helper text */
.sm-help {
    font-size: 11px;
    color: #6b7280;
}

/* LOOKUP TOPBAR ------------------------------------------ */

.sm-lookup-topbar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.sm-lookup-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.sm-lookup-row label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

/* OR separator between table import and master import */
.sm-lookup-master-or {
    text-align: left;
    font-size: 1.5rem;   /* larger */
    font-weight: 700;    /* bold */
    color: #b91c1c;      /* red */
    margin: 10px 0;
    padding-left: 5px;
}

/* ========= STATUS LINES (master & lookup) =============== */

#master-status,
#lookup-status {
    margin-top: 6px;
    font-size: 12px;
    min-height: 16px;
}

/* BUTTON SYSTEM (PILL-SHAPED, HOVER & FOCUS) ------------- */

.sm-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 9999px; /* pill shape */
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-block;
    margin-right: 8px;
    transition:
        background-color 0.2s,
        transform 0.15s,
        opacity 0.2s,
        box-shadow 0.15s;
}

/* Focus ring for accessibility */
.sm-btn:focus,
.sm-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.7);
}

/* Pressed state */
.sm-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* SAVE (GREEN) ------------------------------------------- */

.sm-btn-save {
    background-color: #cce6cc;     /* disabled pale green */
    color: #0f4220;
    cursor: not-allowed;
}

/* Enabled */
.sm-btn-save:not(:disabled) {
    background-color: #38a169;     /* medium green */
    color: #ffffff;
    cursor: pointer;
}

/* Hover (enabled only) */
.sm-btn-save:not(:disabled):hover {
    background-color: #2f855a;     /* bright hover green */
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(22, 163, 74, 0.45);
}

/* Disabled explicit */
.sm-btn-save:disabled {
    background-color: #cce6cc;
    color: #567d56;
    opacity: 0.85;
}

/* Saving state */
.sm-btn-save.sm-saving {
    background-color: #276749 !important; /* dark green */
    color: white;
    position: relative;
    box-shadow: 0 4px 10px rgba(21, 128, 61, 0.5);
}

/* Spinner when saving */
.sm-btn-save.sm-saving::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    width: 10px;
    height: 10px;
    margin-top: -5px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    animation: sm-spin 0.6s linear infinite;
}

/* Saved state */
.sm-btn-save.sm-success {
    background-color: #16a34a !important;  /* success green */
    color: white;
    box-shadow: 0 4px 10px rgba(22, 163, 74, 0.55);
}

/* CLEAR FORM (BLUE) -------------------------------------- */

.sm-btn-clear {
    background-color: #3b82f6;     /* medium blue */
    color: #ffffff;
}

/* Hover always active */
.sm-btn-clear:hover {
    background-color: #1e40af !important;  /* brighter/darker blue */
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.45);
}

/* NEW (TEAL) --------------------------------------------- */

.sm-btn-new {
    background-color: #5eead4;     /* light teal */
    color: #064e3b;
}

/* Hover */
.sm-btn-new:hover {
    background-color: #14b8a6;     /* strong teal */
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(13, 148, 136, 0.45);
}

/* REFRESH (INDIGO) --------------------------------------- */

.sm-btn-refresh {
    background-color: #c7d2fe;     /* light indigo */
    color: #312e81;
}

.sm-btn-refresh:hover {
    background-color: #6366f1;     /* vibrant indigo */
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.45);
}

/* IMPORT (ORANGE) ---------------------------------------- */

.sm-btn-import {
    background-color: #fed7aa;     /* light orange */
    color: #7c2d12;
}

.sm-btn-import:hover {
    background-color: #f97316;     /* bright orange */
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(249, 115, 22, 0.45);
}

/* DELETE (RED) ------------------------------------------- */

.sm-btn-delete {
    background-color: #fecaca;     /* pale red */
    color: #7f1d1d;
}

.sm-btn-delete:hover {
    background-color: #dc2626;     /* strong red */
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.5);
}

/* SPINNER KEYFRAMES -------------------------------------- */

@keyframes sm-spin {
    from { transform: translateY(-50%) rotate(0deg); }
    to   { transform: translateY(-50%) rotate(360deg); }
}
