/* ============================================================================
   Collections System - Add to Collection Modal
   Premium modal for adding poems to collections
   ============================================================================ */

/* Base Modal */
.add-collection-modal {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.add-collection-modal.active {
    opacity: 1;
    visibility: visible;
}

/* Overlay */
.add-collection-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, 
        rgba(10, 10, 12, 0.95) 0%, 
        rgba(20, 18, 15, 0.95) 100%
    );
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Content */
.add-collection-content {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    background: linear-gradient(165deg, 
        rgba(28, 26, 24, 0.98) 0%, 
        rgba(22, 20, 18, 0.99) 100%
    );
    border-radius: 24px;
    box-shadow: 
        0 0 0 1px rgba(212, 165, 116, 0.15),
        0 24px 80px rgba(0, 0, 0, 0.6),
        0 0 100px rgba(212, 165, 116, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(30px) scale(0.95);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.add-collection-modal.active .add-collection-content {
    transform: translateY(0) scale(1);
}

/* ============================================================================
   HEADER
   ============================================================================ */

.add-collection-header {
    display: flex;
    align-items: center;
    padding: 18px 22px;
    background: linear-gradient(180deg, 
        rgba(212, 165, 116, 0.08) 0%, 
        rgba(212, 165, 116, 0.02) 100%
    );
    border-bottom: 1px solid rgba(212, 165, 116, 0.1);
    flex-shrink: 0;
}

.add-collection-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
}

.add-collection-close {
    background: transparent;
    border: 1px solid rgba(212, 165, 116, 0.2);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    flex-shrink: 0;
    color: #A89B8D;
}

.add-collection-close:hover {
    background: rgba(212, 165, 116, 0.1);
    border-color: rgba(212, 165, 116, 0.3);
    color: #D4A574;
    transform: rotate(90deg);
}

.add-collection-icon {
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg, 
        rgba(212, 165, 116, 0.2) 0%, 
        rgba(212, 165, 116, 0.08) 100%
    );
    border: 1px solid rgba(212, 165, 116, 0.25);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.add-collection-icon svg {
    width: 24px;
    height: 24px;
    color: #D4A574;
}

.add-collection-header-info {
    flex: 1;
    min-width: 0;
}

.add-collection-title {
    font-family: 'Scheherazade New', serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: #F5EDE4;
    margin: 0 0 2px 0;
    line-height: 1.3;
}

.add-collection-subtitle {
    font-size: 0.85rem;
    color: #8A7F74;
    margin: 0;
}

/* ============================================================================
   BODY
   ============================================================================ */

.add-collection-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 165, 116, 0.25) transparent;
}

.add-collection-body::-webkit-scrollbar {
    width: 5px;
}

.add-collection-body::-webkit-scrollbar-track {
    background: transparent;
}

.add-collection-body::-webkit-scrollbar-thumb {
    background: rgba(212, 165, 116, 0.25);
    border-radius: 3px;
}

/* Create New Button */
.add-collection-new {
    margin-bottom: 16px;
}

.add-collection-new-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(212, 165, 116, 0.08);
    border: 1px dashed rgba(212, 165, 116, 0.25);
    border-radius: 14px;
    padding: 16px 18px;
    cursor: pointer;
    transition: all 0.25s ease;
    color: #D4A574;
    font-family: 'Markazi Text', serif;
    font-size: 1rem;
}

.add-collection-new-btn:hover {
    background: rgba(212, 165, 116, 0.12);
    border-color: rgba(212, 165, 116, 0.35);
    transform: translateY(-2px);
}

.add-collection-new-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #D4A574 0%, #C08850 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.add-collection-new-icon svg {
    width: 20px;
    height: 20px;
    color: #1A1714;
}

/* Create Form */
.add-collection-form {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(212, 165, 116, 0.12);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 16px;
}

.add-collection-form-group {
    margin-bottom: 14px;
}

.add-collection-form-group:last-of-type {
    margin-bottom: 16px;
}

.add-collection-form-group label {
    display: block;
    font-size: 0.9rem;
    color: #A89B8D;
    margin-bottom: 6px;
}

.add-collection-form-group input,
.add-collection-form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(212, 165, 116, 0.15);
    border-radius: 10px;
    color: #F5EDE4;
    font-family: 'Markazi Text', serif;
    font-size: 1rem;
    transition: all 0.25s ease;
    resize: vertical;
}

.add-collection-form-group input:focus,
.add-collection-form-group textarea:focus {
    outline: none;
    border-color: rgba(212, 165, 116, 0.4);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
}

.add-collection-form-group input::placeholder,
.add-collection-form-group textarea::placeholder {
    color: #5A5048;
}

.add-collection-form-actions {
    display: flex;
    gap: 10px;
}

