/* AP Consultants Tools — Shared Styles */
:root {
    --apc-primary: #1a3a5c;
    --apc-primary-light: #2a5a8c;
    --apc-accent: #c8a45a;
    --apc-accent-light: #dfc07a;
    --apc-success: #27ae60;
    --apc-warning: #f39c12;
    --apc-danger: #e74c3c;
    --apc-info: #3498db;
    --apc-bg: #f8f9fa;
    --apc-card-bg: #ffffff;
    --apc-text: #333333;
    --apc-text-light: #666666;
    --apc-border: #e0e0e0;
    --apc-radius: 8px;
    --apc-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* ========================================
   RESET — Isolate from Elementor/theme
   ======================================== */
.apc-tool {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    color: var(--apc-text);
    line-height: 1.6;
    font-size: 16px;
}

.apc-tool *,
.apc-tool *::before,
.apc-tool *::after {
    box-sizing: border-box;
}

.apc-tool input,
.apc-tool select,
.apc-tool textarea,
.apc-tool button {
    font-family: inherit;
    font-size: inherit;
    line-height: 1.5;
    margin: 0;
    max-width: 100%;
}

.apc-tool h2,
.apc-tool h3,
.apc-tool p {
    margin-top: 0;
}

/* ========================================
   CARDS
   ======================================== */
.apc-card {
    background: var(--apc-card-bg);
    border-radius: var(--apc-radius);
    box-shadow: var(--apc-shadow);
    padding: 30px;
    margin-bottom: 24px;
    border: 1px solid var(--apc-border);
    overflow: hidden;
}

.apc-card-header {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--apc-primary);
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.apc-card-subtitle {
    font-size: 0.95em;
    color: var(--apc-text-light);
    margin: 0 0 24px 0;
}

/* ========================================
   FORM FIELDS
   ======================================== */
.apc-field {
    margin-bottom: 20px;
}

.apc-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.85em;
    color: var(--apc-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.apc-field .apc-hint,
.apc-hint {
    font-size: 0.8em;
    color: var(--apc-text-light);
    margin-top: 4px;
    line-height: 1.4;
}

.apc-field input[type="text"],
.apc-field input[type="email"],
.apc-field input[type="tel"],
.apc-field input[type="number"],
.apc-field select,
.apc-field textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--apc-border);
    border-radius: var(--apc-radius);
    font-size: 1em;
    transition: border-color 0.2s;
    background: #fff;
    height: auto;
    line-height: 1.5;
    color: var(--apc-text);
}

.apc-field input:focus,
.apc-field select:focus,
.apc-field textarea:focus {
    outline: none;
    border-color: var(--apc-primary);
    box-shadow: 0 0 0 3px rgba(26,58,92,0.1);
}

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

/* Currency input wrapper */
.apc-currency-wrap {
    position: relative;
}

.apc-currency-wrap::before {
    content: 'R';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 700;
    color: var(--apc-text-light);
    pointer-events: none;
    z-index: 1;
    line-height: 1;
}

.apc-currency-wrap input {
    padding-left: 30px !important;
}

/* ========================================
   SLIDERS — fully reset from theme
   ======================================== */
.apc-slider-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.apc-slider-group input[type="range"] {
    flex: 1;
    min-width: 0;
    height: 6px;
    padding: 0;
    margin: 8px 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: var(--apc-border);
    border-radius: 3px;
    border: none;
    outline: none;
    cursor: pointer;
}

.apc-slider-group input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    background: transparent;
    border-radius: 3px;
}

.apc-slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--apc-primary);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    margin-top: -8px;
}

.apc-slider-group input[type="range"]::-moz-range-track {
    height: 6px;
    background: var(--apc-border);
    border-radius: 3px;
    border: none;
}

.apc-slider-group input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--apc-primary);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.apc-slider-value {
    flex-shrink: 0;
    min-width: 50px;
    text-align: right;
    font-weight: 700;
    font-size: 0.95em;
    color: var(--apc-primary);
    white-space: nowrap;
}

/* ========================================
   ROW LAYOUT
   ======================================== */
.apc-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.apc-col-2 {
    flex: 1 1 calc(50% - 10px);
    min-width: 250px;
    overflow: hidden;
}

.apc-col-3 {
    flex: 1 1 calc(33.3% - 14px);
    min-width: 200px;
    overflow: hidden;
}

/* ========================================
   BUTTONS
   ======================================== */
.apc-btn {
    display: inline-block;
    padding: 12px 28px;
    border: none;
    border-radius: var(--apc-radius);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
    line-height: 1.5;
}

.apc-btn-primary {
    background: var(--apc-primary);
    color: #fff;
}

.apc-btn-primary:hover {
    background: var(--apc-primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26,58,92,0.3);
}

