/**
 * common.css — Style dùng chung toàn site (webproxy.vn)
 * Thư mục: mua/css/common.css
 *
 * Gồm:
 *   - Animations (pulse, shake, slideIn/Out, fadeIn, priceUpdate)
 *   - Brand / theme colors (.private-gradient, .private-card, .private-badge)
 *   - Modal tweaks (backdrop, .days-btn, .modal-header, .btn-close)
 *   - Note management cells (.note-cell, .note-display, .clickable-note)
 *   - #noteModal Bootstrap legacy styles
 *   - Expired proxy indicator (.expired-proxy)
 *   - History / shared table (.history-table-wrap, .history-table)
 *   - Card hover effect
 *
 * Cách dùng:
 *   <link rel="stylesheet" href="./mua/css/common.css?v=ASSET_VERSION">
 */

/* ════════════════════════════════════════════════
   1. Keyframe Animations
════════════════════════════════════════════════ */
@keyframes pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.05); background-color: #1458cc; }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%,  100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80%      { transform: translateX(10px); }
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0);    opacity: 1; }
    to   { transform: translateX(100%); opacity: 0; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes priceUpdate {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.05); background-color: #e8f5e8; }
    100% { transform: scale(1); }
}

.shake-animation {
    animation: shake 0.5s ease-in-out;
}

/* ════════════════════════════════════════════════
   2. Brand / Theme Colors
════════════════════════════════════════════════ */
.btn-danger {
    transition: all 0.3s ease;
}

.private-gradient {
    background: linear-gradient(135deg, #1458cc 0%, #1b66de 50%, #13c3bf 100%);
}

.private-card {
    border-left: 4px solid #1458cc;
}

.private-badge {
    background: linear-gradient(135deg, #1458cc, #1b66de);
    color: white;
}

/* ════════════════════════════════════════════════
   3. Card Hover
════════════════════════════════════════════════ */
.card {
    transition: all 0.3s ease;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* ════════════════════════════════════════════════
   4. Modal Tweaks (Bootstrap overlay / header / days-btn)
════════════════════════════════════════════════ */
.modal-backdrop {
    backdrop-filter: blur(3px);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.days-btn {
    border-radius: 20px;
    padding: 8px 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}
.days-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.days-btn.active {
    background: linear-gradient(135deg, #7b1fa2, #6a1b9a) !important;
    color: white !important;
    border-color: #7b1fa2 !important;
}

/* ════════════════════════════════════════════════
   5. btn-close (Bootstrap — đỏ, hover xoay 90°)
════════════════════════════════════════════════ */
.btn-close {
    background-color: rgba(220, 53, 69, 0.1);
    border-radius: 50%;
    opacity: 1;
    width: 32px;
    height: 32px;
    padding: 0;
    transition: all 0.3s ease;
}
.btn-close:hover {
    background-color: rgba(220, 53, 69, 0.2);
    transform: rotate(90deg);
    opacity: 1;
}
.modal-header .btn-close {
    filter: brightness(0) invert(0);
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23dc3545'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center / 1em auto no-repeat;
}
.modal-header .btn-close:hover {
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23bb2d3b'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center / 1em auto no-repeat;
}

/* ════════════════════════════════════════════════
   6. Note Cell Styles
════════════════════════════════════════════════ */
.note-cell {
    min-height: 40px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.note-display {
    background: none;
    padding: 0;
    border: none;
    border-radius: 0;
    max-height: none;
    overflow-y: visible;
    word-wrap: break-word;
    line-height: 1.4;
}

.clickable-note {
    background: none !important;
    border: none !important;
    position: static;
    text-decoration: underline dotted;
    text-underline-offset: 2px;
}
.clickable-note:hover {
    background: none !important;
    transform: none;
    box-shadow: none;
    opacity: 0.75;
}
.clickable-note:after {
    content: none;
}

.add-note-btn:hover,
.edit-note-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ════════════════════════════════════════════════
   7. #noteModal — Bootstrap legacy (đã thay bằng dark theme
      nhưng giữ lại để tránh lỗi nếu còn tham chiếu)
════════════════════════════════════════════════ */
#noteModal .modal-content {
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(14, 52, 115, 0.18);
}
#noteModal .modal-header {
    border-radius: 10px 10px 0 0;
    background: linear-gradient(135deg, #1e88e5, #00acc1) !important;
    color: #ffffff !important;
    padding: 0.65rem 0.9rem;
}
#noteModal .modal-title  { font-size: 1rem; line-height: 1.3; }
#noteModal .modal-body   { padding: 0.85rem 0.9rem; }
#noteModal .modal-footer { padding: 0.7rem 0.9rem; gap: 0.5rem; }
#noteModal #noteText {
    border-radius: 8px;
    border: 1px solid #ced4da;
    transition: all 0.3s ease;
    min-height: 110px;
}
#noteModal #noteText:focus {
    border-color: #1e88e5;
    box-shadow: 0 0 0 0.2rem rgba(30, 136, 229, 0.2);
}
#noteModal .btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.42rem 0.9rem;
}
#noteModal .btn.btn-warning {
    background: linear-gradient(135deg, #1e88e5, #00acc1);
    border-color: #1e88e5;
    color: #ffffff;
}
#noteModal .btn.btn-warning:hover {
    background: linear-gradient(135deg, #1976d2, #0097a7);
    border-color: #1976d2;
}

/* ════════════════════════════════════════════════
   8. Expired Proxy Indicator
════════════════════════════════════════════════ */
.expired-proxy {
    opacity: 0.3 !important;
    background-color: #f8f9fa !important;
    pointer-events: none;
    position: relative;
}
.expired-proxy::before {
    content: "EXPIRED";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(220, 53, 69, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    z-index: 10;
    pointer-events: none;
}
.expired-proxy:hover {
    opacity: 0.4 !important;
    background-color: #f8f9fa !important;
}
.expired-proxy input[type="checkbox"] {
    cursor: not-allowed !important;
    opacity: 0.3 !important;
    pointer-events: none !important;
}
.expired-proxy .proxy-clickable {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}
.expired-proxy .proxy-clickable:hover {
    background-color: #f8f9fa !important;
    transform: none !important;
}
.expired-proxy td  { color: #6c757d !important; font-style: italic; }
.expired-proxy .btn { pointer-events: none !important; opacity: 0.3 !important; }

/* ════════════════════════════════════════════════
   9. History Table (dùng chung với ?home=lichsu-tieu và tương tự)
════════════════════════════════════════════════ */
.history-table-wrap {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid rgba(20, 88, 204, 0.12);
    box-shadow: 0 14px 34px rgba(16, 56, 132, 0.10);
    overflow: hidden;
}
.history-table {
    margin-bottom: 0;
}
.history-table thead th {
    border: none !important;
    background: linear-gradient(135deg, #1458cc 0%, #2f7dff 100%) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    padding: 12px 16px !important;
    font-size: 0.93rem !important;
    white-space: nowrap;
}
.history-table tbody td {
    border-color: #edf1f8 !important;
    color: #21304b;
    padding: 13px 16px !important;
    vertical-align: middle;
    font-size: 0.92rem !important;
}
.history-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(20, 88, 204, 0.04), rgba(19, 195, 191, 0.035));
}
.history-table thead th .form-check-input {
    border: 2px solid #ffffff;
    background-color: rgba(255, 255, 255, 0.15);
}

@media (max-width: 768px) {
    .history-table thead th,
    .history-table tbody td {
        padding: 10px 12px !important;
        font-size: 0.86rem !important;
    }
    .history-table-wrap {
        border-radius: 12px;
    }
}
