/* ====== Base ====== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f3f4f6;
    color: #111827;
}

.as-page {
    max-width: 960px;
    margin: 20px auto;
    padding: 0 16px 40px;
}

.as-title {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 700;
}

.as-desc {
    margin: 0 0 16px;
    color: #4b5563;
    font-size: 14px;
}

/* Khung bao ngoài */
.as-wrap {
    background: #ffffff;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.07);
}

/* Hàng controls */
.as-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

textarea.as-textarea {
    width: 100%;
    height: 140px;
    font-family: monospace;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    resize: vertical;
}

/* Buttons */
button.button {
    margin: 0;
    border: 1px solid #9ca3af;
    color: #111827;
    background-color: #ffffff;
    cursor: pointer;
    font-weight: 500;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.05s;
    line-height: 1;
    min-height: 2.5em;
}
button.button:hover {
    background: #f3f4f6;
}
button.button:active {
    transform: translateY(1px);
}

button.as-primary {
    background: #2396ff;
    color: #ffffff;
    border-color: #2396ff;
}
button.as-primary:hover {
    background: #1b71c2;
}

/* Nút Lưu local */
.button.as-save {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}
.button.as-save:hover {
    background: #059669;
    border-color: #059669;
}
.button.as-save.as-save-done {
    background: #16a34a;
    border-color: #16a34a;
}

/* Icon button (nút X) */
.as-icon {
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
}

/* Nút Xóa màu đỏ */
.button.as-icon.as-delete-btn {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
    font-weight: 700;
    border-radius: 4px;
	margin: 0;
	min-height: 30px;
	padding: 0;
	line-height: 30px;
}
.button.as-icon.as-delete-btn:hover {
    background: #fecaca;
    border-color: #f87171;
}

/* Đếm ngược chung */
.as-count-wrap {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
}

.as-tag {
    background: #e0f2fe;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    color: #0f172a;
    display: inline-block;
}

/* Section list */
.as-section {
    margin-top: 16px;
}

.as-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 4px;
}

.as-note {
    color: #28a745;
    font-size: 13px;
    margin-top: 4px;
}

/* Danh sách item */
.as-list {
    display: grid;
    gap: 8px;
}

.as-empty {
    padding: 6px 0;
}

/* === Item === */
.as-item {
    background: #ffffff;
    padding: 10px 12px;
    border-radius: 8px;
    box-shadow: 1px 5px 10px rgba(15, 23, 42, 0.2);
    display: flex;
    flex-direction: column;   /* label trên, body dưới */
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Label chiếm 100% */
.as-label {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
}

/* Body: meta + actions */
.as-body {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Meta bên trái (chỉ còn as-sub) */
.as-meta {
    flex: 1 1 200px;
    min-width: 0;
}

.as-sub {
    color: #4b5563;
    font-size: 13px;
    margin-top: 0;
    word-break: break-all;
}

/* Secret pill */
.as-secret-wrap {
    cursor: pointer;
    background-color: #e5e7eb;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 4px;
    transition: background 0.15s ease;
	line-height: 1;
	min-height: 30px;
}

.as-secret-wrap:hover {
    background: #caccd1;
}

.as-secret-text {
    font-size: 13px;
}

/* icon copy dùng chung – giống nhau cho secret + code */
.as-secret-copy::after,
.as-code::after {
    content: "📋";
    font-size: 14px;
    opacity: 0.85;
    margin-right: 4px;
}

/* Actions bên phải: code + X */
.as-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    white-space: nowrap;
}

/* Ô code */
.as-code {
    font-family: monospace;
    font-size: 18px;
    background: #0f172a;
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    text-align: center;
    cursor: pointer;
    position: relative;
    line-height: 1;
}

/* Fade-in animation */
@keyframes asFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Khi SECRET được copy: đổi toàn bộ text thành "✓ Copied" nhỏ xanh, fade-in */
.as-secret-text.as-copied {
    font-size: 11px;
    color: #22c55e;
    animation: asFadeIn 0.25s ease;
}

/* Khi CODE được copy: đổi toàn bộ text thành "✓ Copied" nhỏ xanh, fade-in */
.as-code.as-copied {
    font-size: 13px;
    color: #22c55e;
    background: #ecfdf5;
    animation: asFadeIn 0.25s ease;
}

/* ====== Tablet (≤ 991px) ====== */
@media (max-width: 991px) {
    .as-controls {
        flex-direction: row;
        flex-wrap: wrap;
    }

    #as-importBtn,
    #as-clearBtn,
    #as-saveBtn {
        flex: 1 1 auto;
    }
}

/* ====== Mobile (≤ 575px) ====== */
@media (max-width: 575px) {
    .as-page {
        margin-top: 12px;
    }

    textarea.as-textarea {
        height: 150px;
        font-size: 13px;
    }

    .as-controls {
        flex-direction: column;
        align-items: stretch;
    }

    #as-importBtn,
    #as-clearBtn,
    #as-saveBtn {
        width: 100%;
    }

    .as-code {
        min-width: 90px;
    }

    .as-tag {
        font-size: 11px;
    }

    .as-body {
        flex-direction: row;
        align-items: flex-start;
        gap: 6px;
    }

    .as-actions {
        align-self: center;
    }
}
