@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&display=swap');

*{
    box-sizing:border-box;
}

.customers-page{
    font-family:'Inter', sans-serif;
    max-width:1200px;
    margin:auto;
    padding:40px 35px;
    background:#F8FAFC;
    overflow-x:hidden;
}

.page-header{
    text-align:left;
    margin-bottom:40px;
}

.page-header h1{
    color:#111827;
    font-size:38px;
    font-weight:800;
    margin-bottom:8px;
    line-height:1.2;
}

.page-header p{
    color:#6B7280;
    font-size:15px;
}

.stats-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
    gap:20px;
    margin-bottom:44px;
}

.stat-card{
    position:relative;
    background:#FFFFFF;
    border:1px solid #E5E7EB;
    border-radius:18px;
    padding:28px;
    text-align:left;
    box-shadow:0 1px 2px rgba(0,0,0,.04);
    transition:transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
    cursor:pointer;
}

.stat-card:hover{
    transform:translateY(-4px);
    box-shadow:0 12px 24px rgba(0,0,0,.08);
    border-color:#D1D5DB;
}

.stat-card h2{
    font-size:34px;
    font-weight:800;
    margin:0 0 8px;
    line-height:1.15;
}

.stat-card p{
    color:#6B7280;
    font-size:12px;
    font-weight:700;
    letter-spacing:.06em;
    text-transform:uppercase;
    margin:0;
}

.stat-card.active{
    border:2px solid #2563EB;
    box-shadow:0 10px 24px rgba(37,99,235,.15);
}

.stat-total {
    background: #EFF6FF;
    border-color: #BFDBFE;
}

.stat-bronze {
    background: #FEF7F0;
    border-color: #E7C9A6;
}

.stat-gold {
    background: #FFFBEB;
    border-color: #FDE68A;
}

.stat-steel {
    background: #F3F4F6;
    border-color: #D1D5DB;
}

.customer-header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:22px;
    gap:12px;
    flex-wrap:wrap;
}

.customer-header h2{
    color:#111827;
    font-size:20px;
    font-weight:700;
    margin:0;
}

#addCustomerBtn{
    background:#2563EB;
    color:#FFFFFF;
    border:none;
    padding:12px 22px;
    border-radius:12px;
    cursor:pointer;
    font-weight:600;
    font-size:14px;
    transition:transform 200ms ease, background 200ms ease;
    white-space:nowrap;
}

#addCustomerBtn:hover{
    background:#1D4ED8;
    transform:translateY(-2px);
}

#customer_list{
    display:flex;
    flex-direction:column;
    gap:16px;
}

.customer-card{
    background:#FFFFFF;
    border:1px solid #E5E7EB;
    border-radius:18px;
    padding:24px 26px;
    box-shadow:0 1px 2px rgba(0,0,0,.04);
    transition:transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
    max-width:100%;
    overflow:hidden;
}

.customer-card:hover{
    transform:translateY(-3px);
    box-shadow:0 12px 24px rgba(0,0,0,.06);
    border-color:#D1D5DB;
}

.customer-card-top{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:12px;
    margin-bottom:10px;
    flex-wrap:wrap;
}

.customer-card h3{
    color:#111827;
    font-size:18px;
    font-weight:700;
    margin:0;
    word-break:break-word;
    min-width:0;
}

.customer-card p{
    color:#6B7280;
    font-size:14px;
    margin:4px 0;
    word-break:break-word;
}

/* Membership ID line — monospace so the ID is scannable, with safe
   wrapping/truncation so long IDs never blow out the card width. */
.membership-id{
    display:inline-flex;
    align-items:center;
    gap:6px;
    margin-top:8px;
    padding:6px 12px;
    background:#F3F4F6;
    border:1px solid #E5E7EB;
    border-radius:8px;
    max-width:100%;
}

.membership-id-label{
    color:#6B7280;
    font-size:11px;
    font-weight:700;
    letter-spacing:.04em;
    text-transform:uppercase;
    white-space:nowrap;
}

