/* Unified Form Styles for Project Management */

/* Container */
.modal-form-container {
    max-width: 100%;
    padding: 1.5rem;
}

/* Titles */
.modal-form-title {
    font-size: 1.25rem;
    line-height: 1.75rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1.25rem;
    text-align: center;
}

/* Form Grid */
.modal-form-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

@media (min-width: 640px) {
    .modal-form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Fields */
.modal-form-field {
    margin-bottom: 1rem;
}

.modal-form-label {
    display: block;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.375rem;
}

.required-field::after {
    content: " *";
    color: #ef4444;
}

/* Inputs */
.modal-form-input {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: #111827;
    background-color: white;
}

.modal-form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Select */
.modal-form-select {
    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 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Textarea */
.modal-form-textarea {
    min-height: 100px;
}

/* Checkbox/Radiobox */
.modal-form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-form-check-input {
    width: 1rem;
    height: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    color: #3b82f6;
}

.modal-form-check-input:checked {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

.modal-form-check-label {
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: #374151;
}

/* Error States */
.modal-form-field.has-error .modal-form-input,
.modal-form-field.has-error .modal-form-select,
.modal-form-field.has-error .modal-form-textarea {
    border-color: #ef4444;
    background-color: #fef2f2;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.modal-form-field.has-error .modal-form-input:focus,
.modal-form-field.has-error .modal-form-select:focus,
.modal-form-field.has-error .modal-form-textarea:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

.modal-form-field.has-error .modal-form-label {
    color: #dc2626;
}

/* Error Messages */
.modal-form-error {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    line-height: 1rem;
    color: #dc2626;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.modal-form-error::before {
    content: "⚠";
    font-size: 0.875rem;
}

/* Success States */
.modal-form-field.has-success .modal-form-input,
.modal-form-field.has-success .modal-form-select,
.modal-form-field.has-success .modal-form-textarea {
    border-color: #10b981;
    background-color: #f0fdf4;
}

.modal-form-field.has-success .modal-form-input:focus,
.modal-form-field.has-success .modal-form-select:focus,
.modal-form-field.has-success .modal-form-textarea:focus {
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.modal-form-success {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    line-height: 1rem;
    color: #059669;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.modal-form-success::before {
    content: "✓";
    font-size: 0.875rem;
}

/* Form-level error messages */
.modal-form-non-field-errors {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.modal-form-non-field-errors ul {
    margin: 0;
    padding-left: 1rem;
    color: #dc2626;
    font-size: 0.875rem;
}

/* Loading states */
.modal-form-field.is-loading .modal-form-input,
.modal-form-field.is-loading .modal-form-select,
.modal-form-field.is-loading .modal-form-textarea {
    background-color: #f9fafb;
    border-color: #d1d5db;
    position: relative;
}

.modal-form-field.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Buttons */
.modal-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.modal-form-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.modal-form-btn-primary {
    background-color: #3b82f6;
    color: white;
    border: 1px solid transparent;
}

.modal-form-btn-primary:hover {
    background-color: #2563eb;
}

.modal-form-btn-secondary {
    background-color: white;
    color: #374151;
    border: 1px solid #d1d5db;
}

.modal-form-btn-secondary:hover {
    background-color: #f9fafb;
}

/* Custom Scrollbar Styles for Comments */
.scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #f3f4f6;
}

.scrollbar-thin::-webkit-scrollbar {
    width: 6px;
}

.scrollbar-thin::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Comments specific styles */
.comments-container {
    max-height: 30vh;
    overflow-y: auto;
}

.replies-container {
    max-height: 200px;
    overflow-y: auto;
}

/* Responsive comments */
@media (max-width: 768px) {
    .comments-container {
        max-height: 25vh;
    }
    
    .replies-container {
        max-height: 150px;
    }
}

@media (max-width: 640px) {
    .comments-container {
        max-height: 20vh;
    }
    
    .replies-container {
        max-height: 120px;
    }
}