/* ============================================================
   Damans After-Sales — Staff Portal Styles
   das-staff-portal.css
   ============================================================ */

/* Reset within portal scope */
.das-sp-wrap *, .das-sp-wrap *::before, .das-sp-wrap *::after {
    box-sizing: border-box;
}

.das-sp-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1a2332;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
.das-sp-login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 480px;
    padding: 24px 16px;
}

.das-sp-login-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,.10), 0 1px 4px rgba(0,0,0,.06);
    padding: 40px 36px 36px;
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.das-sp-login-logo {
    margin-bottom: 16px;
}

.das-sp-login-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a2332;
    margin: 0 0 4px;
}

.das-sp-login-sub {
    font-size: 13px;
    color: #6c757d;
    margin: 0 0 28px;
}

/* ============================================================
   FORMS (shared)
   ============================================================ */
.das-sp-field {
    margin-bottom: 16px;
    text-align: left;
}

.das-sp-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
    letter-spacing: .3px;
    text-transform: uppercase;
}

.das-sp-field input,
.das-sp-field textarea,
.das-sp-field select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 14px;
    color: #1a2332;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    appearance: none;
}

.das-sp-field input:focus,
.das-sp-field textarea:focus,
.das-sp-field select:focus {
    border-color: #1a3a5c;
    box-shadow: 0 0 0 3px rgba(26,58,92,.12);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.das-sp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, opacity .15s, transform .1s;
    text-decoration: none;
    white-space: nowrap;
}

.das-sp-btn:active { transform: scale(.98); }