.membership-id-value{
    color:#111827;
    font-size:13px;
    font-weight:600;
    font-family:'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    min-width:0;
}

.status{
    display:inline-block;
    padding:6px 16px;
    border-radius:999px;
    font-size:12px;
    font-weight:700;
    letter-spacing:.04em;
    text-transform:uppercase;
    color:#FFFFFF;
    white-space:nowrap;
    flex-shrink:0;
}

.status-bronze{ background:#B87333; }
.status-gold{ background:#B8860B; }
.status-steel{ background:#4B5563; }

/* Card action buttons sit side by side on desktop, stack full-width
   on mobile (see media queries below). */
.card-actions{
    display:flex;
    flex-wrap:wrap;
    gap:12px;
    margin-top:16px;
}

.view-btn{
    background:#FFFFFF;
    color:#2563EB;
    border:1.5px solid #2563EB;
    padding:10px 18px;
    border-radius:10px;
    cursor:pointer;
    font-weight:600;
    font-size:14px;
    transition:all 200ms ease;
    margin-top:0; /* spacing now handled by .card-actions gap */
}

.view-btn:hover{
    background:#2563EB;
    color:#FFFFFF;
    transform:translateY(-2px);
}

/* Text Membership Card button - blue iMessage style */
.text-btn{
    background:#007AFF;
    color:#FFFFFF;
    border:none;
    padding:10px 18px;
    border-radius:10px;
    cursor:pointer;
    font-weight:600;
    font-size:14px;
    transition:all 200ms ease;
}

.text-btn:hover{
    background:#0062CC;
    transform:translateY(-2px);
}

/* Request Review button — gold outline so it reads as a secondary
   action and never competes visually with the primary CTA. */
.review-btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    background:#FFFFFF;
    color:#B8860B;
    border:1.5px solid #B8860B;
    padding:10px 18px;
    border-radius:10px;
    cursor:pointer;
    font-weight:600;
    font-size:14px;
    text-decoration:none;
    transition:all 200ms ease;
}

.review-btn:hover{
    background:#B8860B;
    color:#FFFFFF;
    transform:translateY(-2px);
}

.empty-state{
    text-align:center;
    padding:70px 20px;
    background:#FFFFFF;
    border:1px solid #E5E7EB;
    border-radius:18px;
    color:#6B7280;
}

.empty-state h3{
    color:#111827;
    font-size:18px;
    font-weight:700;
    margin:0 0 8px;
}

.empty-state p{
    font-size:14px;
    margin:0;
}

/* ---------- Text Customer modal ---------- */
.text-modal-overlay{
    display:none;
    position:fixed;
    top:0; left:0; right:0; bottom:0;
    background:rgba(17,24,39,.5);
    align-items:center;
    justify-content:center;
    z-index:1000;
    padding:20px;
}

.text-modal{
    background:#FFFFFF;
    border-radius:18px;
    padding:28px;
    width:100%;
    max-width:480px;
    box-shadow:0 20px 40px rgba(0,0,0,.15);
    font-family:'Inter', sans-serif;
    max-height:90vh;
    overflow-y:auto;
}

.text-modal h2{
    color:#111827;
    font-size:20px;
    font-weight:700;
    margin:0 0 6px;
}

.text-modal-customer-name{
    color:#6B7280;
    font-size:14px;
    margin:0 0 16px;
    word-break:break-word;
}

.text-modal-textarea{
    width:100%;
    min-height:200px;
    border:1px solid #E5E7EB;
    border-radius:12px;
    padding:14px;
    font-family:'Inter', sans-serif;
    font-size:14px;
    color:#111827;
    resize:vertical;
    box-sizing:border-box;
}

.text-modal-actions{
    display:flex;
    justify-content:flex-end;
    gap:10px;
    margin-top:18px;
    flex-wrap:wrap;
}

.text-modal-cancel-btn{
    background:#FFFFFF;
    color:#6B7280;
    border:1.5px solid #E5E7EB;
    padding:10px 18px;
    border-radius:10px;
    cursor:pointer;
    font-weight:600;
    font-size:14px;
}

.text-modal-save-btn{
    background:#FFFFFF;
    color:#2563EB;
    border:1.5px solid #2563EB;
    padding:10px 18px;
    border-radius:10px;
    cursor:pointer;
    font-weight:600;
    font-size:14px;
}

.text-modal-save-btn:hover{
    background:#2563EB;
    color:#FFFFFF;
}

.text-modal-edit-btn{
    background:#FFFFFF;
    color:#4B5563;
    border:1.5px solid #D1D5DB;
    padding:10px 18px;
    border-radius:10px;
    cursor:pointer;
    font-weight:600;
    font-size:14px;
    transition:all 200ms ease;
}

.text-modal-edit-btn:hover{
    background:#4B5563;
    color:#FFFFFF;
    transform:translateY(-2px);
}

.text-modal-open-btn{
    background:#2563EB;
    color:#FFFFFF;
    border:none;
    padding:10px 18px;
    border-radius:10px;
    cursor:pointer;
    font-weight:600;
    font-size:14px;
}

.text-modal-open-btn:hover{
    background:#1D4ED8;
}

/* =========================================================
   RESPONSIVE — tablet
   ========================================================= */
@media (max-width:768px){
    .customers-page{
        padding:28px 20px;
    }

    .page-header h1{
        font-size:30px;
    }

    .stats-grid{
        grid-template-columns:repeat(auto-fit,minmax(160px,1fr));
        gap:14px;
        margin-bottom:32px;
    }

    .stat-card{
        padding:20px;
        border-radius:16px;
    }

    .stat-card h2{
        font-size:26px;
    }

    .customer-header{
        flex-direction:row;
        align-items:center;
    }

    .customer-card{
        padding:20px;
        border-radius:16px;
    }

    .card-actions{
        gap:10px;
    }
}

/* =========================================================
   RESPONSIVE — phones (320px–480px)
   ========================================================= */
@media (max-width:480px){
    .customers-page{
        padding:20px 16px;
    }

    .page-header{
        margin-bottom:24px;
    }

    .page-header h1{
        font-size:24px;
        line-height:1.25;
    }

    .page-header p{
        font-size:13px;
    }

    .stats-grid{
        grid-template-columns:repeat(2,1fr);
        gap:10px;
        margin-bottom:24px;
    }

    .stat-card{
        padding:16px;
        border-radius:14px;
    }

    .stat-card h2{
        font-size:22px;
        margin-bottom:4px;
    }

    .stat-card p{
        font-size:10px;
    }

    .customer-header{
        flex-direction:column;
        align-items:stretch;
        gap:12px;
        margin-bottom:16px;
    }

    .customer-header h2{
        font-size:17px;
    }

    #addCustomerBtn{
        width:100%;
        padding:12px 18px;
    }

    #customer_list{
        gap:12px;
    }

    .customer-card{
        padding:16px;
        border-radius:14px;
    }

    .customer-card-top{
        flex-wrap:nowrap;
        align-items:flex-start;
    }

    .customer-card h3{
        font-size:16px;
        flex:1 1 auto;
    }

    .customer-card p{
        font-size:13px;
    }

    .status{
        font-size:11px;
        padding:5px 12px;
    }

    .membership-id{
        width:100%;
        margin-top:8px;
    }

    .membership-id-value{
        flex:1 1 auto;
    }

    /* Buttons go full-width and stack so nothing wraps awkwardly
       or gets squeezed to an unreadable size. */
    .card-actions{
        flex-direction:column;
        gap:8px;
    }

    .text-btn,
    .view-btn,
    .review-btn{
        width:100%;
        padding:12px 16px;
        font-size:14px;
    }

    .text-modal{
        padding:20px;
        border-radius:16px;
    }

    .text-modal h2{
        font-size:18px;
    }

    .text-modal-actions{
        flex-direction:column;
    }

    .text-modal-cancel-btn,
    .text-modal-edit-btn,
    .text-modal-open-btn,
    .text-modal-save-btn{
        width:100%;
    }
}
