/**
 * AI Book Creator - Drafts Management Styles
 *
 * Styles for draft management modals and UI elements
 */

/* Modal Overlay */
.aibc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.aibc-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

/* Modal Content */
.aibc-modal-content {
    position: relative;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    margin: 5vh auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.aibc-modal-content.aibc-modal-small {
    max-width: 450px;
}

/* Modal Header */
.aibc-modal-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.aibc-modal-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.aibc-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.aibc-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Modal Body */
.aibc-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Loading Spinner */
.aibc-loading {
    text-align: center;
    padding: 40px 20px;
}

.aibc-loading .spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: aibc-spin 0.8s linear infinite;
}

@keyframes aibc-spin {
    to { transform: rotate(360deg); }
}

.aibc-loading p {
    margin-top: 16px;
    color: #666;
}

/* No Drafts Message */
#aibc-no-drafts {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

#aibc-no-drafts p {
    font-size: 16px;
    margin: 0;
}

/* Drafts List */
#aibc-drafts-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Draft Item */
.aibc-draft-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

.aibc-draft-item:hover {
    background: #fff;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.aibc-draft-info {
    flex: 1;
    min-width: 0;
}

.aibc-draft-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aibc-draft-date {
    margin: 0;
    font-size: 13px;
    color: #718096;
    line-height: 1.5;
}

.aibc-draft-date span {
    display: inline-block;
}

.aibc-draft-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Buttons */
.aibc-button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.aibc-button-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.aibc-button-primary:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

.aibc-button-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.aibc-button-secondary:hover {
    background: #cbd5e0;
}

.aibc-button-small {
    padding: 8px 14px;
    font-size: 13px;
}

.aibc-button-danger {
    background: #fc8181;
    color: #fff;
}

.aibc-button-danger:hover {
    background: #f56565;
}

/* Input Field */
.aibc-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.2s ease;
    margin-bottom: 20px;
}

.aibc-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Label */
.aibc-modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2d3748;
}

/* Modal Actions */
.aibc-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Draft Action Buttons in Wizard */
.aibc-draft-action-buttons {
    margin: 20px 0;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.aibc-draft-action-buttons .aibc-button {
    flex: 0 0 auto;
}

/* RTL Support */
[dir="rtl"] .aibc-modal-header,
[dir="rtl"] .aibc-draft-item,
[dir="rtl"] .aibc-draft-actions,
[dir="rtl"] .aibc-modal-actions {
    direction: rtl;
}

/* Responsive Design */
@media (max-width: 768px) {
    .aibc-modal-content {
        width: 95%;
        max-height: 90vh;
        margin: 5vh auto;
    }

    .aibc-modal-header {
        padding: 16px 20px;
    }

    .aibc-modal-header h2 {
        font-size: 18px;
    }

    .aibc-modal-body {
        padding: 20px;
    }

    .aibc-draft-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .aibc-draft-actions {
        width: 100%;
        justify-content: space-between;
    }

    .aibc-draft-actions .aibc-button {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .aibc-modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    .aibc-button {
        padding: 12px 16px;
        font-size: 14px;
    }
}