.das-sp-btn-primary {
    background: #1a3a5c;
    color: #fff;
}
.das-sp-btn-primary:hover { background: #14304f; }

.das-sp-btn-secondary {
    background: #e8f4ff;
    color: #1a3a5c;
}
.das-sp-btn-secondary:hover { background: #d0e8ff; }

.das-sp-btn-success {
    background: #28a745;
    color: #fff;
}
.das-sp-btn-success:hover { background: #218838; }

.das-sp-btn-danger {
    background: #fff0f0;
    color: #dc3545;
    border: 1px solid #f5c6cb;
}
.das-sp-btn-danger:hover { background: #fce8e8; }

.das-sp-btn-ghost {
    background: transparent;
    color: #495057;
    border: 1px solid #dee2e6;
}
.das-sp-btn-ghost:hover { background: #f8f9fa; }

.das-sp-btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.das-sp-btn-xs { padding: 4px 8px; font-size: 11px; border-radius: 5px; }
.das-sp-btn-full { width: 100%; }

.das-sp-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

/* ============================================================
   ALERTS
   ============================================================ */
.das-sp-alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.das-sp-alert-error {
    background: #fff0f0;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.das-sp-alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.das-sp-topbar {
    background: #1a3a5c;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 52px;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.das-sp-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.das-sp-topbar-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.2px;
}

.das-sp-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.das-sp-user-label {
    font-size: 13px;
    color: rgba(255,255,255,.75);
}

/* ============================================================
   LAYOUT
   ============================================================ */
#das-sp-app {
    border: 1px solid #dee2e6;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 82vh;
    min-height: 560px;
    background: #f8f9fa;
}

.das-sp-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.das-sp-sidebar {
    width: 300px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.das-sp-sidebar-header {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    flex-shrink: 0;
}

.das-sp-search-wrap {
    margin-bottom: 8px;
}

.das-sp-search-input {
    width: 100%;
    padding: 8px 12px 8px 32px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23adb5bd' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") 10px center no-repeat;
    transition: border-color .15s, box-shadow .15s;
}

.das-sp-search-input:focus {
    border-color: #1a3a5c;
    box-shadow: 0 0 0 3px rgba(26,58,92,.10);
}

.das-sp-filter-row {
    display: flex;
    gap: 6px;
}

.das-sp-select-sm {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 12px;
    color: #495057;
    background: #fff;
    outline: none;
    cursor: pointer;
}

.das-sp-select-sm:focus {
    border-color: #1a3a5c;
}

/* Ticket list */
.das-sp-ticket-list {
    flex: 1;
    overflow-y: auto;
}

.das-sp-ticket-item {
    padding: 12px 14px;
    border-bottom: 1px solid #f0f2f5;
    cursor: pointer;
    transition: background .12s;
    position: relative;
}

.das-sp-ticket-item:hover {
    background: #f8f9fa;
}

.das-sp-ticket-item.active {
    background: #e8f0fb;
    border-left: 3px solid #1a3a5c;
    padding-left: 11px;
}

.das-sp-ticket-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.das-sp-ticket-ref {
    font-size: 11px;
    font-weight: 700;
    color: #1a3a5c;
    font-family: monospace;
    letter-spacing: .5px;
}

.das-sp-ticket-date {
    font-size: 11px;
    color: #adb5bd;
}

.das-sp-ticket-name {
    font-size: 13px;
    font-weight: 600;
    color: #1a2332;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.das-sp-ticket-meta {
    font-size: 11px;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.das-sp-ticket-badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.das-sp-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .3px;
    text-transform: uppercase;
}

.das-sp-badge-priority-urgent { background: #dc3545; }
.das-sp-badge-priority-high   { background: #fd7e14; color: #fff; }
.das-sp-badge-priority-medium { background: #ffc107; color: #333; }
.das-sp-badge-priority-low    { background: #28a745; }

/* ============================================================
   DETAIL PANEL
   ============================================================ */
.das-sp-detail {
    flex: 1;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
}

.das-sp-detail-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    gap: 12px;
}

.das-sp-detail-placeholder p {
    font-size: 14px;
    margin: 0;
}

/* Detail inner content */
.das-sp-detail-inner {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Ticket header strip */
.das-sp-detail-header {
    background: #fff;
    border-radius: 10px;
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.das-sp-detail-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a2332;
    margin: 0 0 6px;
}

.das-sp-detail-sub {
    font-size: 13px;
    color: #6c757d;
    margin: 0;
}

.das-sp-header-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Cards */
.das-sp-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    overflow: hidden;
}

.das-sp-card-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #6c757d;
    padding: 12px 16px 8px;
    border-bottom: 1px solid #f0f2f5;
    margin: 0;
}

.das-sp-card-body {
    padding: 14px 16px;
}

/* Data table inside cards */
.das-sp-data-table {
    width: 100%;
    border-collapse: collapse;
}

.das-sp-data-table th,
.das-sp-data-table td {
    padding: 6px 0;
    vertical-align: top;
    text-align: left;
}

.das-sp-data-table th {
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
    width: 38%;
    padding-right: 10px;
}

.das-sp-data-table td {
    font-size: 13px;
    color: #1a2332;
}

.das-sp-data-table tr + tr th,
.das-sp-data-table tr + tr td {
    border-top: 1px solid #f0f2f5;
    padding-top: 8px;
}

/* Actions row */
.das-sp-actions-row {
    background: #fff;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.das-sp-actions-row label {
    font-size: 12px;
    font-weight: 700;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-right: 4px;
}

.das-sp-actions-row select {
    padding: 7px 10px;
    border: 1px solid #ced4da;
    border-radius: 7px;
    font-size: 13px;
    color: #1a2332;
    background: #fff;
    cursor: pointer;
    outline: none;
}

.das-sp-actions-row select:focus {
    border-color: #1a3a5c;
    box-shadow: 0 0 0 3px rgba(26,58,92,.10);
}

/* Notes */
.das-sp-notes-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 2px;
}

.das-sp-note {
    border-radius: 8px;
    padding: 10px 13px;
    font-size: 13px;
}

.das-sp-note-internal     { background: #f8f9fa; border-left: 3px solid #adb5bd; }
.das-sp-note-customer     { background: #e8f4ff; border-left: 3px solid #007bff; }
.das-sp-note-status       { background: #fff8e6; border-left: 3px solid #fd7e14; }
.das-sp-note-notification { background: #f3eeff; border-left: 3px solid #6f42c1; }
.das-sp-note-system       { background: #e8fff4; border-left: 3px solid #28a745; }

.das-sp-note-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    flex-wrap: wrap;
}

.das-sp-note-type {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: 2px 7px;
    border-radius: 20px;
    color: #fff;
}

.das-sp-note-author { font-size: 11px; font-weight: 600; color: #495057; }
.das-sp-note-date   { font-size: 11px; color: #adb5bd; margin-left: auto; }
.das-sp-note-text   { color: #1a2332; white-space: pre-wrap; line-height: 1.5; }

/* Add note form */
.das-sp-add-note-form {
    border-top: 1px solid #f0f2f5;
    padding-top: 14px;
}

.das-sp-add-note-form textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.das-sp-add-note-form textarea:focus {
    border-color: #1a3a5c;
    box-shadow: 0 0 0 3px rgba(26,58,92,.10);
}

.das-sp-note-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.das-sp-note-controls select {
    padding: 7px 10px;
    border: 1px solid #ced4da;
    border-radius: 7px;
    font-size: 13px;
    color: #1a2332;
    background: #fff;
    cursor: pointer;
    outline: none;
}

.das-sp-email-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    background: #e8f4ff;
    padding: 6px 10px;
    border-radius: 7px;
    border: 1px solid #bee0f5;
    cursor: pointer;
}

/* Tasks */
.das-sp-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.das-sp-task-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.das-sp-task-item.complete {
    opacity: .6;
}

.das-sp-task-title {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: #1a2332;
}

.das-sp-task-meta {
    font-size: 11px;
    color: #6c757d;
}

.das-sp-task-actions {
    display: flex;
    gap: 5px;
}

.das-sp-add-task-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.das-sp-add-task-row input {
    flex: 1;
    min-width: 160px;
    padding: 7px 10px;
    border: 1px solid #ced4da;
    border-radius: 7px;
    font-size: 13px;
    outline: none;
}

.das-sp-add-task-row input[type="date"] {
    max-width: 160px;
}

.das-sp-add-task-row input:focus {
    border-color: #1a3a5c;
    box-shadow: 0 0 0 3px rgba(26,58,92,.10);
}

/* Attachments */
.das-sp-attachments-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.das-sp-attachment-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    max-width: 90px;
}

.das-sp-attachment-item img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.das-sp-attachment-name {
    font-size: 10px;
    color: #6c757d;
    text-align: center;
    word-break: break-all;
    max-width: 90px;
    line-height: 1.3;
}

.das-sp-file-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #1a3a5c;
    text-decoration: none;
    background: #e8f0fb;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #bee0f5;
}

.das-sp-file-link:hover {
    background: #d0e4f7;
    text-decoration: none;
}

/* Standard response bar */
.das-sp-std-response-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.das-sp-std-response-row select {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #ced4da;
    border-radius: 7px;
    font-size: 13px;
    outline: none;
}

/* Notify section below status */
.das-sp-notify-box {
    background: #e8f4ff;
    border: 1px solid #bee0f5;
    border-radius: 8px;
    padding: 10px 13px;
    margin-top: 8px;
    font-size: 13px;
    display: none;
}

.das-sp-notify-box textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #ced4da;
    border-radius: 7px;
    font-size: 12px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    outline: none;
    margin-top: 6px;
}

/* Spinner */
.das-sp-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: das-sp-spin .7s linear infinite;
    display: inline-block;
}

@keyframes das-sp-spin { to { transform: rotate(360deg); } }

/* Loading state */
.das-sp-loading {
    padding: 24px;
    text-align: center;
    color: #adb5bd;
    font-size: 13px;
}

/* Empty state */
.das-sp-empty {
    padding: 24px;
    text-align: center;
    color: #adb5bd;
    font-size: 13px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 700px) {
    #das-sp-app {
        height: auto;
        min-height: unset;
        border-radius: 8px;
    }

    .das-sp-layout {
        flex-direction: column;
    }

    .das-sp-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
        max-height: 260px;
    }

    .das-sp-detail {
        min-height: 400px;
    }

    .das-sp-topbar {
        border-radius: 8px 8px 0 0;
    }
}

/* ==========================================================================
   v1.3.0 — Customer Conversation card + note attachments
   ========================================================================== */

.das-sp-conv-form textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
}
.das-sp-conv-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.das-sp-photo-req textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    margin-top: 6px;
}

.das-sp-note-atts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e3e6ea;
}
.das-sp-note-att img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}
.das-sp-note-att-file {
    display: inline-block;
    padding: 4px 10px;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 12px;
    color: #1a3a5c;
    text-decoration: none;
}
.das-sp-note-att-file:hover { background: #f0f4f8; }

/* Visually distinguish customer-side messages in activity log */
.das-sp-note-customer_message {
    background: #e9f7ef !important;
    border-left: 3px solid #28a745 !important;
}
.das-sp-note-customer_upload {
    background: #e9f7ef !important;
    border-left: 3px solid #28a745 !important;
}
.das-sp-note-staff_message {
    background: #eef4fb !important;
    border-left: 3px solid #0d6efd !important;
}
