/* ===========================
   WebAdmin — Shared Admin Styles
   Brazilian Rewards Desktop Theme
   =========================== */

/* Page Header */
.page-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:1.5rem; flex-wrap:wrap; gap:1rem; }
.page-title { margin:0; font-size:1.75rem; font-weight:800; color:#1a1a2e; letter-spacing:-0.02em; }
.page-subtitle { margin:4px 0 0; font-size:0.9rem; color:#6b7280; font-weight:500; }

/* Primary Button */
.btn-primary-br { display:inline-flex; align-items:center; gap:0.5rem; padding:0.6rem 1.25rem; background:linear-gradient(135deg,#7aa31a 0%,#5c8012 100%); color:#fff; border:none; border-radius:10px; font-weight:600; font-size:0.9rem; cursor:pointer; transition:all .15s ease; box-shadow:0 2px 6px rgba(122,163,26,.3); }
.btn-primary-br:hover { transform:translateY(-1px); box-shadow:0 4px 12px rgba(122,163,26,.4); }
.btn-secondary-br { display:inline-flex; align-items:center; gap:0.5rem; padding:0.6rem 1.25rem; background:#fff; color:#374151; border:1px solid #d1d5db; border-radius:10px; font-weight:600; font-size:0.9rem; cursor:pointer; transition:all .15s ease; }
.btn-secondary-br:hover { background:#f9fafb; border-color:#9ca3af; }
.btn-danger-br { display:inline-flex; align-items:center; gap:0.5rem; padding:0.6rem 1.25rem; background:#fff; color:#dc2626; border:1px solid #fecaca; border-radius:10px; font-weight:600; font-size:0.9rem; cursor:pointer; transition:all .15s ease; }
.btn-danger-br:hover { background:#fef2f2; border-color:#f87171; }
.btn-warning-br { display:inline-flex; align-items:center; gap:0.5rem; padding:0.6rem 1.25rem; background:#fff3cd; color:#856404; border:1px solid #ffc107; border-radius:10px; font-weight:600; font-size:0.9rem; cursor:pointer; transition:all .15s ease; }
.btn-warning-br:hover { background:#ffeeba; border-color:#e0a800; }
.btn-warning-br:disabled { opacity:0.65; cursor:not-allowed; }

/* Icon Button */
.btn-icon { width:36px; height:36px; border:1px solid #e5e7eb; background:#fff; border-radius:8px; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; color:#374151; font-size:0.9rem; transition:all .15s ease; }
.btn-icon:hover { background:#f3f4f6; color:#7aa31a; border-color:#d1d5db; }
.btn-icon.danger:hover { background:#fef2f2; color:#dc2626; border-color:#fecaca; }
.admin-table td.text-end, .admin-table td:last-child { white-space:nowrap; }

/* Table Card */
.table-card { background:#fff; border:1px solid #e5e7eb; border-radius:14px; overflow:hidden; box-shadow:0 1px 3px rgba(0,0,0,.04); }
.admin-table { width:100%; border-collapse:collapse; }
.admin-table thead { background:#f9fafb; border-bottom:1px solid #e5e7eb; }
.admin-table th { padding:0.75rem 1rem; font-size:0.75rem; font-weight:700; text-transform:uppercase; letter-spacing:0.5px; color:#6b7280; text-align:left; }
.admin-table td { padding:0.85rem 1rem; font-size:0.9rem; color:#374151; border-bottom:1px solid #f3f4f6; vertical-align:middle; }
.admin-table tbody tr:last-child td { border-bottom:none; }
.admin-table tbody tr:hover { background:#fafbfc; }
.admin-table a { color:#7aa31a; text-decoration:none; }
.admin-table a:hover { text-decoration:underline; }

/* Cell brand */
.cell-brand { display:flex; align-items:center; gap:0.75rem; }
.cell-logo { width:36px; height:36px; border-radius:8px; object-fit:cover; border:1px solid #e5e7eb; }
.cell-logo-placeholder { width:36px; height:36px; border-radius:8px; background:#f0f7e0; display:flex; align-items:center; justify-content:center; color:#7aa31a; font-size:1rem; border:1px solid #d9eaa3; }
.cell-logo-initial { width:36px; height:36px; border-radius:8px; background:linear-gradient(135deg,#164272,#0f2d4f); display:flex; align-items:center; justify-content:center; color:#fff; font-size:0.95rem; font-weight:700; flex-shrink:0; }

/* Loading */
.loading-wrap { display:flex; align-items:center; justify-content:center; gap:1rem; padding:4rem 0; color:#6b7280; font-weight:500; }

/* Empty state */
.empty-state { text-align:center; padding:4rem 2rem; color:#9ca3af; }
.empty-state i { font-size:3rem; margin-bottom:1rem; display:block; color:#d1d5db; }
.empty-state p { font-size:1.1rem; font-weight:600; color:#6b7280; margin:0 0 0.25rem; }
.empty-state small { font-size:0.875rem; color:#9ca3af; }

/* Modal */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.4); backdrop-filter:blur(4px); display:flex; align-items:center; justify-content:center; z-index:500; padding:1rem; }
.modal-panel { background:#fff; border-radius:16px; width:100%; max-width:640px; max-height:90vh; overflow-y:auto; box-shadow:0 20px 60px rgba(0,0,0,.15); }
.modal-panel-header { display:flex; justify-content:space-between; align-items:center; padding:1.25rem 1.5rem; border-bottom:1px solid #e5e7eb; }
.modal-panel-header h3 { margin:0; font-size:1.1rem; font-weight:700; color:#1a1a2e; }
.modal-panel-body { padding:1.5rem; }

/* Form overrides */
.form-label { font-weight:600; font-size:0.85rem; color:#374151; }
.form-control:focus { border-color:#7aa31a; box-shadow:0 0 0 3px rgba(122,163,26,.15); }

/* Stat grid */
.stat-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:1rem; margin-bottom:2rem; }
.stat-card { background:#fff; border:1px solid #e5e7eb; border-radius:14px; padding:1.25rem; display:flex; gap:1rem; box-shadow:0 1px 3px rgba(0,0,0,.04); transition:transform .15s ease,box-shadow .15s ease; }
.stat-card:hover { transform:translateY(-2px); box-shadow:0 4px 12px rgba(0,0,0,.08); }
.stat-icon { width:48px; height:48px; border-radius:12px; display:flex; align-items:center; justify-content:center; flex-shrink:0; font-size:1.25rem; color:#fff; }
.stat-icon.green { background:linear-gradient(135deg,#7aa31a,#5c8012); }
.stat-icon.blue { background:linear-gradient(135deg,#3b82f6,#2563eb); }
.stat-icon.purple { background:linear-gradient(135deg,#8b5cf6,#7c3aed); }
.stat-icon.orange { background:linear-gradient(135deg,#f59e0b,#d97706); }
.stat-content .stat-label { font-size:0.8rem; color:#6b7280; margin:0 0 0.25rem; font-weight:600; }
.stat-content .stat-value { font-size:1.5rem; font-weight:800; color:#1a1a2e; margin:0; }
.stat-content .stat-detail { display:block; font-size:0.75rem; color:#6b7280; margin-top:0.25rem; }

/* Action grid */
.action-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:1rem; }
.action-card { display:flex; flex-direction:column; align-items:center; gap:0.75rem; padding:1.5rem 1rem; background:#fff; border:1px solid #e5e7eb; border-radius:14px; text-decoration:none; color:inherit; text-align:center; transition:all .15s ease; box-shadow:0 1px 3px rgba(0,0,0,.04); }
.action-card:hover { transform:translateY(-2px); box-shadow:0 4px 12px rgba(0,0,0,.08); border-color:#d9eaa3; }
.action-card .action-icon { width:48px; height:48px; border-radius:12px; background:linear-gradient(135deg,#f0f7e0,#d9eaa3); display:flex; align-items:center; justify-content:center; font-size:1.25rem; color:#7aa31a; }
.action-card h4 { margin:0; font-size:0.95rem; font-weight:700; color:#1a1a2e; }
.action-card p { margin:0; font-size:0.8rem; color:#6b7280; }

/* Form actions */
.form-actions { display:flex; gap:0.75rem; margin-top:1.5rem; }

/* Edit tabs */
.edit-tabs { display:flex; gap:0; margin-bottom:1.5rem; border-bottom:2px solid #e5e7eb; }
.edit-tab { background:none; border:none; padding:.75rem 1.25rem; font-size:.9rem; font-weight:600; color:#6b7280; cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-2px; transition:all .15s ease; display:flex; align-items:center; gap:.5rem; }
.edit-tab:hover { color:#1a1a2e; }
.edit-tab.active { color:#164272; border-bottom-color:#164272; }

/* Edit layout (sidebar + form) */
.edit-layout { display:grid; grid-template-columns:280px 1fr; gap:1.5rem; align-items:start; }
@media (max-width:768px) { .edit-layout { grid-template-columns:1fr; } }
.edit-sidebar { position:sticky; top:1rem; }
.edit-form-area { min-width:0; }

/* Company preview card */
.company-preview-card { background:#fff; border:1px solid #e5e7eb; border-radius:14px; padding:1.5rem; text-align:center; box-shadow:0 1px 3px rgba(0,0,0,.04); }
.company-preview-logo { margin:0 auto 1rem; }
.company-preview-logo img { width:80px; height:80px; border-radius:14px; object-fit:cover; border:1px solid #e5e7eb; }
.company-preview-initial { width:80px; height:80px; border-radius:14px; background:linear-gradient(135deg,#164272,#0f2d4f); display:flex; align-items:center; justify-content:center; color:#fff; font-size:2rem; font-weight:700; margin:0 auto; }
.company-preview-name { font-size:1.1rem; font-weight:700; color:#1a1a2e; margin:0 0 .25rem; }
.company-preview-email { font-size:.8rem; color:#6b7280; margin:0 0 .5rem; word-break:break-all; }
.company-preview-link { font-size:.8rem; color:#164272; text-decoration:none; display:inline-flex; align-items:center; gap:.25rem; }
.company-preview-link:hover { text-decoration:underline; }
.company-preview-status { margin:.75rem 0; }
.company-preview-splits { display:flex; gap:.5rem; margin-top:1rem; }
.split-item { flex:1; background:#f7f8fa; border-radius:8px; padding:.5rem .25rem; text-align:center; }
.split-label { display:block; font-size:.65rem; color:#6b7280; text-transform:uppercase; letter-spacing:.5px; font-weight:600; }
.split-value { display:block; font-size:1rem; font-weight:700; color:#1a1a2e; }

/* ===========================
   Mobile Companies — Cards
   =========================== */
.companies-card-list { display:none; flex-direction:column; gap:.75rem; }

.company-mobile-card {
    background:#fff;
    border:1px solid #e5e7eb;
    border-radius:14px;
    padding:1rem;
    box-shadow:0 1px 3px rgba(0,0,0,.04);
}
.company-mobile-top {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:.75rem;
}
.company-mobile-actions { display:flex; gap:.35rem; flex-shrink:0; }
.company-mobile-row {
    display:flex;
    align-items:center;
    gap:.5rem;
    margin-top:.5rem;
    font-size:.8rem;
    color:#6b7280;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.company-mobile-row i { color:#9ca3af; font-size:.85rem; flex-shrink:0; }
.company-mobile-row a { color:#7aa31a; text-decoration:none; overflow:hidden; text-overflow:ellipsis; }

/* ===========================
   Responsive — Mobile
   =========================== */
@media (max-width: 768px) {
    /* Page header */
    .page-header { flex-direction:column; align-items:stretch; gap:.75rem; }
    .page-header .btn-primary-br,
    .page-header .btn-secondary-br { width:100%; justify-content:center; }

    /* Companies: table hidden, cards shown */
    .companies-table-wrap { display:none; }
    .companies-card-list { display:flex; }

    /* Table Card scrollable fallback */
    .table-card { overflow:hidden; }
    .table-card > div { overflow-x:auto; -webkit-overflow-scrolling:touch; }

    /* Edit layout */
    .edit-layout { grid-template-columns:1fr !important; }
    .edit-sidebar { position:static; order:-1; }

    /* Edit tabs: horizontal scroll */
    .edit-tabs { overflow-x:auto; -webkit-overflow-scrolling:touch; flex-wrap:nowrap; }
    .edit-tab { white-space:nowrap; flex-shrink:0; padding:.65rem 1rem; font-size:.85rem; }

    /* Form actions stack */
    .form-actions { flex-direction:column; }
    .form-actions button { width:100%; justify-content:center; }

    /* Modal full width */
    .modal-panel { max-width:100%; border-radius:14px; }

    /* Stat grid single column */
    .stat-grid { grid-template-columns:1fr; }
    .action-grid { grid-template-columns:1fr 1fr; }
}

@media (max-width: 480px) {
    .page-title { font-size:1.35rem; }
    .action-grid { grid-template-columns:1fr; }
}

/* ===========================
   Coupon Form Inputs — Global
   (Blazor CSS isolation doesn't scope
    InputText/InputDate/InputNumber/InputSelect
    in traditional Blazor Server mode)
   Element-qualified selectors (0,1,1) tie with
   site.css selectors but win by load order.
   =========================== */
input.cw-form-input,
textarea.cw-form-input,
select.cw-form-input {
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    color: #1a1a2e;
    background: #ffffff;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}
input.cw-form-input:focus,
textarea.cw-form-input:focus,
select.cw-form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
input.cw-form-input::placeholder,
textarea.cw-form-input::placeholder { color: #9ca3af; }

select.cw-form-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8.825a.5.5 0 0 1-.354-.146L2.146 5.18a.5.5 0 1 1 .708-.708L6 7.617l3.146-3.146a.5.5 0 1 1 .708.708L6.354 8.68A.5.5 0 0 1 6 8.825z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    padding-right: 38px;
    cursor: pointer;
    line-height: 1.5;
}
select.cw-form-input:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%233b82f6' d='M6 8.825a.5.5 0 0 1-.354-.146L2.146 5.18a.5.5 0 1 1 .708-.708L6 7.617l3.146-3.146a.5.5 0 1 1 .708.708L6.354 8.68A.5.5 0 0 1 6 8.825z'/%3E%3C/svg%3E");
}

textarea.cw-form-input {
    resize: vertical;
    min-height: 72px;
    line-height: 1.5;
}

input[type="date"].cw-form-input,
input[type="datetime-local"].cw-form-input {
    appearance: none;
    -webkit-appearance: none;
    min-height: 46px;
    line-height: 1.5;
}

input[type="number"].cw-form-input {
    -moz-appearance: textfield;
}

input[type="number"].cw-form-input::-webkit-inner-spin-button,
input[type="number"].cw-form-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