.add-collection-cancel-btn {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid rgba(212, 165, 116, 0.2);
    border-radius: 10px;
    color: #A89B8D;
    font-family: 'Markazi Text', serif;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.add-collection-cancel-btn:hover {
    background: rgba(212, 165, 116, 0.08);
    border-color: rgba(212, 165, 116, 0.3);
    color: #D4A574;
}

.add-collection-create-btn {
    flex: 1.5;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #D4A574 0%, #C08850 100%);
    border: none;
    border-radius: 10px;
    color: #1A1714;
    font-family: 'Markazi Text', serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.add-collection-create-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 165, 116, 0.35);
    filter: brightness(1.1);
}

.add-collection-create-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ============================================================================
   COLLECTIONS LIST
   ============================================================================ */

.add-collection-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Collection Item */
.add-collection-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(35, 32, 28, 0.6);
    border: 1px solid rgba(212, 165, 116, 0.1);
    border-radius: 14px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
}

.add-collection-item:hover:not(.in-collection) {
    background: rgba(45, 40, 35, 0.8);
    border-color: rgba(212, 165, 116, 0.25);
    transform: translateX(-4px);
}

/* Already in collection state */
.add-collection-item.in-collection {
    background: rgba(212, 165, 116, 0.08);
    border-color: rgba(212, 165, 116, 0.25);
    cursor: pointer;
    opacity: 1;
}

.add-collection-item.in-collection:hover {
    background: rgba(212, 165, 116, 0.12);
    border-color: rgba(212, 165, 116, 0.35);
    transform: translateX(-4px);
}

.add-collection-item.in-collection .add-collection-item-icon {
    background: rgba(212, 165, 116, 0.15);
    border-color: rgba(212, 165, 116, 0.3);
}

.add-collection-item.in-collection:hover .add-collection-item-icon {
    background: rgba(212, 165, 116, 0.2);
    border-color: rgba(212, 165, 116, 0.35);
}

.add-collection-item.in-collection .add-collection-item-name {
    color: #D4A574;
}

.add-collection-item.in-collection .add-collection-item-arrow {
    display: none;
}

.add-collection-item-icon {
    width: 44px;
    height: 44px;
    background: rgba(212, 165, 116, 0.1);
    border: 1px solid rgba(212, 165, 116, 0.15);
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.add-collection-item:hover .add-collection-item-icon {
    background: rgba(212, 165, 116, 0.15);
    border-color: rgba(212, 165, 116, 0.25);
}

.add-collection-item-icon svg {
    width: 22px;
    height: 22px;
    color: #D4A574;
}

.add-collection-item-info {
    flex: 1;
    min-width: 0;
}

.add-collection-item-name {
    font-family: 'Scheherazade New', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #F5EDE4;
    margin: 0 0 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.add-collection-item-count {
    font-size: 0.85rem;
    color: #8A7F74;
    margin: 0;
}

.add-collection-item-arrow {
    color: #6B5F54;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.add-collection-item:hover:not(.in-collection) .add-collection-item-arrow {
    color: #D4A574;
    transform: translateX(-4px);
}

/* Checkmark for items already in collection */
.add-collection-item-checkmark {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #D4A574 0%, #C08850 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: auto;
    transition: all 0.25s ease;
}

.add-collection-item.in-collection:hover .add-collection-item-checkmark {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF5252 100%);
}

.add-collection-item-checkmark svg {
    width: 16px;
    height: 16px;
    color: #1A1714;
}

/* ============================================================================
   EMPTY / LOADING / ERROR STATES
   ============================================================================ */

.add-collection-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 12px;
}

.add-collection-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(212, 165, 116, 0.15);
    border-top-color: #D4A574;
    border-radius: 50%;
    animation: ac-spin 0.8s linear infinite;
}

.add-collection-spinner.small {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

@keyframes ac-spin {
    to { transform: rotate(360deg); }
}

.add-collection-loading span {
    color: #8A7F74;
    font-size: 0.9rem;
}

.add-collection-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 20px;
}

.add-collection-empty-icon {
    width: 60px;
    height: 60px;
    background: rgba(212, 165, 116, 0.08);
    border: 1px solid rgba(212, 165, 116, 0.15);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.add-collection-empty-icon svg {
    width: 30px;
    height: 30px;
    color: #6B5F54;
}

.add-collection-empty p {
    font-size: 1rem;
    color: #F5EDE4;
    margin: 0 0 4px 0;
}

.add-collection-empty span {
    font-size: 0.9rem;
    color: #6B5F54;
}

.add-collection-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 20px;
    gap: 12px;
}

.add-collection-error p {
    color: #FF6B6B;
    margin: 0;
}

