/* ==========================================================================
   Techzone Tracking Plugin — Styles (mobile-first)
   ========================================================================== */

/* ---------- Variables ---------- */
:root {
    --tzt-primary: #007bff;
    --tzt-primary-dark: #0056b3;
    --tzt-success: #28a745;
    --tzt-danger: #dc3545;
    --tzt-warning: #ffc107;
    --tzt-gray: #6c757d;
    --tzt-light: #f8f9fa;
    --tzt-border: #dee2e6;
    --tzt-text: #333;
    --tzt-text-muted: #6c757d;
    --tzt-radius: 8px;
    --tzt-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ---------- Reset & base ---------- */
#tzt-app {
    position: relative;
    max-width: 720px;
    margin: 0 auto;
    padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    color: var(--tzt-text);
    line-height: 1.5;
}

#tzt-app *,
#tzt-app *::before,
#tzt-app *::after {
    box-sizing: border-box;
}

/* ---------- Card ---------- */
.tzt-card {
    background: #fff;
    border: 1px solid var(--tzt-border);
    border-radius: var(--tzt-radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--tzt-shadow);
}

.tzt-card h2,
.tzt-card h3 {
    margin: 0 0 12px;
    font-size: 1.15em;
    color: var(--tzt-text);
}

/* ---------- Form ---------- */
#tzt-form-section h2 {
    text-align: center;
    font-size: 1.4em;
    color: var(--tzt-primary);
}

.tzt-subtitle {
    text-align: center;
    color: var(--tzt-text-muted);
    margin-bottom: 20px;
    font-size: 0.95em;
}

.tzt-field {
    margin-bottom: 14px;
}

.tzt-field label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.9em;
}

.tzt-required {
    color: var(--tzt-danger);
}

.tzt-field input {
    width: 100%;
    padding: 12px 14px;
    font-size: 1em;
    border: 1px solid var(--tzt-border);
    border-radius: var(--tzt-radius);
    transition: border-color 0.2s;
}

.tzt-field input:focus {
    outline: none;
    border-color: var(--tzt-primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.tzt-separator {
    text-align: center;
    color: var(--tzt-text-muted);
    font-size: 0.85em;
    margin: 4px 0;
}

/* ---------- Buttons ---------- */
.tzt-btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 1em;
    font-weight: 600;
    border: none;
    border-radius: var(--tzt-radius);
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
    text-decoration: none;
}

.tzt-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tzt-btn-primary {
    width: 100%;
    background: var(--tzt-primary);
    color: #fff;
}

.tzt-btn-primary:hover:not(:disabled) {
    background: var(--tzt-primary-dark);
}

.tzt-btn-secondary {
    background: var(--tzt-light);
    color: var(--tzt-text);
    border: 1px solid var(--tzt-border);
}

.tzt-btn-secondary:hover {
    background: #e9ecef;
}

.tzt-btn-success {
    background: var(--tzt-success);
    color: #fff;
    padding: 10px 20px;
}

.tzt-btn-success:hover {
    background: #218838;
}

.tzt-btn-danger {
    background: var(--tzt-danger);
    color: #fff;
    padding: 10px 20px;
}

.tzt-btn-danger:hover {
    background: #c82333;
}

.tzt-mb {
    margin-bottom: 16px;
}

/* ---------- Alert ---------- */
.tzt-alert {
    padding: 12px 16px;
    border-radius: var(--tzt-radius);
    margin-top: 14px;
    font-size: 0.93em;
}

.tzt-alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.tzt-alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* ---------- Status badge ---------- */
.tzt-status-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tzt-status-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 50px;
    color: #fff;
    font-weight: 700;
    font-size: 0.95em;
    white-space: nowrap;
}

.tzt-bat-code {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--tzt-text);
}

.tzt-client-name {
    color: var(--tzt-text-muted);
    font-size: 0.95em;
}

/* ---------- Equipment info grid ---------- */
.tzt-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.tzt-info-item {
    display: flex;
    gap: 8px;
}

.tzt-info-label {
    font-weight: 600;
    min-width: 100px;
    color: var(--tzt-text-muted);
    font-size: 0.9em;
}

.tzt-info-value {
    color: var(--tzt-text);
}

