/**
 * Repair Desk — Public Frontend Styles
 * Mobile-first, clean, minimal.
 */

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Modal (shared with backend) */
.rd-modal-backdrop { position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.5);display:flex;align-items:center;justify-content:center;z-index:99999;padding:16px }
.rd-modal { background:#fff;border-radius:12px;width:100%;overflow:hidden;box-shadow:0 25px 50px rgba(0,0,0,0.15) }
.rd-modal-header { display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid #e2e8f0 }
.rd-modal-header h2 { margin:0;font-size:16px }
.rd-modal-close { background:none;border:none;font-size:24px;cursor:pointer;color:#94a3b8;padding:0 4px }
.rd-modal-body { padding:16px }

.rd-public {
    max-width: 520px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1e293b;
}

/* Lookup form */
.rd-status-intro {
    color: #64748b;
    font-size: 15px;
    margin-bottom: 16px;
    text-align: center;
}
.rd-status-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}
.rd-status-fields input {
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}
.rd-status-fields input:focus {
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}
.rd-btn-lookup {
    width: 100%;
    padding: 12px;
    background: #f97316;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.rd-btn-lookup:hover {
    background: #ea580c;
}
.rd-btn-lookup:disabled {
    background: #cbd5e1;
    cursor: wait;
}

/* Error */
#rd-status-error {
    margin-top: 12px;
    padding: 10px 14px;
    background: #fef2f2;
    color: #dc2626;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}

/* Status card */
.rd-status-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}
.rd-status-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.rd-status-number {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}
.rd-status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}
.rd-status-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}
.rd-status-row:last-child {
    border-bottom: none;
}
.rd-status-label {
    color: #64748b;
    font-weight: 500;
    flex-shrink: 0;
}

/* Timeline */
.rd-status-timeline {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}
.rd-status-timeline h3 {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 12px;
}
.rd-timeline-item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    position: relative;
}
.rd-timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 22px;
    bottom: -8px;
    width: 2px;
    background: #e2e8f0;
}
.rd-timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}
.rd-timeline-content {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    align-items: baseline;
}
.rd-timeline-status {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}
.rd-timeline-date {
    font-size: 12px;
    color: #94a3b8;
}
.rd-timeline-note {
    width: 100%;
    font-size: 13px;
    color: #64748b;
}

/* Sections (files, steps, messages) */
.rd-status-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}
.rd-status-section h3 {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 12px;
}

/* File gallery */
.rd-public-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}
.rd-public-file {
    display: block;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    transition: border-color 0.2s;
}
.rd-public-file:hover { border-color: #f97316; }
.rd-public-file img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
}
.rd-public-file-icon {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: #f8fafc;
}
.rd-public-file-name {
    padding: 4px 6px;
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rd-public-file-sm img { height: 60px; }
.rd-public-file-btn-group {
    display: flex;
    border-top: 1px solid #e2e8f0;
}
.rd-public-file-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    border: none;
    border-right: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.rd-public-file-btn:last-child { border-right: none; }
.rd-public-file-btn:hover { background: #f8fafc; color: #f97316; }
.rd-step-files { margin: 4px 0 8px 28px; }
/* Lightbox */
.rd-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    cursor: pointer;
}
.rd-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 4px 30px rgba(0,0,0,0.3);
}

/* Work steps */
.rd-steps-group { margin-bottom: 12px; }
.rd-steps-group-title {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.rd-step-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 14px;
}
.rd-step-check {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}
.rd-step-done .rd-step-check { color: #22c55e; }
.rd-step-done .rd-step-title { text-decoration: line-through; color: #94a3b8; }
.rd-step-title { flex: 1; }
.rd-step-time { font-size: 12px; color: #94a3b8; flex-shrink: 0; }

/* Messages */
.rd-message {
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 8px;
    max-width: 85%;
}
.rd-message-shop {
    background: #f1f5f9;
    margin-right: auto;
}
.rd-message-customer {
    background: #fff7ed;
    margin-left: auto;
}
.rd-message-text {
    font-size: 14px;
    white-space: pre-wrap;
}
.rd-message-meta {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}


/* Modal Spinner Overlay */
#rd-modal-spinner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}
@keyframes rd-spin {
    to { transform: rotate(360deg); }
}
#rd-modal-spinner::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #f97316;
    border-radius: 50%;
    animation: rd-spin 0.6s linear infinite;
}
