/* assets/css/forms.css */

/* 
   Inherits variables from style.css:
   --primary-color: #0f0f0f (BG)
   --secondary-color: #1e1e1e (Card BG)
   --accent-color: #c5a059 (Gold)
   --text-color: #f0f0f0
   --text-muted: #a0a0a0
*/

:root {
    /* Map Form specific variables to System Theme */
    --form-bg: rgba(15, 15, 15, 0.95);
    --form-card-bg: rgba(30, 30, 30, 0.6);
    --form-border: 1px solid rgba(255, 255, 255, 0.1);

    /* Use System Accent for Actions */
    --action-color: #c5a059;
    --action-hover: #b08d45;

    --text-main: #f0f0f0;
    --text-muted: #a0a0a0;
    --danger: #ef4444;
    --success: #22c55e;
}

.form-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
}

.main-content {
    padding-top: 100px;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

/* Glassmorphism Card (Adapted for Dark Theme) */
.glass-card {
    background: var(--form-card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    margin-bottom: 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, transparent 100%);
    pointer-events: none;
}

.glass-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
    border-color: rgba(197, 160, 89, 0.4);
}

.form-header-card {
    border-top: 4px solid var(--action-color);
    background: linear-gradient(180deg, rgba(197, 160, 89, 0.05) 0%, var(--form-card-bg) 100%);
}

.form-title-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--action-color);
    font-size: 2.2rem;
    font-weight: 800;
    width: 100%;
    padding: 12px 0;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s ease;
}

.form-title-input:hover {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.form-title-input:focus {
    outline: none;
    border-bottom-color: var(--action-color);
    padding-left: 10px;
    /* Slight movement on focus */
}

.form-desc-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    color: var(--text-muted);
    font-size: 1.1rem;
    width: 100%;
    padding: 8px 0;
    transition: all 0.3s ease;
}

.form-desc-input:focus {
    outline: none;
    border-bottom-color: var(--action-color);
    color: var(--text-main);
}

/* Questions */
.question-item {
    position: relative;
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
}

.question-item:hover {
    background: rgba(40, 40, 50, 0.8);
}

.question-item.active {
    border-left-color: var(--action-color);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    background: rgba(45, 45, 55, 0.9);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.question-text-input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    /* subtler border */
    border-radius: 8px;
    padding: 16px;
    color: var(--text-main);
    width: 100%;
    flex: 2;
    font-size: 1.2rem;
    font-weight: 500;
    transition: all 0.2s;
}

.question-type-select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 16px;
    color: var(--text-muted);
    flex: 1;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.question-text-input:focus,
.question-type-select:focus {
    outline: none;
    border-color: var(--action-color);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 4px rgba(197, 160, 89, 0.1);
    color: var(--text-main);
}

/* Options */
.option-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.option-marker {
    color: var(--text-muted);
}

.option-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 6px 0;
    flex-grow: 1;
}

.option-input:focus {
    outline: none;
    border-bottom-color: var(--action-color);
}

.add-option-btn {
    color: var(--action-color);
    font-weight: 500;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-block;
    margin-top: 10px;
    transition: color 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.add-option-btn:hover {
    color: #fff;
    text-shadow: 0 0 10px var(--action-color);
}

/* Action Footer */
.question-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
}

.icon-btn:hover {
    color: var(--text-main);
}

.icon-btn.delete:hover {
    color: var(--danger);
}

/* Switch (Custom Toggle) */
.switch {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Floating Action Button (FAB) - Gold Style */
.fab-add {
    position: fixed;
    right: 40px;
    bottom: 40px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #000;
    border: 2px solid var(--action-color);
    color: var(--action-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 100;
}

.fab-add:hover {
    background: var(--action-color);
    color: #000;
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 0 30px rgba(197, 160, 89, 0.6);
}

/* Buttons */
.btn-primary {
    background: rgba(197, 160, 89, 0.1);
    color: var(--action-color);
    border: 1px solid var(--action-color);
    padding: 12px 28px;
    border-radius: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--action-color);
    color: #000;
    box-shadow: 0 0 25px rgba(197, 160, 89, 0.4);
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.btn-ghost:hover {
    border-color: var(--text-main);
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out forwards;
}

/* Custom Layout Utilities (Replacements for Bootstrap) */
.forms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.flex-row {
    display: flex;
    align-items: center;
}

.flex-column {
    display: flex;
    flex-direction: column;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flex-end {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.flex-1 {
    flex: 1;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 16px;
}

.gap-4 {
    gap: 24px;
}

.mb-3 {
    margin-bottom: 16px;
}

.mb-4 {
    margin-bottom: 24px;
}

.mt-3 {
    margin-top: 16px;
}

.mt-4 {
    margin-top: 24px;
}

.p-3 {
    padding: 16px;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-white {
    color: #fff;
}

.w-100 {
    width: 100%;
}

.h-100 {
    height: 100%;
}

.border-top {
    border-top: var(--form-border);
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-info {
    background: var(--action-color);
    color: #000;
}

/* Modern Builder Layout */
.builder-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    /* Fixed sidebar, fluid canvas */
    gap: 32px;
    align-items: start;
    margin-top: 20px;
}

/* Sidebar Toolbox */
.toolbox-panel {
    background: var(--form-card-bg);
    /* Use matching card bg */
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 24px;
    position: sticky;
    top: 100px;
    /* Stick when scrolling */
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    backdrop-filter: blur(12px);
}

.toolbox-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.toolbox-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
    line-height: 1.5;
}

.tool-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: flex-start;
    /* Icon top aligned */
    gap: 16px;
    user-select: none;
}

.tool-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--action-color);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tool-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(197, 160, 89, 0.1);
    color: var(--action-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.tool-info {
    flex: 1;
}

.tool-name {
    font-weight: 600;
    color: var(--text-main);
    display: block;
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.tool-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    line-height: 1.4;
}

/* Builder Canvas Overlay */
.builder-canvas {
    min-height: 500px;
    padding-bottom: 100px;
}

/* Responsive */
@media (max-width: 900px) {
    .builder-layout {
        grid-template-columns: 1fr;
    }

    .toolbox-panel {
        position: relative;
        top: 0;
        margin-bottom: 40px;
    }
}