.add-collection-error button {
    background: rgba(212, 165, 116, 0.1);
    border: 1px solid rgba(212, 165, 116, 0.2);
    border-radius: 8px;
    color: #D4A574;
    padding: 8px 16px;
    font-family: 'Markazi Text', serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.add-collection-error button:hover {
    background: rgba(212, 165, 116, 0.15);
    border-color: rgba(212, 165, 116, 0.3);
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .add-collection-modal {
        padding: 0;
        align-items: flex-end;
    }
    
    .add-collection-content {
        max-height: 92vh;
        max-height: 92dvh;
        border-radius: 20px 20px 0 0;
        max-width: 100%;
        width: 100%;
    }
    
    /* Override transform for mobile slide-up */
    .add-collection-modal:not(.active) .add-collection-content {
        transform: translateY(100%) scale(1);
    }
    
    .add-collection-modal.active .add-collection-content {
        transform: translateY(0) scale(1);
    }
    
    .add-collection-header {
        padding: 18px 20px;
    }
    
    .add-collection-header-left {
        gap: 12px;
    }
    
    .add-collection-close {
        width: 40px;
        height: 40px;
    }
    
    .add-collection-icon {
        width: 48px;
        height: 48px;
    }
    
    .add-collection-title {
        font-size: 1.3rem;
    }
    
    .add-collection-subtitle {
        font-size: 0.85rem;
    }
    
    .add-collection-body {
        padding: 18px 20px 28px;
    }
    
    .add-collection-new {
        margin-bottom: 18px;
    }
    
    .add-collection-new-btn {
        padding: 16px 18px;
        font-size: 1rem;
        gap: 16px;
    }
    
    .add-collection-new-icon {
        width: 44px;
        height: 44px;
    }
    
    .add-collection-form {
        padding: 16px 18px;
        margin-bottom: 18px;
    }
    
    .add-collection-form-group {
        margin-bottom: 16px;
    }
    
    .add-collection-form-group label {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }
    
    .add-collection-form-group input,
    .add-collection-form-group textarea {
        padding: 14px 16px;
        font-size: 16px; /* Prevent iOS zoom */
        border-radius: 12px;
    }
    
    .add-collection-form-actions {
        gap: 10px;
    }
    
    .add-collection-cancel-btn,
    .add-collection-create-btn {
        padding: 14px 18px;
        font-size: 1rem;
        border-radius: 12px;
    }
    
    .add-collection-list {
        gap: 12px;
    }
    
    .add-collection-item {
        padding: 16px 18px;
        gap: 14px;
        border-radius: 16px;
        min-height: 72px;
    }
    
    .add-collection-item-icon {
        width: 48px;
        height: 48px;
    }
    
    .add-collection-item-icon svg {
        width: 24px;
        height: 24px;
    }
    
    .add-collection-item-name {
        font-size: 1.15rem;
    }
    
    .add-collection-item-count {
        font-size: 0.85rem;
    }
    
    .add-collection-item-checkmark {
        width: 36px;
        height: 36px;
    }
    
    .add-collection-item-checkmark svg {
        width: 16px;
        height: 16px;
    }
    
    .add-collection-item-arrow svg {
        width: 18px;
        height: 18px;
    }
    
    /* Empty/Loading states */
    .add-collection-empty,
    .add-collection-loading {
        padding: 50px 24px;
    }
    
    .add-collection-empty-icon {
        width: 70px;
        height: 70px;
    }
    
    .add-collection-empty-icon svg {
        width: 36px;
        height: 36px;
    }
    
    .add-collection-empty p {
        font-size: 1.05rem;
    }
    
    .add-collection-empty span {
        font-size: 0.9rem;
    }
}

@media (max-width: 400px) {
    .add-collection-header {
        padding: 16px 18px;
    }
    
    .add-collection-icon {
        width: 44px;
        height: 44px;
    }
    
    .add-collection-icon svg {
        width: 22px;
        height: 22px;
    }
    
    .add-collection-title {
        font-size: 1.2rem;
    }
    
    .add-collection-subtitle {
        font-size: 0.8rem;
    }
    
    .add-collection-body {
        padding: 16px 18px 24px;
    }
    
    .add-collection-new-btn {
        padding: 14px 16px;
        font-size: 0.95rem;
    }
    
    .add-collection-new-icon {
        width: 40px;
        height: 40px;
    }
    
    .add-collection-item {
        padding: 14px 16px;
        min-height: 68px;
    }
    
    .add-collection-item-icon {
        width: 44px;
        height: 44px;
    }
    
    .add-collection-item-icon svg {
        width: 22px;
        height: 22px;
    }
    
    .add-collection-item-name {
        font-size: 1.1rem;
    }
    
    .add-collection-item-checkmark {
        width: 32px;
        height: 32px;
    }
}
