/* =========================================
   Post Editor Components CSS
   ========================================= */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.6rem 1.4rem;
    /* Slightly wider for pill design */
    font-size: 0.95rem;
    font-weight: 600;
    /* Slightly bolder */
    border-radius: 999px;
    /* Pill design */
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    line-height: 1.5;
}

.btn i {
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 2px 4px color-mix(in srgb, var(--color-primary) 20%, transparent);
}

.btn-primary:hover {
    background-color: #3a5a8a;
    border-color: #3a5a8a;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px color-mix(in srgb, var(--color-primary) 30%, transparent);
}

.btn-secondary {
    background-color: #ffffff;
    color: #555;
    border-color: #d1d5db;
}

.btn-secondary:hover {
    background-color: #f8f9fa;
    border-color: #9ca3af;
    color: #333;
}

/* Save Button - Premium Header Style */
#savePost {
    background: linear-gradient(180deg, rgba(103, 137, 184, 0.12), rgba(86, 122, 172, 0.09)) !important;
    color: #3f6698 !important;
    border: 1px solid rgba(93, 127, 176, 0.62) !important;
    box-shadow: 0 8px 20px -18px rgba(46, 78, 121, 0.38) !important;
}

#savePost:hover {
    background: linear-gradient(180deg, rgba(103, 137, 184, 0.18), rgba(86, 122, 172, 0.14)) !important;
    border-color: rgba(93, 127, 176, 0.82) !important;
    box-shadow: 0 12px 24px -16px rgba(46, 78, 121, 0.45) !important;
    transform: translateY(-1px);
}

#savePost i {
    color: #4a70aa !important;
}

html[data-theme="dark"] #savePost,
body[data-theme="dark"] #savePost {
    background: #2f5f96 !important;
    color: #f5f8fc !important;
    border: 1px solid #2f5f96 !important;
    box-shadow: 0 8px 18px -14px rgba(0, 0, 0, 0.55) !important;
}

html[data-theme="dark"] #savePost:hover,
body[data-theme="dark"] #savePost:hover {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    box-shadow: 0 10px 20px -14px rgba(0, 0, 0, 0.6) !important;
}

html[data-theme="dark"] #savePost i,
body[data-theme="dark"] #savePost i {
    color: #f5f8fc !important;
}


/* Inputs & Textareas */
.form-input {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: #f9fafb;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 10%, transparent);
}

/* Select Dropdown */
select.form-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    /* Custom arrow for select */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%234a6da7%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 10px auto;
    padding-right: 2.5rem;
}

/* Tag Input specific */
#postTags {
    font-family: monospace;
}

/* Citations Container */
.citations-wrapper {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.citations-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.citations-header h3 {
    font-size: 1rem;
    margin: 0;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Citation Items */
.citation-item {
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    margin-bottom: 10px;
    padding: 12px;
    border-radius: 6px;
    background-color: white;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.citation-item:hover {
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.citation-item .remove-citation {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
}

.citation-item .remove-citation:hover {
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
}

.citation-item.active {
    background-color: #e8edf5;
    border-left-color: var(--color-primary);
}

.citation-item.highlight {
    background-color: #fffde7;
    border-left-color: #f1c40f;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Citation Content */
.citation-content {
    padding-right: 24px;
    /* Space for remove button */
}

.citation-content .original-text {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 4px;
    line-height: 1.6;
}

.citation-content .translation-text {
    font-size: 0.9rem;
    color: #6b7280;
    font-style: italic;
}

/* Color Palette (Toolbar Component) */
.color-palette {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    padding: 12px;
    min-width: 200px;
}

.color-palette.show {
    display: block;
}

.color-palette-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.color-palette-item {
    width: 36px;
    height: 36px;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    box-sizing: border-box;
}

.color-palette-item:hover {
    border-color: var(--color-primary);
    transform: scale(1.1);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--color-primary) 30%, transparent);
}

.color-palette-gradient {
    background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
    position: relative;
    overflow: hidden;
}

.color-palette-footer {
    border-top: 1px solid #e0e0e0;
    padding-top: 8px;
    margin-top: 8px;
}

.color-palette-more {
    width: 100%;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #555;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.color-palette-more:hover {
    background-color: #e9ecef;
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* Modals (Generic) */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: white;
    padding: 24px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal.open .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: #333;
}
