:root {
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem; 
    --spacing-lg: 1.5rem;
    --border-radius: 0.5rem;
}

html {
    font-family: 'Inter', sans-serif;
    height: 100%;
}

body {
    height: 100%;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section {
    background: white;
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border-radius: var(--border-radius);
    transition: all 0.4s ease-in-out;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    margin-right: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.btn-primary {
    background: #1c371e;
    color: #f6fff8;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

.snaptrade-step-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 10;
    background: #fff;
    color: #111;
    border: none;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    cursor: pointer;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: normal;
    padding: 0;
}
.snaptrade-step-close:hover {
    background:#eee;
}
.snaptrade-step-close:hover svg {
    color: #111;
    stroke: #111;
}
.snaptrade-step-close svg {
    width: 2.25rem;
    height: 2.25rem;
    color: #666;
    stroke: #666;
    stroke-width: 1.2;
    display: block;
    pointer-events: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.connection-item, .account-item {
    background: white;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    border-radius: var(--border-radius);
    border: 0.125rem solid #dee2e6;
}

button.connection-item {
    width: 100%;
    border: 0.125rem solid #dee2e6;
    font-family: 'Inter', sans-serif;
    font-size: inherit;
    text-align: left;
}
.connection-item[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f8f9fa;
}
.connection-item:not([disabled]):hover {
    border-color: #868e96;
    cursor: pointer;
}

.trade-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: bold;
}

.trade-enabled {
    background: #d4edda;
    color: #155724;
}

.read-only {
    background: #fff3cd;
    color: #856404;
}

.status-message {
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-md);
}

.status-success {
    background: #d4edda;
    color: #155724;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
}

.status-info {
    background: #d1ecf1;
    color: #0c5460;
}

.debug-panel {
    background: #1a1a1a;
    color: #00ff00;
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    font-family: monospace;
    font-size: 0.875rem;
    max-height: 25rem;
    overflow-y: auto;
    margin-top: var(--spacing-md);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 0.0625rem solid #ced4da;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

/* Step-by-step and Progress Bar Styles */
.snaptrade-app-container .section {
    display: block; /* Override original display: none */
    position: relative;
}
.snaptrade-app-container .section.active {
    max-height: 100rem; /* Large enough value for content */
    opacity: 1;
    padding-top: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.progress-container {
    background: #f5f7f8;
    padding: 0.5rem 1rem;
    
}
.progress-bar {
    display: flex;
    justify-content: space-around;
    max-width: 50rem;
    margin: 0 auto;
}
.progress-step {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    margin: 0 0.25rem;
    border-radius: var(--border-radius);
    background: #e9ecef;
    color: #868e96;
    font-weight: 500;
    opacity: 0.5;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    position: relative;
}
.progress-step.active {
    background: linear-gradient(135deg, #f5f7f8 0%, rgb(183, 199, 207) 100%);
    color: #075d72;
    font-weight: 600;
    opacity: 1;
}
.progress-step.completed {
    background: #e9ecef;
    color: #6c757d;
    opacity: 1;
}

.progress-step.completed::after {
    content: '✓';
    margin-left: 0.5rem;
}

/* Loading Spinner */
.loader {
    display: inline-block;
    border: 0.25rem solid #f3f3f3;
    border-top: 0.25rem solid #1c371e;
    border-radius: 50%;
    width: 1rem;
    height: 1rem;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.snaptrade-app-container {
    max-width: 37.5rem; /* 600px */
    width: 100%;
    background: white;
    border-radius:1rem;
    overflow: hidden; /* This will contain the rounded corners */
    position: relative;
}
.snaptrade-app-container h1 {
    background: linear-gradient(135deg, #f5f7f8 0%, rgb(183, 199, 207) 100%);
    margin-top: 0;
    font-weight:400;
    border-bottom-left-radius:1rem;
    border-bottom-right-radius:1rem;
    padding:1rem;
    color:#111;
    text-align:center;
}
.snaptrade-app-container h1 b {
    font-weight:600;
}

#initial-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 15rem; /* Give it some space */
}
#initial-loader .loader {
    width: 2.5rem;
    height: 2.5rem;
    border-width: 0.3rem;
    margin-bottom: 1rem;
}

/* Iframe Modal Styles */
#snaptrade-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    justify-content: center;
    align-items: center;
    background-color: rgba(0,0,0,0.33);
    backdrop-filter: blur(4px);
}
#snaptrade-modal-content {
    background: #f1f3f5;
    border-radius: var(--border-radius);
    position: relative;
    width: 90%;
    max-width: 25rem;
    height: 95dvh; /* Use more vertical space */
    max-height: 60rem; /* Increase max-height for taller content */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#snaptrade-iframe {
    width: 100%;
    height: 100%;
    border: none;
}