/* =====================================================
   PUBLISH QUESTION PAGE - DeetCode
   Premium Two-Pane Layout with Modern Aesthetics
   ===================================================== */

/* Main Container */
.publish-container {
    display: flex;
    height: calc(100vh - 68px);
    background: var(--bg-dark);
    overflow: hidden;
}

/* Left Pane - Form Details */
.publish-left {
    width: 50%;
    padding: 1.75rem 2rem;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(0, 255, 163, 0.02) 0%, transparent 30%);
    position: relative;
}

.publish-left::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0.5;
}

/* Right Pane - Code Editors */
.publish-right {
    width: 50%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-panel);
}

/* Section Headers */
.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    letter-spacing: 0.3px;
}

.section-title i {
    color: var(--primary);
    font-size: 1.2rem;
}

.section-title .required {
    color: var(--accent);
    font-size: 0.9rem;
}

/* Form Groups */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.6rem;
    letter-spacing: 0.3px;
}

.form-group label .required {
    color: var(--accent);
    margin-left: 0.25rem;
}

/* Input Styling */
.form-input {
    width: 95%;
    padding: 0.9rem 1.1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input:hover {
    border-color: rgba(0, 255, 163, 0.3);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 255, 163, 0.1), 0 4px 12px rgba(0, 0, 0, 0.2);
    background: var(--bg-card-hover);
}

.form-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.company-input {
    width:  85% !important;
}

/* Textarea */
textarea.form-input {
    resize: vertical;
    min-height: 180px;
    line-height: 1.7;
    font-family: var(--font-main);
}

/* Select Styling */
.form-select {
    width: 100%;
    padding: 0.85rem 2.5rem 0.85rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2300ff9d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-select:hover {
    border-color: rgba(0, 255, 163, 0.3);
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 255, 163, 0.1);
    background-color: var(--bg-card-hover);
}

.form-select option {
    background: var(--bg-card);
    color: var(--text-main);
    padding: 0.5rem;
}

/* Dropdowns Row */
.dropdowns-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1.5fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dropdown-group {
    display: flex;
    flex-direction: column;
}

.dropdown-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.dropdown-group label .required {
    color: var(--accent);
    text-transform: none;
}

/* Test Cases Section */
.test-cases-section {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-panel) 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    position: relative;
    overflow: hidden;
}

.test-cases-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.test-case-item {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.test-case-item:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(0, 255, 163, 0.08);
    transform: translateY(-2px);
}

.test-case-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.test-case-number {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    background: linear-gradient(135deg, rgba(0, 255, 163, 0.15), rgba(0, 210, 255, 0.1));
    padding: 0.4rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(0, 255, 163, 0.2);
    letter-spacing: 0.5px;
}

.btn-remove-test {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 0, 85, 0.1);
    border: 1px solid rgba(255, 0, 85, 0.2);
    border-radius: 8px;
    color: var(--accent);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-remove-test:hover {
    background: rgba(255, 0, 85, 0.2);
    border-color: var(--accent);
    transform: scale(1.05);
}

.test-case-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.test-field label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: block;
}

.test-field textarea {
    width: 90%;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    resize: vertical;
    transition: all 0.3s ease;
    line-height: 1.5;
}

.test-field textarea:hover {
    border-color: rgba(0, 255, 163, 0.3);
}

.test-field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 255, 163, 0.1);
}

.test-field textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Add Test Case Button */
.btn-add-test {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(0, 255, 163, 0.05), rgba(0, 210, 255, 0.03));
    border: 2px dashed rgba(0, 255, 163, 0.4);
    border-radius: 12px;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-add-test:hover {
    background: linear-gradient(135deg, rgba(0, 255, 163, 0.12), rgba(0, 210, 255, 0.08));
    border-style: solid;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 255, 163, 0.15);
}

.btn-add-test i {
    font-size: 1.2rem;
}

/* Code Editor Sections */
.code-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.code-section:last-child {
    border-bottom: none;
}

.code-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.25rem;
    background: linear-gradient(90deg, var(--bg-toolbar), var(--bg-panel));
    border-bottom: 1px solid var(--border);
}

.code-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    letter-spacing: 0.3px;
}

.code-section-title i {
    color: var(--secondary);
    font-size: 1.1rem;
}

.code-section-title.solution i {
    color: var(--primary);
}

.code-section-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.code-section-content .CodeMirror {
    height: 100% !important;
    font-size: 14px;
    font-family: var(--font-mono);
}

/* Publish Header */
.publish-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.75rem;
    background: var(--bg-navbar);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}