/* ---------- Notes ---------- */
.tzt-notes {
    margin-top: 12px;
    padding: 12px;
    background: var(--tzt-light);
    border-radius: var(--tzt-radius);
    font-size: 0.93em;
    white-space: pre-wrap;
}

.tzt-notes-label {
    font-weight: 600;
    color: var(--tzt-text-muted);
    font-size: 0.85em;
    margin-bottom: 4px;
}

/* ---------- Timeline ---------- */
.tzt-timeline {
    position: relative;
    padding-left: 28px;
    margin-top: 8px;
}

.tzt-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--tzt-border);
}

.tzt-timeline-item {
    position: relative;
    padding-bottom: 18px;
}

.tzt-timeline-item:last-child {
    padding-bottom: 0;
}

.tzt-timeline-dot {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--tzt-border);
}

.tzt-timeline-date {
    font-size: 0.82em;
    color: var(--tzt-text-muted);
}

.tzt-timeline-label {
    font-weight: 600;
    font-size: 0.93em;
}

.tzt-timeline-notes {
    font-size: 0.88em;
    color: var(--tzt-text-muted);
    margin-top: 2px;
}

/* ---------- Approval cards ---------- */
.tzt-approval-card {
    border: 2px solid #fd7e14;
    border-radius: var(--tzt-radius);
    padding: 16px;
    margin-bottom: 12px;
    background: #fff8f0;
}

.tzt-approval-card:last-child {
    margin-bottom: 0;
}

.tzt-approval-phase {
    font-weight: 700;
    font-size: 1em;
    margin-bottom: 6px;
    color: #e65100;
}

.tzt-approval-desc {
    font-size: 0.93em;
    color: var(--tzt-text);
    margin-bottom: 4px;
}

.tzt-approval-amount {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--tzt-text);
    margin-bottom: 12px;
}

.tzt-approval-actions {
    display: flex;
    gap: 10px;
}

/* ---------- Messages ---------- */
.tzt-message-list {
    margin-bottom: 16px;
}

.tzt-message-item {
    padding: 10px 14px;
    background: var(--tzt-light);
    border-radius: var(--tzt-radius);
    margin-bottom: 8px;
}

.tzt-message-item:last-child {
    margin-bottom: 0;
}

.tzt-message-meta {
    font-size: 0.82em;
    color: var(--tzt-text-muted);
    margin-bottom: 4px;
}

.tzt-message-text {
    font-size: 0.93em;
    white-space: pre-wrap;
}

.tzt-msg-form textarea {
    width: 100%;
    padding: 10px;
    font-size: 0.95em;
    border: 1px solid var(--tzt-border);
    border-radius: var(--tzt-radius);
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    margin-bottom: 10px;
}

.tzt-msg-form textarea:focus {
    outline: none;
    border-color: var(--tzt-primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.tzt-msg-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.tzt-msg-row input {
    width: 100%;
    padding: 10px;
    font-size: 0.95em;
    border: 1px solid var(--tzt-border);
    border-radius: var(--tzt-radius);
    font-family: inherit;
}

.tzt-msg-row input:focus {
    outline: none;
    border-color: var(--tzt-primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

#tzt-msg-feedback {
    margin-top: 10px;
}

/* ---------- Loading overlay ---------- */
.tzt-loading {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: var(--tzt-radius);
}

.tzt-loading[hidden] {
    display: none;
}

.tzt-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--tzt-border);
    border-top-color: var(--tzt-primary);
    border-radius: 50%;
    animation: tzt-spin 0.7s linear infinite;
}

@keyframes tzt-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Tablet (768px+) ---------- */
@media (min-width: 768px) {
    #tzt-app {
        padding: 24px;
    }

    .tzt-card {
        padding: 24px;
    }

    .tzt-info-grid {
        grid-template-columns: 1fr 1fr;
    }

    .tzt-msg-row {
        grid-template-columns: 1fr 1fr;
    }
}

/* ---------- Desktop (1024px+) ---------- */
@media (min-width: 1024px) {
    #tzt-app {
        max-width: 800px;
        padding: 32px;
    }

    .tzt-card {
        padding: 28px;
    }
}
