:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --background-dark: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --highlight-bg: #334155;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--background-dark);
    color: var(--text-main);
    font-family: var(--font-family);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Utilities */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 1rem;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.full-width {
    width: 100%;
}

.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 30px;
}

/* Saved Scripts Item */
.saved-script-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
}

.script-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.script-name small {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.9rem;
    margin-left: 10px;
}

.script-actions {
    display: flex;
    gap: 10px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.25rem;
    color: white;
}

.call-timer {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(37, 99, 235, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.timer-value {
    font-family: monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: #60a5fa;
}

/* Screens */
.screen {
    display: none;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-muted);
}

textarea,
input[type="text"] {
    width: 100%;
    background-color: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-main);
    font-family: inherit;
    resize: vertical;
}

textarea:focus,
input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.helper-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Snippets Screen */
.snippets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.snippet-field label {
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    font-weight: 700;
}

/* Highlighted Snippets Style - Bold Blue */
.snippet-highlight {
    color: #3b82f6 !important;
    background-color: transparent !important;
    border-bottom: none !important;
    cursor: pointer;
    font-weight: 800 !important;
    padding: 0 2px !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    display: inline;
    text-decoration: none;
}

.snippet-highlight:hover {
    color: #2563eb !important;
    text-decoration: underline;
}

/* Call Screen Layout */
.step-navigation-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 5px;
}

/* Ensure Back button is always visible but gray when disabled */
#backBtn {
    opacity: 1;
    /* Override default opacity if needed or manage via state */
    display: inline-flex;
    /* improved from style tag */
}

#backBtn:disabled {
    opacity: 0.3;
    cursor: default;
    background-color: var(--card-bg);
    /* Blend in or just gray */
    color: var(--text-muted);
}

.step-tabs {
    display: flex;
    gap: 5px;
    flex: 1;
    overflow-x: auto;
}

.step-tab {
    padding: 6px 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.step-tab:hover {
    background: #334155;
}

.step-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.progress-fill {
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 2px;
    margin-bottom: 20px;
}

.call-card {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    align-items: start;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 24px;
}

@media (max-width: 768px) {
    .call-card {
        grid-template-columns: 1fr;
    }
}

/* Step Content */
.step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.step-number {
    background: var(--highlight-bg);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.9rem;
}

.step-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.script-box {
    position: relative;
    font-size: 1.25rem;
    line-height: 1.7;
    background: #0f172a;
    padding: 24px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    margin-bottom: 30px;
    white-space: pre-line;
}

.btn-icon-edit {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.btn-icon-edit:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.edit-step-textarea {
    font-size: 1.1rem;
    font-family: inherit;
    line-height: 1.5;
    background: #1e293b;
    color: #f1f5f9;
    border: 1px solid var(--primary-color);
}

.edit-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    justify-content: flex-end;
}

/* Actions Area */
.actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.primary-actions-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 5px;
}

/* Objection Panel */
.objection-panel {
    background: #2a1818;
    border: 1px solid #451a1a;
    border-radius: 8px;
    padding: 16px;
}

.objection-panel-title {
    color: #fca5a5;
    font-weight: 700;
    margin-bottom: 12px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-objection {
    width: 100%;
    background: #451a1a;
    color: #fca5a5;
    border: 1px solid #5c2222;
    margin-bottom: 12px;
    padding: 12px;
    font-size: 1rem;
    justify-content: flex-start;
}

.btn-objection:hover {
    background: #5c2222;
    transform: translateX(2px);
}

/* Objection Modal */
.objection-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.objection-modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    /* Constrain height to viewport */
    overflow-y: auto;
    /* Enable vertical scrolling */
    padding: 30px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
}

/* Accordion Styles */
.accordion-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
    width: 100%;
}

.accordion-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: #0f172a;
}

.accordion-header {
    width: 100%;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--highlight-bg);
    color: white;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.accordion-header:hover {
    background: #475569;
}

.accordion-header.active {
    background: var(--primary-color);
}

.accordion-header .arrow {
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.accordion-header.active .arrow {
    transform: rotate(180deg);
}

.accordion-body {
    display: none;
    padding: 24px;
    border-top: 1px solid var(--border-color);
    background: #1e293b;
}

.objection-text {
    font-size: 1.15rem;
    line-height: 1.6;
    color: #e2e8f0;
}

.modal-footer-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Prompt Output Overlay */
.prompt-output-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.prompt-box {
    background: var(--card-bg);
    width: 90%;
    max-width: 700px;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.prompt-box textarea {
    min-height: 300px;
    font-family: monospace;
    font-size: 0.9rem;
}

.prompt-box .button-group {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}