.apc-btn-accent {
    background: var(--apc-primary, #1a3a5c);
    color: #fff;
}

.apc-btn-accent:hover {
    background: var(--apc-primary-dark, #0f2440);
}

.apc-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.apc-btn-block {
    display: block;
    width: 100%;
}

/* ========================================
   RESULTS
   ======================================== */
.apc-results {
    animation: apcFadeIn 0.4s ease;
}

@keyframes apcFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.apc-result-highlight {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, var(--apc-primary), var(--apc-primary-light));
    color: #fff;
    border-radius: var(--apc-radius);
    margin-bottom: 24px;
    overflow: hidden;
}

.apc-result-highlight .apc-big-number {
    font-size: 2.4em;
    font-weight: 800;
    line-height: 1.2;
    word-break: break-word;
    overflow-wrap: break-word;
}

.apc-result-highlight .apc-big-label {
    font-size: 0.95em;
    opacity: 0.85;
    margin-top: 6px;
}

/* Stat grid */
.apc-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.apc-stat-card {
    background: var(--apc-bg);
    border-radius: var(--apc-radius);
    padding: 16px 12px;
    text-align: center;
    overflow: hidden;
}

.apc-stat-card .apc-stat-value {
    font-size: 1.3em;
    font-weight: 800;
    color: var(--apc-primary);
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
}

.apc-stat-card .apc-stat-label {
    font-size: 0.8em;
    color: var(--apc-text-light);
    margin-top: 4px;
    line-height: 1.3;
}

/* ========================================
   CHARTS
   ======================================== */
.apc-chart-wrap {
    position: relative;
    width: 100%;
    margin: 20px 0;
}

.apc-chart-wrap canvas {
    width: 100% !important;
    max-width: 100%;
}

/* ========================================
   CTA BANNER
   ======================================== */
.apc-cta {
    background: var(--apc-bg);
    border-left: 4px solid var(--apc-accent);
    padding: 20px 24px;
    border-radius: 0 var(--apc-radius) var(--apc-radius) 0;
    margin-top: 24px;
}

.apc-cta p {
    margin: 0 0 12px 0;
    font-weight: 600;
}

/* ========================================
   TABLE
   ======================================== */
.apc-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.apc-table th,
.apc-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--apc-border);
    font-size: 0.9em;
}

.apc-table th {
    background: var(--apc-bg);
    font-weight: 700;
    font-size: 0.85em;
    text-transform: uppercase;
    color: var(--apc-text-light);
}

.apc-table tr:last-child td { border-bottom: none; }

/* ========================================
   PROGRESS BAR
   ======================================== */
.apc-progress-bar {
    height: 12px;
    background: var(--apc-border);
    border-radius: 6px;
    overflow: hidden;
    margin: 8px 0;
}

.apc-progress-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.8s ease;
}

/* Score colours */
.apc-score-critical  { color: var(--apc-danger); }
.apc-score-needswork { color: #e67e22; }
.apc-score-fair      { color: var(--apc-warning); }
.apc-score-good      { color: #2ecc71; }
.apc-score-excellent { color: var(--apc-success); }

.apc-fill-critical   { background: var(--apc-danger); }
.apc-fill-needswork  { background: #e67e22; }
.apc-fill-fair       { background: var(--apc-warning); }
.apc-fill-good       { background: #2ecc71; }
.apc-fill-excellent  { background: var(--apc-success); }

/* ========================================
   SCORECARD QUIZ
   ======================================== */
.apc-steps-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
}

.apc-step-dot {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--apc-border);
    transition: background 0.3s;
}

.apc-step-dot.active { background: var(--apc-primary); }
.apc-step-dot.done   { background: var(--apc-accent); }

.apc-quiz-option {
    display: block;
    width: 100%;
    padding: 14px 18px;
    margin-bottom: 10px;
    background: var(--apc-bg);
    border: 2px solid var(--apc-border);
    border-radius: var(--apc-radius);
    cursor: pointer;
    text-align: left;
    font-size: 0.95em;
    transition: all 0.2s;
    color: var(--apc-text);
}

.apc-quiz-option:hover {
    border-color: var(--apc-primary);
    background: #eef3f8;
}

.apc-quiz-option.selected {
    border-color: var(--apc-primary);
    background: var(--apc-primary);
    color: #fff;
}

.apc-quiz-question {
    font-size: 1.15em;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--apc-primary);
    line-height: 1.4;
}

.apc-quiz-category {
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--apc-accent);
    margin-bottom: 8px;
}

/* ========================================
   MESSAGES
   ======================================== */
.apc-success-msg {
    background: #d4edda;
    color: #155724;
    padding: 16px 20px;
    border-radius: var(--apc-radius);
    margin: 16px 0;
}

.apc-error-msg {
    background: #f8d7da;
    color: #721c24;
    padding: 16px 20px;
    border-radius: var(--apc-radius);
    margin: 16px 0;
}

/* Loading spinner */
.apc-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--apc-border);
    border-top-color: var(--apc-primary);
    border-radius: 50%;
    animation: apcSpin 0.6s linear infinite;
    vertical-align: middle;
}

@keyframes apcSpin {
    to { transform: rotate(360deg); }
}

/* Honeypot */
.apc-hp { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }

/* Checkbox */
.apc-checkbox-wrap {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 12px 0;
}

.apc-checkbox-wrap input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .apc-card { padding: 24px 18px; }
    .apc-stat-grid { grid-template-columns: 1fr 1fr; }
    .apc-stat-card .apc-stat-value { font-size: 1.1em; }
    .apc-result-highlight .apc-big-number { font-size: 2em; }
    .apc-table td,
    .apc-table th { padding: 8px 10px; font-size: 0.85em; }
}

@media (max-width: 600px) {
    .apc-tool { padding: 12px; }
    .apc-card { padding: 18px 14px; }
    .apc-row { flex-direction: column; gap: 0; }
    .apc-col-2, .apc-col-3 { flex: 1 1 100%; min-width: 0; }
    .apc-result-highlight .apc-big-number { font-size: 1.8em; }
    .apc-result-highlight { padding: 24px 16px; }
    .apc-stat-grid { grid-template-columns: 1fr; }
    .apc-stat-card .apc-stat-value { font-size: 1.2em; }
    .apc-slider-value { min-width: 45px; font-size: 0.85em; }
    .apc-field label { white-space: normal; }
}
