/* Book Submission Form Frontend Styles */

/* Reset and Base Styles */
.bsf-form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Progress Bar */
.bsf-progress-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3rem;
    position: relative;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bsf-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    transition: all 0.3s ease;
}

.bsf-progress-step.active {
    color: #007cba;
}

.bsf-progress-step.completed {
    color: #28a745;
}

.bsf-progress-step .step-number {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.bsf-progress-step.active .step-number {
    background: #007cba;
    color: white;
}

.bsf-progress-step.completed .step-number {
    background: #28a745;
    color: white;
}

.bsf-progress-step .step-title {
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
}

/* Form Steps */
.bsf-form-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.bsf-form-step.active {
    display: block;
}

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

.bsf-form-step h2 {
    color: #2c3e50;
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #007cba;
}

/* Form Sections */
.bsf-form-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    border: 1px solid #e9ecef;
}

.bsf-section-description {
    color: #6c757d;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007cba;
}

/* Form Rows and Groups */
.bsf-form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .bsf-form-row {
        grid-template-columns: 1fr 1fr;
    }
}

.bsf-form-group {
    display: flex;
    flex-direction: column;
}

.bsf-form-group label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.bsf-form-group label.required::after {
    content: ' *';
    color: #dc3545;
}

/* Form Inputs */
.bsf-input,
.bsf-textarea,
.bsf-select {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    color: #495057;
}

.bsf-input {
    padding: 0.75rem 1rem;
}

.bsf-textarea {
    padding: 0.75rem 1rem;
    resize: vertical;
    min-height: 100px;
}

.bsf-input:focus,
.bsf-textarea:focus,
.bsf-select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 123, 186, 0.1);
}

.bsf-textarea {
    resize: vertical;
    min-height: 100px;
}

.bsf-select {
    width: 100%;
    padding: 0px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    background-color: white;
    color: #2c3e50;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    line-height: 1.5;
    height: auto;
    min-height: 36px;
    box-sizing: border-box;
}

.bsf-select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
    color: #2c3e50;
}

.bsf-select option {
    color: #2c3e50;
    background-color: white;
    padding: 8px 12px;
    font-size: 16px;
    line-height: 1.4;
}

.bsf-select:invalid,
.bsf-select option[value=""] {
    color: #6c757d;
}

/* Fix for Firefox */
.bsf-select:-moz-focusring {
    color: transparent;
    text-shadow: 0 0 0 #2c3e50;
}

/* Fix for IE */
.bsf-select::-ms-expand {
    display: none;
}

/* File Input Styling */
.bsf-file-input {
    padding: 0.75rem;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    color: #6c757d;
}

.bsf-file-input:hover {
    border-color: #007cba;
    background: #f0f8ff;
}

.bsf-file-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 123, 186, 0.1);
}

/* Checkbox Styling */
.bsf-checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-weight: 500;
    margin-bottom: 1rem;
}

.bsf-checkbox {
    margin-right: 0.75rem;
    margin-top: 0.25rem;
    transform: scale(1.2);
}

/* Repeater Styles */
.bsf-repeater {
    margin-bottom: 2rem;
}

.bsf-repeater-items {
    margin-bottom: 1.5rem;
}

.bsf-repeater-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
}

.bsf-repeater-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.bsf-repeater-header h4 {
    margin: 0;
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
}

.bsf-remove-item {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.3s ease;
}

.bsf-remove-item:hover {
    background: #c82333;
}

/* Buttons */
.bsf-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
}

.bsf-btn-primary {
    background: #007cba;
    color: white;
}

.bsf-btn-primary:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 186, 0.3);
}

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

.bsf-btn-secondary:hover {
    background: #545b62;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

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

.bsf-btn-success:hover {
    background: #1e7e34;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.bsf-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Navigation */
.bsf-form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e9ecef;
}

.bsf-nav-right {
    display: flex;
    gap: 1rem;
}

/* Loading States */
.bsf-loading {
    opacity: 0.6;
    pointer-events: none;
}

.bsf-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #007cba;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Messages */
.bsf-message {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.bsf-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.bsf-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.bsf-message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* File Upload Progress */
.bsf-upload-progress {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.bsf-upload-progress-bar {
    height: 100%;
    background: #007cba;
    transition: width 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .bsf-form-container {
        padding: 1rem;
    }
    
    .bsf-progress-bar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .bsf-progress-step {
        flex-direction: row;
        text-align: left;
    }
    
    .bsf-progress-step .step-number {
        margin-bottom: 0;
        margin-right: 1rem;
    }
    
    .bsf-form-navigation {
        flex-direction: column;
        gap: 1rem;
    }
    
    .bsf-nav-right {
        width: 100%;
        justify-content: center;
    }
    
    .bsf-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Accessibility */
.bsf-input:focus,
.bsf-textarea:focus,
.bsf-select:focus,
.bsf-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bsf-input,
    .bsf-textarea,
    .bsf-select {
        border-width: 3px;
    }
    
    .bsf-btn {
        border: 2px solid currentColor;
    }
}

/* Drafts List Styles */
.bsf-drafts-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.bsf-drafts-container h2 {
    color: #2c3e50;
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #007cba;
}

.bsf-drafts-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.bsf-draft-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.07);
    transition: all 0.3s ease;
}

.bsf-draft-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.bsf-draft-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.bsf-draft-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.25rem;
    font-weight: 600;
}

