/* WP Project CRM — Frontend Styles */
/* Geliştirici: Ural ÇELİK | introduce.com.tr */

:root {
    --wppc-primary:      #1a56db;
    --wppc-primary-dark: #1344ae;
    --wppc-success:      #059669;
    --wppc-success-bg:   #d1fae5;
    --wppc-success-text: #065f46;
    --wppc-error:        #dc2626;
    --wppc-error-bg:     #fee2e2;
    --wppc-error-text:   #991b1b;
    --wppc-info-bg:      #eff6ff;
    --wppc-info-text:    #1e40af;
    --wppc-border:       #e5e7eb;
    --wppc-bg:           #f9fafb;
    --wppc-card-bg:      #ffffff;
    --wppc-text:         #111827;
    --wppc-muted:        #6b7280;
    --wppc-radius:       10px;
    --wppc-shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --wppc-shadow-md:    0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

/* ── Reset ─────────────────────────────────────────────────── */
.wppc-wrap *,
.wppc-wrap *::before,
.wppc-wrap *::after {
    box-sizing: border-box;
}

.wppc-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--wppc-text);
    line-height: 1.6;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px 40px;
}

/* ── Cards ──────────────────────────────────────────────────── */
.wppc-card {
    background: var(--wppc-card-bg);
    border: 1px solid var(--wppc-border);
    border-radius: var(--wppc-radius);
    padding: 32px;
    box-shadow: var(--wppc-shadow);
    margin-bottom: 24px;
}

.wppc-card--narrow {
    max-width: 480px;
    margin: 0 auto;
}

.wppc-card-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--wppc-text);
}

.wppc-card-desc {
    color: var(--wppc-muted);
    margin: 0 0 28px;
    font-size: 15px;
}

/* ── Notices ────────────────────────────────────────────────── */
.wppc-notice {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    font-weight: 500;
}

.wppc-notice--success {
    background: var(--wppc-success-bg);
    color: var(--wppc-success-text);
    border: 1px solid #a7f3d0;
}

.wppc-notice--error {
    background: var(--wppc-error-bg);
    color: var(--wppc-error-text);
    border: 1px solid #fca5a5;
}

.wppc-notice--info {
    background: var(--wppc-info-bg);
    color: var(--wppc-info-text);
    border: 1px solid #bfdbfe;
}

.wppc-notice a {
    color: inherit;
    text-decoration: underline;
}

/* ── Fieldsets ──────────────────────────────────────────────── */
.wppc-fieldset {
    border: 1px solid var(--wppc-border);
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 20px;
}

.wppc-fieldset legend {
    font-size: 13px;
    font-weight: 700;
    color: var(--wppc-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 0 6px;
}

/* ── Form Fields ────────────────────────────────────────────── */
.wppc-field {
    margin-bottom: 16px;
}

.wppc-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.wppc-field input[type="text"],
.wppc-field input[type="email"],
.wppc-field input[type="password"],
.wppc-field input[type="tel"],
.wppc-field input[type="number"],
.wppc-field textarea,
.wppc-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--wppc-border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--wppc-text);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    font-family: inherit;
}

.wppc-field input:focus,
.wppc-field textarea:focus,
.wppc-field select:focus {
    outline: none;
    border-color: var(--wppc-primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}

.wppc-field textarea {
    resize: vertical;
    min-height: 80px;
}

.wppc-field-hint {
    font-size: 12px;
    color: var(--wppc-muted);
    margin: 0 0 12px;
}

.wppc-field--checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 400;
}

.wppc-field input[type="file"] {
    font-size: 13px;
    padding: 8px 0;
}

.req { color: var(--wppc-error); }

/* ── Grid layouts ───────────────────────────────────────────── */
.wppc-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0 16px;
}

/* ── Checkbox grid ──────────────────────────────────────────── */
.wppc-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}

.wppc-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--wppc-border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background .1s, border-color .1s;
}

.wppc-checkbox-label:hover {
    background: var(--wppc-info-bg);
    border-color: #93c5fd;
}

.wppc-checkbox-label input:checked + span {
    font-weight: 600;
    color: var(--wppc-primary);
}

.wppc-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--wppc-primary);
    flex-shrink: 0;
}

/* ── Buttons ────────────────────────────────────────────────── */
.wppc-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background .15s, transform .1s, box-shadow .15s;
    font-family: inherit;
}

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

.wppc-btn--primary {
    background: var(--wppc-primary);
    color: #fff;
}
.wppc-btn--primary:hover { background: var(--wppc-primary-dark); }

