/* =================================================
   API Components Styles
   Iraqi Journal of Science and Technology
   ================================================= */

/* Alert Messages */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-weight: 500;
    animation: slideIn 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.alert strong {
    margin-left: 0.5rem;
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin-right: 0.5rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.alert-close:hover {
    opacity: 1;
}

/* Alert Types */
.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #34d399;
    border-right: 4px solid #10b981;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #f87171;
    border-right: 4px solid #ef4444;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fbbf24;
    border-right: 4px solid #f59e0b;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #60a5fa;
    border-right: 4px solid #3b82f6;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 0.5rem;
}

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

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading-overlay::after {
    content: 'Loading...';
    color: white;
    font-size: 1.125rem;
    font-weight: 500;
}

/* Button Loading State */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

button .spinner {
    border-color: currentColor;
    border-top-color: transparent;
    opacity: 0.8;
}

/* Status Badge Colors */
.status-submitted {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-review {
    background-color: #fef3c7;
    color: #92400e;
}

.status-revision {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-revised {
    background-color: #e0e7ff;
    color: #3730a3;
}

.status-accepted {
    background-color: #d1fae5;
    color: #065f46;
}

.status-rejected {
    background-color: #f3f4f6;
    color: #4b5563;
}

.status-published {
    background-color: #ddd6fe;
    color: #5b21b6;
}

.status-withdrawn {
    background-color: #f3f4f6;
    color: #6b7280;
}

/* Pulse Animation for Active Status */
.status-pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    margin-left: 0.5rem;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    min-width: 300px;
    max-width: 500px;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    animation: toastSlideUp 0.3s ease;
}

@keyframes toastSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Form Validation States */
.form-field.error input,
.form-field.error textarea,
.form-field.error select {
    border-color: #ef4444;
}

.form-field.success input,
.form-field.success textarea,
.form-field.success select {
    border-color: #10b981;
}

.form-error-message {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-success-message {
    color: #10b981;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    backdrop-filter: blur(2px);
}

.modal {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* User Avatar */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #003D82, #006B7D);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-primary {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 1rem;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #003D82, #006B7D);
    transition: width 0.3s ease;
}

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 0.25rem;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-button {
    height: 2.5rem;
    width: 120px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .toast {
        bottom: 1rem;
        min-width: 280px;
    }
    
    .modal {
        padding: 1.5rem;
        width: 95%;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .alert-success {
        background-color: #065f46;
        color: #d1fae5;
    }
    
    .alert-error {
        background-color: #991b1b;
        color: #fee2e2;
    }
    
    .alert-warning {
        background-color: #92400e;
        color: #fef3c7;
    }
    
    .alert-info {
        background-color: #1e40af;
        color: #dbeafe;
    }
    
    .modal {
        background: #1f2937;
        color: white;
    }
    
    .skeleton {
        background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    }
}

/* RTL Support */
[dir="rtl"] .alert strong {
    margin-right: 0.5rem;
    margin-left: 0;
}

[dir="rtl"] .alert-close {
    margin-left: 0.5rem;
    margin-right: 0;
}

[dir="rtl"] .spinner {
    margin-right: 0.5rem;
    margin-left: 0;
}

[dir="rtl"] .status-pulse {
    margin-right: 0.5rem;
    margin-left: 0;
}