.bsf-draft-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.bsf-draft-step {
    font-size: 0.875rem;
    color: #007cba;
    font-weight: 500;
}

.bsf-draft-date {
    font-size: 0.75rem;
    color: #6c757d;
}

.bsf-draft-summary {
    color: #6c757d;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
}

.bsf-draft-actions {
    display: flex;
    gap: 1rem;
}

.bsf-draft-actions .bsf-btn {
    flex: 1;
}

/* Responsive design for drafts */
@media (max-width: 768px) {
    .bsf-draft-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .bsf-draft-meta {
        align-items: flex-start;
    }
    
    .bsf-draft-actions {
        flex-direction: column;
    }
}

/* Login Required Message Styles */
.bsf-login-required {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    text-align: center;
}

.bsf-login-message {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.bsf-login-message h2 {
    color: #2c3e50;
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.bsf-login-message p {
    color: #6c757d;
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.bsf-login-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.bsf-login-form,
.bsf-register-link {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
}

.bsf-login-form h3,
.bsf-register-link h3 {
    color: #2c3e50;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.bsf-login-form form {
    text-align: left;
}

.bsf-login-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #495057;
}

.bsf-login-form input[type="text"],
.bsf-login-form input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.bsf-login-form input[type="submit"] {
    background: #007cba;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.bsf-login-form input[type="submit"]:hover {
    background: #005a87;
}

.bsf-register-link p {
    margin-bottom: 1rem;
    color: #6c757d;
}

.bsf-login-help {
    border-top: 1px solid #e9ecef;
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.bsf-login-help p {
    margin-bottom: 0.5rem;
}

.bsf-link {
    color: #007cba;
    text-decoration: none;
    font-weight: 500;
}

.bsf-link:hover {
    text-decoration: underline;
}

/* Responsive design for login */
@media (max-width: 768px) {
    .bsf-login-actions {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .bsf-login-required {
        padding: 1rem;
    }
    
    .bsf-login-message {
        padding: 1.5rem;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .bsf-form-step,
    .bsf-btn,
    .bsf-input,
    .bsf-textarea,
    .bsf-select,
    .bsf-draft-item {
        transition: none;
    }
    
    .bsf-loading::after {
        animation: none;
    }
}

/* Auto-generated TOC styles */
.bsf-textarea[readonly] {
    background-color: #f8f9fa;
    color: #495057;
    cursor: not-allowed;
}

.bsf-textarea[readonly]:focus {
    border-color: #6c757d;
    box-shadow: 0 0 0 2px rgba(108, 117, 125, 0.1);
}

.bsf-field-help {
    color: #6c757d;
    font-size: 13px;
    margin-top: 4px;
    font-style: italic;
}

/* Section dropdown highlighting */
.bsf-page-section option {
    font-weight: 500;
}

.bsf-page-section option:first-child {
    font-weight: normal;
    color: #6c757d;
}

/* Form validation styles */
.bsf-field-error {
    color: #dc3545;
    font-size: 14px;
    margin-top: 4px;
}

.bsf-input.bsf-error,
.bsf-select.bsf-error,
.bsf-textarea.bsf-error {
    border-color: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.1);
}

/* Drag and Drop Styles */
.bsf-repeater-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bsf-drag-handle {
    cursor: move;
    color: #6c757d;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.bsf-drag-handle:hover {
    color: #007cba;
    background: rgba(0, 124, 186, 0.1);
}

.bsf-drag-handle:active {
    color: #005a87;
    background: rgba(0, 124, 186, 0.2);
}

.bsf-drag-handle .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.bsf-repeater-item.bsf-dragging {
    opacity: 0.8;
    transform: rotate(1deg);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    position: relative;
    background: #fff;
    border: 2px solid #007cba;
}

.bsf-sortable-placeholder {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    height: 60px;
    margin: 0.5rem 0;
    position: relative;
}

.bsf-sortable-placeholder::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 2px;
    background: #dee2e6;
}

.bsf-sortable-placeholder::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 20px;
    background: #dee2e6;
}

/* Ensure repeater items can be reordered */
.bsf-repeater-items {
    display: flex;
    flex-direction: column;
}

.bsf-repeater-item {
    order: 0;
    transition: transform 0.2s ease;
}

/* Reorder instructions */
.bsf-reorder-instructions {
    background: #e3f2fd;
    border: 1px solid #2196f3;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    color: #1976d2;
    font-size: 0.9rem;
}

.bsf-reorder-instructions .dashicons {
    margin-right: 0.5rem;
    color: #2196f3;
}

/* Manual reorder buttons */
.bsf-repeater-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bsf-reorder-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.bsf-reorder-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.bsf-reorder-btn:active {
    background: #dee2e6;
    transform: translateY(1px);
}

.bsf-reorder-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: #6c757d;
}

.bsf-reorder-btn:hover .dashicons {
    color: #495057;
}

/* Disable buttons when at top/bottom */
.bsf-repeater-item:first-child .bsf-move-up,
.bsf-repeater-item:last-child .bsf-move-down {
    opacity: 0.5;
    cursor: not-allowed;
}

.bsf-repeater-item:first-child .bsf-move-up:hover,
.bsf-repeater-item:last-child .bsf-move-down:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
} 