.wppc-btn--success {
    background: var(--wppc-success);
    color: #fff;
    font-size: 15px;
    padding: 12px 28px;
}
.wppc-btn--success:hover { background: #047857; }

.wppc-btn--outline {
    background: #fff;
    color: var(--wppc-primary);
    border: 1px solid var(--wppc-primary);
}
.wppc-btn--outline:hover { background: var(--wppc-info-bg); }

.wppc-btn--full { width: 100%; justify-content: center; }
.wppc-btn--sm   { font-size: 12px; padding: 6px 14px; }

.wppc-submit-row {
    display: flex;
    justify-content: flex-end;
    padding-top: 8px;
}

/* ── Dashboard ──────────────────────────────────────────────── */
.wppc-dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.wppc-dashboard-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

/* ── Project Cards ──────────────────────────────────────────── */
.wppc-project-card {
    background: var(--wppc-card-bg);
    border: 1px solid var(--wppc-border);
    border-radius: var(--wppc-radius);
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: var(--wppc-shadow);
}

.wppc-project-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--wppc-border);
    gap: 12px;
    flex-wrap: wrap;
}

.wppc-project-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 4px;
}

.wppc-company {
    font-size: 13px;
    color: var(--wppc-muted);
}

.wppc-status-pill {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Timeline ───────────────────────────────────────────────── */
.wppc-timeline {
    display: flex;
    align-items: flex-start;
    padding: 20px 24px;
    overflow-x: auto;
    gap: 0;
    border-bottom: 1px solid var(--wppc-border);
    position: relative;
}

.wppc-tl-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-width: 80px;
}

.wppc-tl-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 15px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: #e5e7eb;
    z-index: 0;
}

.wppc-tl-step.done::after  { background: #10b981; }
.wppc-tl-step.active::after { background: #e5e7eb; }

.wppc-tl-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    z-index: 1;
    position: relative;
    border: 2px solid #e5e7eb;
    background: #f9fafb;
    color: #9ca3af;
    transition: transform .2s;
}

.wppc-tl-step.done .wppc-tl-dot {
    background: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

.wppc-tl-step.active .wppc-tl-dot {
    background: #eff6ff;
    border-color: var(--wppc-primary);
    color: var(--wppc-primary);
    animation: wppc-pulse 2s infinite;
    transform: scale(1.15);
}

@keyframes wppc-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(26,86,219,.3); }
    50%       { box-shadow: 0 0 0 6px rgba(26,86,219,0); }
}

.wppc-tl-label {
    font-size: 10px;
    text-align: center;
    margin-top: 6px;
    color: var(--wppc-muted);
    max-width: 72px;
    line-height: 1.3;
}

.wppc-tl-step.active .wppc-tl-label { color: var(--wppc-primary); font-weight: 600; }
.wppc-tl-step.done   .wppc-tl-label { color: #059669; }

/* ── Proposal Box ───────────────────────────────────────────── */
.wppc-proposal-box {
    padding: 20px 24px;
    border-bottom: 1px solid var(--wppc-border);
    background: var(--wppc-bg);
}

.wppc-proposal-box h4 {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--wppc-text);
}

.wppc-proposal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.wppc-proposal-item {
    background: #fff;
    border: 1px solid var(--wppc-border);
    border-radius: 8px;
    padding: 12px 14px;
}

.wppc-proposal-item--wide {
    grid-column: 1 / -1;
}

.wppc-proposal-item .label {
    display: block;
    font-size: 11px;
    color: var(--wppc-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 4px;
}

.wppc-proposal-item strong {
    font-size: 18px;
    color: var(--wppc-primary);
}

.wppc-contract-body {
    background: #fff;
    border: 1px solid var(--wppc-border);
    border-radius: 8px;
    padding: 16px 20px;
    font-size: 13px;
    line-height: 1.8;
    margin-bottom: 16px;
    max-height: 280px;
    overflow-y: auto;
}

.wppc-contract-body h1,
.wppc-contract-body h2,
.wppc-contract-body h3 {
    font-size: 14px;
    margin: 12px 0 6px;
}

.wppc-action-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.wppc-approve-spinner { font-size: 13px; color: var(--wppc-muted); }

.wppc-approved-note {
    font-size: 13px;
    color: var(--wppc-success-text);
    font-weight: 600;
    margin: 4px 0 0;
}

/* ── PDF Row ────────────────────────────────────────────────── */
.wppc-pdf-row {
    padding: 14px 24px;
    border-bottom: 1px solid var(--wppc-border);
}

/* ── Project Footer ─────────────────────────────────────────── */
.wppc-project-footer {
    padding: 10px 24px;
    font-size: 12px;
    color: var(--wppc-muted);
}

/* ── Login / Register ───────────────────────────────────────── */
.wppc-logged-as {
    background: var(--wppc-info-bg);
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--wppc-info-text);
}

.wppc-form-link {
    text-align: center;
    font-size: 13px;
    color: var(--wppc-muted);
    margin-top: 14px;
}

