/* ================================================================
   ADD TO PROJECT MODAL & PROJECTS SECTION - CSS
   Version: 5.6
   Path: public/css/add-project-modal.css
   
   FIXES:
   - Modal nền đen thống nhất
   - Toast nhỏ gọn
   - Projects section layout gọn như v5
   ================================================================ */

/* ============================================================
   TOAST - Nhỏ gọn
   ============================================================ */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(16, 185, 129, 0.95);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ============================================================
   MODAL - Nền đen thống nhất
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow-y: auto;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

/* Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #1e293b;
    background: #0f172a;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #1e293b;
    border: none;
    color: #94a3b8;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.modal-close:hover {
    background: #f87171;
    color: white;
}

/* Modal Body */
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #0f172a;
}

/* Form Group - Nền đen */
.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #94a3b8;
    margin-bottom: 6px;
}

.form-label .required {
    color: #f87171;
}

/* Form Inputs - Nền đen */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 14px;
    background: #0a0f1a;
    border: 1px solid #1e293b;
    border-radius: 8px;
    color: #f1f5f9;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #475569;
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-select option {
    background: #0a0f1a;
    color: #f1f5f9;
}

.form-textarea {
    min-height: 70px;
    resize: vertical;
}

/* Form Row */
.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Input Group with Button */
.form-input-group {
    display: flex;
    gap: 8px;
}

.form-input-group .form-input {
    flex: 1;
}

.btn-auto {
    padding: 12px 14px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #f1f5f9;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-auto:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
    color: #10b981;
}

/* Code Status */
.code-status {
    font-size: 11px;
    margin-top: 4px;
    font-weight: 500;
    min-height: 16px;
}

.code-status.checking { color: #64748b; }
.code-status.available { color: #4ade80; }
.code-status.duplicate { color: #f87171; }

/* Rating */
.rating-input {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stars-container {
    display: flex;
    gap: 2px;
}

.star {
    font-size: 24px;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.star:hover,
.star.active {
    color: #fbbf24;
    transform: scale(1.1);
}

.btn-clear-rating {
    padding: 4px 10px;
    background: transparent;
    border: 1px solid #334155;
    border-radius: 4px;
    color: #64748b;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-clear-rating:hover {
    background: rgba(248, 113, 113, 0.1);
    border-color: #f87171;
    color: #f87171;
}

/* Modal Footer */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #1e293b;
    background: #0a0f1a;
}

.modal-footer .btn {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.modal-footer .btn-secondary {
    background: #1e293b;
    color: #94a3b8;
}

.modal-footer .btn-secondary:hover {
    background: #334155;
    color: #f1f5f9;
}

.modal-footer .btn-primary {
    background: #10b981;
    color: white;
}

.modal-footer .btn-primary:hover {
    background: #059669;
}

.modal-footer .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================================
   PROJECTS SECTION - Layout gọn như v5
   ============================================================ */
.projects-section {
    margin-top: 24px;
}

.projects-header {
    margin-bottom: 16px;
}

.projects-title {
    font-size: 16px;
    font-weight: 600;
    color: #f1f5f9;
    display: flex;
    align-items: center;
    gap: 10px;
}

.projects-count {
    background: #10b981;
    color: white;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.projects-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.projects-empty {
    text-align: center;
    color: #64748b;
    padding: 20px;
    background: #1e293b;
    border-radius: 10px;
    border: 1px dashed #334155;
    font-size: 13px;
}

/* Project Card - Compact */
.project-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
    transition: all 0.2s;
}

.project-card:hover {
    border-color: #10b981;
}

.project-card.hidden-project {
    display: none;
}

.project-card.hidden-project.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.project-card-left {
    flex: 0 0 140px;
    min-width: 120px;
}

.project-name {
    font-size: 13px;
    font-weight: 600;
    color: #10b981;
    text-decoration: none;
    display: block;
    margin-bottom: 4px;
    line-height: 1.3;
}

.project-name:hover {
    text-decoration: underline;
}

.project-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    color: #64748b;
}

/* Specs Grid */
.project-specs {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.spec-box {
    display: flex;
    gap: 8px;
    background: #0f172a;
    border-radius: 6px;
    padding: 8px 10px;
    flex: 1;
    min-width: 200px;
}

.spec-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.spec-header {
    font-size: 9px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.spec-data {
    font-size: 12px;
    color: #e2e8f0;
    line-height: 1.3;
}

.spec-data.highlight {
    color: #10b981;
    font-weight: 600;
    font-size: 14px;
}

/* Project Rating */
.project-rating {
    width: 100%;
    font-size: 12px;
    color: #94a3b8;
    padding-top: 8px;
    border-top: 1px solid #334155;
    margin-top: 4px;
}

.project-rating span {
    color: #64748b;
    font-size: 11px;
}

/* Show More Button */
.btn-show-more {
    width: 100%;
    padding: 10px 16px;
    margin-top: 10px;
    background: transparent;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-show-more:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
    color: #10b981;
}

/* ============================================================
   STICKY BAR - Thumb tròn
   ============================================================ */
.sticky-action-bar .action-bar-thumb {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #10b981;
}

.sticky-action-bar .action-bar-code {
    display: none;
}

.sticky-action-bar .btn-add-project {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
}

@media (min-width: 769px) {
    .sticky-action-bar .btn-add-project {
        border-radius: 8px;
        width: auto;
        height: auto;
        padding: 10px 16px;
    }
    
    .sticky-action-bar .btn-add-project span {
        display: inline;
        margin-left: 6px;
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }
    
    .modal-content {
        max-width: 100%;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .project-card {
        flex-direction: column;
    }
    
    .project-card-left {
        flex: none;
        width: 100%;
    }
    
    .spec-box {
        min-width: 100%;
    }
    
    .toast {
        bottom: 80px;
        font-size: 12px;
        padding: 8px 16px;
    }
}

@media (max-width: 480px) {
    .modal-header {
        padding: 12px 16px;
    }
    
    .modal-title {
        font-size: 15px;
    }
    
    .modal-footer {
        padding: 12px 16px;
    }
    
    .modal-footer .btn {
        padding: 10px 14px;
        font-size: 12px;
    }
    
    .star {
        font-size: 20px;
    }
    
    .projects-title {
        font-size: 14px;
    }
    
    .project-card {
        padding: 12px;
    }
    
    .project-name {
        font-size: 12px;
    }
    
    .spec-header {
        font-size: 8px;
    }
    
    .spec-data {
        font-size: 11px;
    }
}