.publish-header-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.publish-header-left .logo {
    font-size: 1.3rem;
    font-weight: 800;
}

.page-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: 1.25rem;
    border-left: 1px solid var(--border);
}

.page-title i {
    color: var(--primary);
    font-size: 1.1rem;
}

.publish-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-submit-question {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.75rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: 10px;
    color: #0a0a0a;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 255, 163, 0.2);
}

.btn-submit-question:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 255, 163, 0.35);
}

.btn-submit-question:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-submit-question i {
    font-size: 1.1rem;
}

.btn-exit {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.25rem;
    background: rgba(255, 0, 85, 0.1);
    border: 1px solid rgba(255, 0, 85, 0.3);
    border-radius: 10px;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-exit:hover {
    background: rgba(255, 0, 85, 0.2);
    border-color: var(--accent);
    transform: translateY(-1px);
}

/* Success Modal */
.success-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.success-overlay.show {
    display: flex;
    opacity: 1;
}

.success-modal {
    background: linear-gradient(145deg, var(--bg-card) 0%, var(--bg-panel) 100%);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 3.5rem 3rem;
    text-align: center;
    max-width: 480px;
    width: 90%;
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(0, 255, 163, 0.1);
    position: relative;
    overflow: hidden;
}

.success-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.success-overlay.show .success-modal {
    transform: scale(1);
}

.success-icon {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, rgba(0, 255, 163, 0.25), rgba(0, 210, 255, 0.2));
    border: 2px solid var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.75rem;
    font-size: 2.75rem;
    color: var(--primary);
    animation: successPulse 2s ease-in-out infinite;
}

@keyframes successPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 255, 163, 0.4); }
    50% { box-shadow: 0 0 0 20px rgba(0, 255, 163, 0); }
}

.success-modal h2 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.success-modal p {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 0;
}

.btn-back-practice {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 2rem;
    padding: 0.9rem 2.25rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: 12px;
    color: #0a0a0a;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 255, 163, 0.25);
}

.btn-back-practice:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 255, 163, 0.35);
}

/* Language Indicator */
.language-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: rgba(0, 210, 255, 0.1);
    border: 1px solid rgba(0, 210, 255, 0.2);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.language-indicator i {
    font-size: 0.9rem;
}

/* Scrollbar */
.publish-left::-webkit-scrollbar {
    width: 6px;
}

.publish-left::-webkit-scrollbar-track {
    background: transparent;
}

.publish-left::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 163, 0.15);
    border-radius: 3px;
}

.publish-left::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 163, 0.25);
}

/* Responsive */
@media (max-width: 1200px) {
    .dropdowns-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .publish-container {
        flex-direction: column;
        height: auto;
    }
    
    .publish-left,
    .publish-right {
        width: 100%;
    }
    
    .publish-right {
        min-height: 600px;
        border-right: none;
        border-top: 1px solid var(--border);
    }
    
    .publish-header {
        flex-wrap: wrap;
    }
    
    .publish-header-actions {
        order: 3;
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }
}

@media (max-width: 768px) {
    .publish-left {
        padding: 1.25rem;
    }
    
    .dropdowns-row {
        grid-template-columns: 1fr;
    }
    
    .test-case-fields {
        grid-template-columns: 1fr;
    }
    
    .publish-header-left {
        flex-wrap: wrap;
    }
    
    .page-title {
        border-left: none;
        padding-left: 0;
        margin-top: 0.5rem;
        width: 100%;
    }
}

/* Validation States */
.form-input.error,
.form-select.error,
textarea.error {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 0, 85, 0.15);
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.error-message {
    color: var(--accent);
    font-size: 0.8rem;
    margin-top: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Loading State */
.btn-submit-question.loading {
    pointer-events: none;
    padding-left: 2rem;
    padding-right: 2rem;
}

.btn-submit-question.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Focus Ring Animation */
@keyframes focusRing {
    0% { box-shadow: 0 0 0 0 rgba(0, 255, 163, 0.4); }
    100% { box-shadow: 0 0 0 6px rgba(0, 255, 163, 0); }
}

/* Light Theme Overrides */
[data-theme="light"] .publish-left::before {
    opacity: 0.3;
}

[data-theme="light"] .test-case-item {
    background: var(--bg-card);
}

[data-theme="light"] .code-section-header {
    background: linear-gradient(90deg, var(--bg-card), var(--bg-panel));
}

[data-theme="light"] .success-modal {
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.2), 0 0 40px rgba(0, 179, 107, 0.1);
}

[data-theme="light"] .form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2300b36b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}