.wppc-form-link a { color: var(--wppc-primary); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
    .wppc-card { padding: 20px 16px; }
    .wppc-project-header { flex-direction: column; }
    .wppc-timeline { padding: 16px 12px; }
    .wppc-tl-dot { width: 26px; height: 26px; font-size: 11px; }
    .wppc-tl-label { font-size: 9px; max-width: 55px; }
    .wppc-proposal-grid { grid-template-columns: 1fr 1fr; }
    .wppc-checkbox-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Messaging ──────────────────────────────────────────────── */
.wppc-chat-section {
    padding: 20px 24px;
    border-bottom: 1px solid var(--wppc-border);
}

.wppc-chat-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 14px;
}

.wppc-chat-messages {
    min-height: 80px;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--wppc-border);
    border-radius: 8px;
    padding: 14px;
    background: var(--wppc-bg);
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.wppc-chat-empty {
    text-align: center;
    color: var(--wppc-muted);
    font-size: 13px;
    padding: 20px 0;
}

.wppc-msg {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.wppc-msg--right {
    flex-direction: row-reverse;
}

.wppc-msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.wppc-msg-bubble {
    max-width: 78%;
}

.wppc-msg-header {
    font-size: 11px;
    color: var(--wppc-muted);
    margin-bottom: 4px;
    display: flex;
    gap: 6px;
    align-items: center;
}

.wppc-msg-header strong { color: var(--wppc-text); }

.wppc-msg-time { color: var(--wppc-muted); }

.wppc-msg-content {
    background: #fff;
    border: 1px solid var(--wppc-border);
    border-radius: 10px;
    padding: 9px 13px;
    font-size: 13px;
    line-height: 1.6;
    word-break: break-word;
}

.wppc-msg--right .wppc-msg-content {
    background: var(--wppc-info-bg);
    border-color: #bfdbfe;
}

.wppc-chat-input-row {
    display: flex;
    gap: 8px;
}

.wppc-msg-textarea {
    flex: 1;
    border: 1px solid var(--wppc-border);
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 13px;
    resize: none;
    font-family: inherit;
    min-height: 56px;
}

.wppc-msg-textarea:focus {
    outline: none;
    border-color: var(--wppc-primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,.1);
}

/* ── Unread badge ────────────────────────────────────────────── */
.wppc-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--wppc-error);
    color: #fff;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
}

/* ── E-Signature ─────────────────────────────────────────────── */
.wppc-sig-box {
    padding: 20px 24px;
    border-top: 1px solid var(--wppc-border);
    background: #fafafa;
}

.wppc-sig-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 8px;
}

.wppc-sig-desc {
    font-size: 13px;
    color: var(--wppc-muted);
    margin-bottom: 16px;
    line-height: 1.6;
}

.wppc-sig-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    background: var(--wppc-border);
    border-radius: 8px;
    padding: 3px;
    width: fit-content;
}

.wppc-sig-tab {
    background: transparent;
    border: none;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    color: var(--wppc-muted);
    transition: background .15s, color .15s;
    font-family: inherit;
}

.wppc-sig-tab.active {
    background: #fff;
    color: var(--wppc-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

.wppc-canvas-wrap {
    position: relative;
    display: inline-block;
    width: 100%;
}

.wppc-canvas-wrap canvas {
    width: 100%;
    max-width: 520px;
    height: 160px;
    border: 2px dashed var(--wppc-border);
    border-radius: 8px;
    background: #fff;
    cursor: crosshair;
    touch-action: none;
    display: block;
}

.wppc-canvas-wrap canvas:focus {
    outline: none;
    border-color: var(--wppc-primary);
}

.wppc-sig-clear {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #fff;
    border: 1px solid var(--wppc-border);
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 11px;
    cursor: pointer;
    color: var(--wppc-muted);
    font-family: inherit;
}

.wppc-sig-clear:hover { background: var(--wppc-error-bg); color: var(--wppc-error); border-color: var(--wppc-error); }

.wppc-sig-done {
    padding: 16px 24px;
    background: var(--wppc-success-bg);
    border-top: 1px solid #a7f3d0;
}

.wppc-sig-done-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.wppc-sig-done-icon { font-size: 20px; }

.wppc-sig-done-header strong { display: block; font-size: 13px; color: var(--wppc-success-text); }

.wppc-sig-done-meta { font-size: 11px; color: #059669; }

.wppc-sig-preview-img {
    max-width: 200px;
    border: 1px solid #a7f3d0;
    border-radius: 6px;
    background: #fff;
    padding: 4px;
    display: block;
}

/* ── Portal Template ────────────────────────────────────────── */
.wppc-payment-row {
    padding: 14px 24px;
    border-top: 1px solid var(--wppc-border);
}

.wppc-payment-done {
    padding: 12px 24px;
    font-size: 13px;
    font-weight: 600;
    color: var(--wppc-success-text);
    background: var(--wppc-success-bg);
    border-top: 1px solid #a7f3d0;
}
